Skip to content

Commit

Permalink
Merge pull request #10316 from dottharun/derivation-output-test
Browse files Browse the repository at this point in the history
test: for derivation output selection with `.`
  • Loading branch information
Ericson2314 committed Apr 3, 2024
2 parents 5959762 + 8d84de4 commit 36d92dc
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/functional/flakes/build-paths.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,23 @@ cat > $flake1Dir/flake.nix <<EOF
a12 = self.drvCall.outPath;
a13 = "\${self.drvCall.drvPath}\${self.drvCall.outPath}";
a14 = with import ./config.nix; let
top = mkDerivation {
name = "dot-installable";
outputs = [ "foo" "out" ];
meta.outputsToInstall = [ "out" ];
buildCommand = ''
mkdir \$foo \$out
echo "foo" > \$foo/file
echo "out" > \$out/file
'';
};
in top // {
foo = top.foo // {
outputSpecified = true;
};
};
};
}
EOF
Expand Down Expand Up @@ -94,3 +111,10 @@ nix build --json --out-link $TEST_ROOT/result $flake1Dir#a12

expectStderr 1 nix build --impure --json --out-link $TEST_ROOT/result $flake1Dir#a13 \
| grepQuiet "has 2 entries in its context. It should only have exactly one entry"

# Test accessing output in installables with `.` (foobarbaz.<output>)
nix build --json --no-link $flake1Dir#a14.foo | jq --exit-status '
(.[0] |
(.drvPath | match(".*dot-installable.drv")) and
(.outputs | keys == ["foo"]))
'

0 comments on commit 36d92dc

Please sign in to comment.