From a021d211906d23c9e3454da974806454e9ec74c2 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 24 Nov 2026 01:04:21 +0000 Subject: populate lib: leave out sources whose types are set to null A source's type can depend on a condition, e.g. nixpkgs.file = optionalSource local { ... }, which returns the settings if the condition holds, and else null. A source whose types are all null, at least one of them set to null rather than left unset, gets the type null, and evalSource leaves it out. A type left unset, e.g. by lib.mkIf false, still counts as missing, so an empty source stays an error. krops' lib provides optionalSource, too. --- lib/with.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/with.nix') diff --git a/lib/with.nix b/lib/with.nix index b3ff7fa..bf164e0 100644 --- a/lib/with.nix +++ b/lib/with.nix @@ -14,7 +14,8 @@ in rec { # What populate's Nix library defines. - inherit (populate.lib) evalSource flakeFollows hasGeneratedFlake derivesFlake; + inherit (populate.lib) + evalSource flakeFollows hasGeneratedFlake derivesFlake optionalSource; maybeHostName = default: let # We're parsing /etc/hostname here because reading -- cgit v1.3.1