diff options
author | Florian Klink <flokli@flokli.de> | 2023-10-29T17·39+0200 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-10-29T17·49+0000 |
commit | 2513ddd2b7559628a0135ec0c8e4e8ea4444af8d (patch) | |
tree | 21f24e4b10fcd2668c1907414f7b39982d0cf873 | |
parent | 85cd7d64fec9031f5bb806e1c55038c8c4158dbe (diff) |
feat(users/flokli/nixos): add deploy script r/6905
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>
-rw-r--r-- | users/flokli/nixos/default.nix | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/users/flokli/nixos/default.nix b/users/flokli/nixos/default.nix index 412a0fae346a..b4ed22ed595a 100644 --- a/users/flokli/nixos/default.nix +++ b/users/flokli/nixos/default.nix @@ -6,11 +6,26 @@ let 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) + ]; + }; } |