mirror of
https://github.com/NixOS/nix
synced 2025-07-08 11:03:54 +02:00
Merge pull request #6426 from edolstra/respect-outputs-to-install
nix: Respect meta.outputsToInstall, and use all outputs by default
This commit is contained in:
commit
404c222444
12 changed files with 105 additions and 31 deletions
|
@ -2,15 +2,8 @@ source common.sh
|
|||
|
||||
clearStore
|
||||
|
||||
# Make sure that 'nix build' only returns the outputs we asked for.
|
||||
nix build -f multiple-outputs.nix --json a --no-link | jq --exit-status '
|
||||
(.[0] |
|
||||
(.drvPath | match(".*multiple-outputs-a.drv")) and
|
||||
(.outputs | keys | length == 1) and
|
||||
(.outputs.first | match(".*multiple-outputs-a-first")))
|
||||
'
|
||||
|
||||
nix build -f multiple-outputs.nix --json a.all b.all --no-link | jq --exit-status '
|
||||
# Make sure that 'nix build' returns all outputs by default.
|
||||
nix build -f multiple-outputs.nix --json a b --no-link | jq --exit-status '
|
||||
(.[0] |
|
||||
(.drvPath | match(".*multiple-outputs-a.drv")) and
|
||||
(.outputs | keys | length == 2) and
|
||||
|
|
|
@ -23,7 +23,7 @@ rec {
|
|||
};
|
||||
rootCA = mkCADerivation {
|
||||
name = "rootCA";
|
||||
outputs = [ "out" "dev" "foo"];
|
||||
outputs = [ "out" "dev" "foo" ];
|
||||
buildCommand = ''
|
||||
echo "building a CA derivation"
|
||||
echo "The seed is ${toString seed}"
|
||||
|
|
|
@ -25,7 +25,8 @@ buildDrvs --substitute --substituters $REMOTE_STORE --no-require-sigs -j0 transi
|
|||
# Check that the thing we’ve just substituted has its realisation stored
|
||||
nix realisation info --file ./content-addressed.nix transitivelyDependentCA
|
||||
# Check that its dependencies have it too
|
||||
nix realisation info --file ./content-addressed.nix dependentCA rootCA
|
||||
nix realisation info --file ./content-addressed.nix dependentCA
|
||||
# nix realisation info --file ./content-addressed.nix rootCA --outputs out
|
||||
|
||||
# Same thing, but
|
||||
# 1. With non-ca derivations
|
||||
|
|
|
@ -17,6 +17,7 @@ cat > $flake1Dir/flake.nix <<EOF
|
|||
outputs = { self }: with import ./config.nix; rec {
|
||||
packages.$system.default = mkDerivation {
|
||||
name = "profile-test-\${builtins.readFile ./version}";
|
||||
outputs = [ "out" "man" "dev" ];
|
||||
builder = builtins.toFile "builder.sh"
|
||||
''
|
||||
mkdir -p \$out/bin
|
||||
|
@ -26,10 +27,13 @@ cat > $flake1Dir/flake.nix <<EOF
|
|||
EOF
|
||||
chmod +x \$out/bin/hello
|
||||
echo DONE
|
||||
mkdir -p \$man/share/man
|
||||
mkdir -p \$dev/include
|
||||
'';
|
||||
__contentAddressed = import ./ca.nix;
|
||||
outputHashMode = "recursive";
|
||||
outputHashAlgo = "sha256";
|
||||
meta.outputsToInstall = [ "out" "man" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -46,6 +50,8 @@ nix-env -f ./user-envs.nix -i foo-1.0
|
|||
nix profile list | grep '0 - - .*-foo-1.0'
|
||||
nix profile install $flake1Dir -L
|
||||
[[ $($TEST_HOME/.nix-profile/bin/hello) = "Hello World" ]]
|
||||
[ -e $TEST_HOME/.nix-profile/share/man ]
|
||||
(! [ -e $TEST_HOME/.nix-profile/include ])
|
||||
nix profile history
|
||||
nix profile history | grep "packages.$system.default: ∅ -> 1.0"
|
||||
nix profile diff-closures | grep 'env-manifest.nix: ε → ∅'
|
||||
|
@ -55,7 +61,7 @@ printf NixOS > $flake1Dir/who
|
|||
printf 2.0 > $flake1Dir/version
|
||||
nix profile upgrade 1
|
||||
[[ $($TEST_HOME/.nix-profile/bin/hello) = "Hello NixOS" ]]
|
||||
nix profile history | grep "packages.$system.default: 1.0 -> 2.0"
|
||||
nix profile history | grep "packages.$system.default: 1.0, 1.0-man -> 2.0, 2.0-man"
|
||||
|
||||
# Test 'history', 'diff-closures'.
|
||||
nix profile diff-closures
|
||||
|
@ -86,7 +92,7 @@ nix profile wipe-history
|
|||
printf true > $flake1Dir/ca.nix
|
||||
printf 3.0 > $flake1Dir/version
|
||||
nix profile upgrade 0
|
||||
nix profile history | grep "packages.$system.default: 1.0 -> 3.0"
|
||||
nix profile history | grep "packages.$system.default: 1.0, 1.0-man -> 3.0, 3.0-man"
|
||||
|
||||
# Test new install of CA package.
|
||||
nix profile remove 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue