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>
This commit is contained in:
Florian Klink 2023-10-29 19:39:21 +02:00 committed by clbot
parent 85cd7d64fe
commit 2513ddd2b7

View file

@ -6,11 +6,26 @@ let
systemFor = sys: (depot.ops.nixos.nixosFor sys).system; 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 in
{ rec {
archeologySystem = (depot.ops.nixos.nixosFor ({ ... }: { archeologySystem = (depot.ops.nixos.nixosFor ({ ... }: {
imports = [ imports = [
./archeology/configuration.nix ./archeology/configuration.nix
]; ];
})).config.system.build.toplevel; })).config.system.build.toplevel;
shell = pkgs.mkShell {
name = "flokli-nixos-shell";
packages = [
(deployScript "archeology" archeologySystem)
];
};
} }