diff options
| author | tv <tv@krebsco.de> | 2026-11-11 17:07:28 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-11 17:07:28 +0000 |
| commit | 2451dceb0cf2b0b4e5b1815dd28fb480ba1d5956 (patch) | |
| tree | 3f75a31fc076eebf6064d16dc29c74bbed3cc21e /pkgs | |
| parent | c59f05ae0b5a789f36b57f5839cd22af608dbf3d (diff) | |
krops writeDeploy: add flake parameter
With flake set, nixos-rebuild deploys that flake from the build target's
source directory, with flakes enabled for the command. The deployment fails
with an error message unless Nix on the build target supports flakes.
Diffstat (limited to 'pkgs')
| -rw-r--r-- | pkgs/krops/default.nix | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pkgs/krops/default.nix b/pkgs/krops/default.nix index 04c38cf..93f9d0e 100644 --- a/pkgs/krops/default.nix +++ b/pkgs/krops/default.nix @@ -5,13 +5,18 @@ in { nix, openssh, populate, writers }: rec { rebuild = { + flake ? null, useNixOutputMonitor }: args: target: runShell target {} (withNixOutputMonitor target useNixOutputMonitor /* sh */ '' + ${lib.optionalString (flake != null) + (lib.shell.requireFlakes "deploying a flake")} NIX_PATH=${lib.escapeShellArg target.path} \ - nixos-rebuild ${lib.escapeShellArgs args} + nixos-rebuild ${lib.escapeShellArgs (args ++ lib.optionals (flake != null) [ + "--flake" "${target.path}/${flake}" + ])} ''); runShell = target: { @@ -91,6 +96,7 @@ in buildTarget ? null, crossDeploy ? false, fast ? null, + flake ? null, force ? false, operation ? "switch", source, @@ -109,7 +115,7 @@ in ${lib.optionalString (buildTarget' != target') (populate { inherit backup force source; target = buildTarget'; })} ${populate { inherit backup force source; target = target'; }} - ${rebuild { inherit useNixOutputMonitor; } ([ + ${rebuild { inherit flake useNixOutputMonitor; } ([ operation ] ++ lib.optionals crossDeploy [ "--no-build-nix" |
