aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/populate/checks.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-13 21:28:11 +0100
committertv <tv@krebsco.de>2026-11-13 21:28:11 +0100
commitd36d2e631e4baceed0a8c0c00859ebb2ab8cb82f (patch)
tree98227d0091b8b23c0c69dcc3e5a770a0da291a37 /pkgs/populate/checks.nix
parentbcffc9b0a00f3c49db71fe61e8185b9b8e281e55 (diff)
populate: drop the shell implementation
Populate is the program in Rust only. pkgs.populate checks its arguments, and returns a script running the program with them as JSON. The arguments it took for the shell implementation, dash, jq, and implementation, stay accepted and unused, so overrides setting them keep working. Copying flakes to remote targets using sudo gets refused during evaluation, as before, by checks.nix, and by the program for specs from elsewhere. The jq test goes with the jq programs; the program's unit tests cover their equivalents.
Diffstat (limited to 'pkgs/populate/checks.nix')
-rw-r--r--pkgs/populate/checks.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkgs/populate/checks.nix b/pkgs/populate/checks.nix
index 7eab15b..22b45c9 100644
--- a/pkgs/populate/checks.nix
+++ b/pkgs/populate/checks.nix
@@ -49,4 +49,18 @@ with import ../../lib;
throw "krops: sources draw inputs from each other: ${toString sorted.cycle}"
else
true);
+
+ # nix copy logs in as the target's user, so populate can't copy flakes to
+ # remote targets using sudo, which flake and flake-input sources without
+ # fetchOnTarget do.
+ checkCopyingWithSudo = target: source: let
+ copies = name: let s = source.${name}; in
+ elem s.type [ "flake" "flake-input" ] &&
+ !(s.${s.type}.fetchOnTarget or false);
+ name = findFirst copies null (attrNames source);
+ in
+ if name != null && target.sudo or false && !isLocalTarget target then
+ throw "krops: source ${target.path}/${name}: copying flakes to targets with sudo is not supported"
+ else
+ true;
}