aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-12 19:56:13 +0000
committertv <tv@krebsco.de>2026-11-13 03:24:17 +0100
commit9f824e06ee72fcb2cdacf9b90885f5cd0606a180 (patch)
tree8c98563391b20bd09aa651a8347e4bf77ae523fb /lib
parent470de08082a8d251c3854ceb6da9cef8bd43b74b (diff)
populate flake-input: fail on failures, reuse the store, leave out replaced inputs
Delivering flakes and flake inputs gets more robust: - With fetchOnTarget, the inputs get collected before the pipeline that links them, so populate fails if the target can't fetch one, instead of linking the flake without its inputs and succeeding. - What the lock file pins gets taken from the store if it's there: the store path is the one of a directory named source with the locked hash, which nix-store --print-fixed-path computes. builtins.fetchTree contacts where the input comes from even then, so redeploying unchanged sources fails without that if a server is unreachable. - With fetchOnTarget, a delivered input that is itself locked to a local path the target lacks fails with populate's error naming the input, like its inputs do. - Inputs that get drawn from other sources are left out, with all they pin: Nix archives an empty flake in their place. So nothing gets fetched, copied, and rooted that no evaluation uses, and a pin that is unreachable doesn't matter if it gets replaced anyway. - flake-input sources get the option requireInputs. By default, populating fails if the inputs that the input's own lock file pins can't be delivered, e.g. because the lock file lacks an input its flake.nix has. With false, populate warns and delivers the input with what Nix locks now, or else without its inputs. A remote flake that the target fetches entirely on its own collects its inputs like everything else does. The Nix function finding its subdirectory moves next to the jq programs. New edge cases cover each of these.
Diffstat (limited to 'lib')
-rw-r--r--lib/types/populate.nix4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/types/populate.nix b/lib/types/populate.nix
index a278ffd..1a18b62 100644
--- a/lib/types/populate.nix
+++ b/lib/types/populate.nix
@@ -233,6 +233,10 @@
name = lib.mkOption {
type = lib.types.str;
};
+ requireInputs = lib.mkOption {
+ default = true;
+ type = lib.types.bool;
+ };
};
};
git = lib.types.submodule {