From 2513ddd2b7559628a0135ec0c8e4e8ea4444af8d Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sun, 29 Oct 2023 19:39:21 +0200 Subject: 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 Tested-by: BuildkiteCI Reviewed-by: edef --- users/flokli/nixos/default.nix | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'users/flokli') 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) + ]; + }; } -- cgit 1.4.1