diff --git a/corepkgs/buildenv.nix b/corepkgs/buildenv.nix index 923778379263cf4990636997e0075a73fc1e5bb0..c52a0ea93d35a3ce89bb1fa685dbe22db8b0f59a 100644 --- a/corepkgs/buildenv.nix +++ b/corepkgs/buildenv.nix @@ -13,7 +13,7 @@ derivation { # !!! grmbl, need structured data for passing this in a clean way. derivations = map (d: - [ (if d.meta.active or true then "1" else "0") + [ (d.meta.active or "true") (d.meta.priority or 5) (builtins.length d.outputs) ] ++ map (output: builtins.getAttr output d) d.outputs) diff --git a/corepkgs/buildenv.pl b/corepkgs/buildenv.pl index 3d79e50316fd5393a2090c71a993cfadc6f95cdf..ea517687bd1d21caddc1b06952a9b71229a10894 100644 --- a/corepkgs/buildenv.pl +++ b/corepkgs/buildenv.pl @@ -134,7 +134,7 @@ while (scalar @derivations) { for (my $n = 0; $n < $outputs; $n++) { my $path = shift @derivations; $pkgs{$path} = - { active => int($active) + { active => $active ne "false" , priority => int($priority) }; } } diff --git a/tests/user-envs.sh b/tests/user-envs.sh index 2bc9bee50baa087cc36d20062e872246f52e8b9e..465d2fc55d991276e59db60fe1548cdc72a58365 100644 --- a/tests/user-envs.sh +++ b/tests/user-envs.sh @@ -22,6 +22,14 @@ test "$(nix-env -p $profiles/test -q '*' | wc -l)" -eq 1 nix-env -p $profiles/test -q '*' | grep -q foo-1.0 test "$($profiles/test/bin/foo)" = "foo-1.0" +# Disable foo. +nix-env -p $profiles/test --set-flag active false foo +! [ -e "$profiles/test/bin/foo" ] + +# Enable foo. +nix-env -p $profiles/test --set-flag active true foo +[ -e "$profiles/test/bin/foo" ] + # Store the path of foo-1.0. outPath10=$(nix-env -p $profiles/test -q --out-path --no-name '*' | grep foo-1.0) echo "foo-1.0 = $outPath10" @@ -67,7 +75,7 @@ if nix-env -p $profiles/test -q '*' | grep -q bar; then false; fi # Count generations. nix-env -p $profiles/test --list-generations -test "$(nix-env -p $profiles/test --list-generations | wc -l)" -eq 5 +test "$(nix-env -p $profiles/test --list-generations | wc -l)" -eq 7 # Install foo-1.0, now using its store path. echo $outPath10