Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: for derivation output selection with . #10316

Merged
merged 3 commits into from
Apr 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions tests/functional/flakes/flakes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,35 @@ git -C "$flake3Dir" add flake.lock

git -C "$flake3Dir" commit -m 'Add lockfile'

# Test accessing output in installables with `.` (foobarbaz.<output>)
cat > "$flake3Dir/flake.nix" <<EOF
{
outputs = {self}: {
packages.$system.hello = (import ./config.nix).mkDerivation {
name = "hello";
outputs = [ "foo" "out" ];
meta.outputsToInstall = [ "out" ];
buildCommand = ''
mkdir \$foo \$out
echo "foo" > \$foo/file
echo "out" > \$out/file
'';
outputSpecified = true;
};
};
}
EOF

cp ../config.nix "$flake3Dir"
git -C "$flake3Dir" add flake.nix config.nix
git -C "$flake3Dir" commit -m 'multi outputs flake'

Ericson2314 marked this conversation as resolved.
Show resolved Hide resolved
nix build "$flake3Dir#hello.foo" --json --no-link | jq --exit-status '
(.[0] |
(.drvPath | match(".*hello.drv")) and
(.outputs | keys == ["foo"]))
'

Ericson2314 marked this conversation as resolved.
Show resolved Hide resolved
# Test whether registry caching works.
nix registry list --flake-registry "file://$registry" | grepQuiet flake3
mv "$registry" "$registry.tmp"
Expand Down
Loading