tvl-depot/users/flokli/nixos/default.nix
Florian Klink 2513ddd2b7 feat(users/flokli/nixos): add deploy script
This adds a deploy-archeology script.

I tried getting morph to work first, but passing it a
depot.ops.nixos.nixosFor seems to be very hard - the NixOS module system
doesn't like the arguments it's called with.

Replace morph with a 3 line bash script, which assumes your ssh_config
contains config for an `archeology` host.

Change-Id: I2bf694c60ded39c201efbbb899f3b5512aa4d0f2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9835
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: edef <edef@edef.eu>
2023-10-29 17:49:25 +00:00

31 lines
810 B
Nix

{ depot, pkgs, lib, ... }:
let
inherit (depot.users.flokli.nixos)
archeology;
systemFor = sys: (depot.ops.nixos.nixosFor sys).system;
# assumes `name` is configured appropriately in your .ssh/config
deployScript = name: sys: pkgs.writeShellScriptBin "deploy-${name}" ''
set -eo pipefail
nix copy --no-check-sigs --to ssh-ng://${name} ${sys}
ssh ${name} nix-env --profile /nix/var/nix/profiles/system --set ${sys}
ssh ${name} ${sys}/bin/switch-to-configuration switch
'';
in
rec {
archeologySystem = (depot.ops.nixos.nixosFor ({ ... }: {
imports = [
./archeology/configuration.nix
];
})).config.system.build.toplevel;
shell = pkgs.mkShell {
name = "flokli-nixos-shell";
packages = [
(deployScript "archeology" archeologySystem)
];
};
}