Skip to content

Commit 36d92dc

Browse files
authored
Merge pull request #10316 from dottharun/derivation-output-test
test: for derivation output selection with `.`
2 parents 5959762 + 8d84de4 commit 36d92dc

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/functional/flakes/build-paths.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,23 @@ cat > $flake1Dir/flake.nix <<EOF
5656
a12 = self.drvCall.outPath;
5757
5858
a13 = "\${self.drvCall.drvPath}\${self.drvCall.outPath}";
59+
60+
a14 = with import ./config.nix; let
61+
top = mkDerivation {
62+
name = "dot-installable";
63+
outputs = [ "foo" "out" ];
64+
meta.outputsToInstall = [ "out" ];
65+
buildCommand = ''
66+
mkdir \$foo \$out
67+
echo "foo" > \$foo/file
68+
echo "out" > \$out/file
69+
'';
70+
};
71+
in top // {
72+
foo = top.foo // {
73+
outputSpecified = true;
74+
};
75+
};
5976
};
6077
}
6178
EOF
@@ -94,3 +111,10 @@ nix build --json --out-link $TEST_ROOT/result $flake1Dir#a12
94111

95112
expectStderr 1 nix build --impure --json --out-link $TEST_ROOT/result $flake1Dir#a13 \
96113
| grepQuiet "has 2 entries in its context. It should only have exactly one entry"
114+
115+
# Test accessing output in installables with `.` (foobarbaz.<output>)
116+
nix build --json --no-link $flake1Dir#a14.foo | jq --exit-status '
117+
(.[0] |
118+
(.drvPath | match(".*dot-installable.drv")) and
119+
(.outputs | keys == ["foo"]))
120+
'

0 commit comments

Comments
 (0)