diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-04-22 15:17:01 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2022-05-03 13:43:52 +0200 |
commit | 4a79cba5118f29b896f3d50164beacd4901ab01f (patch) | |
tree | 2159770446fb151e12bf82856b6418201ae23bbf /tests/build.sh | |
parent | 404c222444b4c8c60148ccf890cd41611f26b0a0 (diff) |
Allow selecting derivation outputs using 'installable!outputs'
E.g. 'nixpkgs#glibc^dev,static' or 'nixpkgs#glibc^*'.
Diffstat (limited to 'tests/build.sh')
-rw-r--r-- | tests/build.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/build.sh b/tests/build.sh index 339155991..ff16d1603 100644 --- a/tests/build.sh +++ b/tests/build.sh @@ -2,6 +2,8 @@ source common.sh clearStore +set -o pipefail + # 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] | @@ -15,6 +17,45 @@ nix build -f multiple-outputs.nix --json a b --no-link | jq --exit-status ' (.outputs.out | match(".*multiple-outputs-b"))) ' +# Test output selection using the '^' syntax. +nix build -f multiple-outputs.nix --json a^first --no-link | jq --exit-status ' + (.[0] | + (.drvPath | match(".*multiple-outputs-a.drv")) and + (.outputs | keys == ["first"])) +' + +nix build -f multiple-outputs.nix --json a^second,first --no-link | jq --exit-status ' + (.[0] | + (.drvPath | match(".*multiple-outputs-a.drv")) and + (.outputs | keys == ["first", "second"])) +' + +nix build -f multiple-outputs.nix --json 'a^*' --no-link | jq --exit-status ' + (.[0] | + (.drvPath | match(".*multiple-outputs-a.drv")) and + (.outputs | keys == ["first", "second"])) +' + +# Test that 'outputsToInstall' is respected by default. +nix build -f multiple-outputs.nix --json e --no-link | jq --exit-status ' + (.[0] | + (.drvPath | match(".*multiple-outputs-e.drv")) and + (.outputs | keys == ["a", "b"])) +' + +# But not when it's overriden. +nix build -f multiple-outputs.nix --json e^a --no-link | jq --exit-status ' + (.[0] | + (.drvPath | match(".*multiple-outputs-e.drv")) and + (.outputs | keys == ["a"])) +' + +nix build -f multiple-outputs.nix --json 'e^*' --no-link | jq --exit-status ' + (.[0] | + (.drvPath | match(".*multiple-outputs-e.drv")) and + (.outputs | keys == ["a", "b", "c"])) +' + testNormalization () { clearStore outPath=$(nix-build ./simple.nix --no-out-link) |