diff options
| author | tv <tv@krebsco.de> | 2026-11-12 02:33:44 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-12 02:33:44 +0000 |
| commit | 352dd5ce3107e2547db56802d773b919df03690f (patch) | |
| tree | 1e5f6a3030e9eefee520728b1599f5ff6acf1f80 /pkgs | |
| parent | d63531d2d42524f5150d138000bec42fd49d1e71 (diff) | |
populate, krops writeDeploy: refer to generated flakes as path:
Generated flakes got locked with a bare nix flake lock in their directory,
and writeDeploy deployed them by their path. Nix takes both for the
enclosing Git work tree, if the target directory lies in one, e.g. a home
directory kept in Git, and fails, because generated flakes aren't tracked
there. Both refer to generated flakes as path: now.
An edge case deploys into a Git work tree, and the deploy test covers
deploying generated flakes.
Diffstat (limited to 'pkgs')
| -rw-r--r-- | pkgs/krops/default.nix | 6 | ||||
| -rw-r--r-- | pkgs/populate/default.nix | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/pkgs/krops/default.nix b/pkgs/krops/default.nix index e4f72cd..46ca66f 100644 --- a/pkgs/krops/default.nix +++ b/pkgs/krops/default.nix @@ -15,7 +15,11 @@ in (lib.shell.requireFlakes "deploying a flake")} NIX_PATH=${lib.escapeShellArg target.path} \ nixos-rebuild ${lib.escapeShellArgs (args ++ lib.optionals (flake != null) [ - "--flake" "${target.path}/${flake}" + "--flake" + # Generated flakes as path:, not just their paths, which Nix takes + # for the enclosing Git work tree, if any. + (lib.optionalString (lib.hasPrefix ".populate/flakes/" flake) "path:" + + "${target.path}/${flake}") ])} ${lib.optionalString (flake == null) # nixos-rebuild deploys /etc/nixos/flake.nix if it exists. Any # nixos-rebuild doing so supports --no-flake. diff --git a/pkgs/populate/default.nix b/pkgs/populate/default.nix index 08a624b..0992b0c 100644 --- a/pkgs/populate/default.nix +++ b/pkgs/populate/default.nix @@ -120,7 +120,8 @@ let printf ' outputs = inputs: inputs.%s;\n' ${quote (toJSON name)} echo '}' } > flake.nix - nix flake lock >&2 + # Not just ., which Nix takes for the enclosing Git work tree, if any. + nix flake lock ${quote "path:${flakesDir}/${name}"} >&2 ) ''; in |
