From e1cda094c011a96a60cbe8d1ae3190401d40f862 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Sun, 26 Dec 2021 12:54:05 +0100 Subject: [PATCH] flake.nix: Add app to locally build remote deployment --- flake.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/flake.nix b/flake.nix index 42dd380..66b0b42 100644 --- a/flake.nix +++ b/flake.nix @@ -109,6 +109,18 @@ ) self.nixosConfigurations); + deploy-local = lib.recurseIntoAttrs (lib.mapAttrs + (hostname: machine: pkgs.writeShellScript "deploy-local-${hostname}" '' + ${pkgs.nixos-rebuild.override { nix = pkgs.nixFlakes; }}/bin/nixos-rebuild \ + switch \ + --flake .#${hostname} \ + -L \ + --build-host localhost \ + --target-host root@${machine.config.deployment.targetHost} \ + --use-substitutes + '') + self.nixosConfigurations); + unlock = lib.recurseIntoAttrs (lib.mapAttrs (hostname: machine: let