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

Low level <drvPath>^<outputName> installable syntax to match existing <highLevelInstallable>^<outputNames> syntax #4543

Merged
merged 30 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8499f32
New "indexed" installable syntax: `<drvPath>!<outputName>`
Ericson2314 Feb 12, 2021
1ef88da
Merge remote-tracking branch 'upstream/master' into indexed-store-pat…
Ericson2314 Sep 30, 2021
e5c42bb
Merge remote-tracking branch 'upstream/master' into indexed-store-pat…
Ericson2314 Mar 10, 2022
0966532
Merge remote-tracking branch 'upstream' into indexed-store-path-outputs
Ericson2314 Mar 25, 2022
9c6be01
Merge remote-tracking branch 'upstream/master' into indexed-store-pat…
Ericson2314 Apr 1, 2022
6951b26
Require (new) computed-derivations experimental feature for ! install…
Ericson2314 Apr 1, 2022
5c1f2e0
Merge remote-tracking branch 'upstream/master' into indexed-store-pat…
Ericson2314 Apr 7, 2022
fda2224
Add release notes mark experimental
Ericson2314 Apr 7, 2022
41e755b
Merge remote-tracking branch 'upstream/master' into indexed-store-pat…
Ericson2314 Apr 19, 2022
6b61d77
Merge remote-tracking branch 'upstream/master' into indexed-store-pat…
Ericson2314 Apr 19, 2022
b18720e
Merge remote-tracking branch 'upstream/master' into indexed-store-pat…
Ericson2314 May 12, 2022
49ad315
Use `^` not `!` in indexed store derivations installable syntax
Ericson2314 May 12, 2022
b585548
Merge remote-tracking branch 'upstream/master' into indexed-store-pat…
Ericson2314 Jun 2, 2022
6cafe30
Merge remote-tracking branch 'upstream/master' into indexed-store-pat…
Ericson2314 Jul 14, 2022
f3262bc
Combine `InstallableStorePath` with `InstallableIndexedStorePath`
Ericson2314 Jul 14, 2022
8735f55
Fix bug, test more, document more
Ericson2314 Jul 15, 2022
279ecf7
Remove `computed-derivations` experimental feature
Ericson2314 Jul 15, 2022
0e4ec98
Fix typo in docs
Ericson2314 Jul 15, 2022
12461e2
Leverage existing docs for new store-path^outputs syntax
Ericson2314 Jul 15, 2022
13f2a6f
Merge branch 'master' into indexed-store-path-outputs
Ericson2314 Oct 28, 2022
26534f1
Merge branch 'master' into indexed-store-path-outputs
Ericson2314 Nov 25, 2022
1879c7c
Merge branch 'master' into indexed-store-path-outputs
Ericson2314 Dec 12, 2022
dc075dc
Apply suggestions from code review
Ericson2314 Dec 12, 2022
c7cce3e
Improve release notes
Ericson2314 Dec 12, 2022
d8c1c24
Adjust docs
Ericson2314 Dec 12, 2022
c886b18
Merge new tests into `build.sh`
Ericson2314 Dec 12, 2022
dabb03b
Merge remote-tracking branch 'upstream/master' into indexed-store-pat…
Ericson2314 Dec 12, 2022
32ae715
Fix typos in the docs
Ericson2314 Dec 12, 2022
5273cf4
Merge remote-tracking branch 'upstream/master' into indexed-store-pat…
Ericson2314 Dec 12, 2022
f61d575
Merge branch 'indexed-store-path-outputs' of github.com:obsidiansyste…
Ericson2314 Dec 12, 2022
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
11 changes: 6 additions & 5 deletions src/nix/nix.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,9 @@ operate are determined as follows:
# nix path-info -S '/nix/store/gzaflydcr6sb3567hap9q6srzx8ggdgg-glibc-2.33-78.drv^*'
```

* If you didn't specify the desired outputs, but the derivation comes
from an expression which has an attribute `meta.outputsToInstall`, Nix
will use those outputs. For example, since the package
`nixpkgs#libxml2` has this attribute:
* If you didn't specify the desired outputs, but the derivation hs an
Ericson2314 marked this conversation as resolved.
Show resolved Hide resolved
attribute `meta.outputsToInstall`, Nix will use those outputs. For
example, since the package `nixpkgs#libxml2` has this attribute:

```console
# nix eval 'nixpkgs#libxml2.meta.outputsToInstall'
Expand All @@ -204,6 +202,9 @@ operate are determined as follows:
a command like `nix shell nixpkgs#libxml2` will provide only those
two outputs by default.

Note that a store derivation (given by `.drv` file store path) doesn't have
any attributes like `meta`, and thus this case doesn't apply to it.

* Otherwise, Nix will use all outputs of the derivation.

# Nix stores
Expand Down
43 changes: 0 additions & 43 deletions tests/build-explicit-output.sh

This file was deleted.

42 changes: 42 additions & 0 deletions tests/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,48 @@ nix build -f multiple-outputs.nix --json 'e^*' --no-link | jq --exit-status '
(.outputs | keys == ["a", "b", "c"]))
'

# Test building from raw store path to drv not expression.

drv=$(nix eval -f multiple-outputs.nix --raw a.drvPath)
if nix build "$drv^not-an-output" --no-link --json; then
fail "'not-an-output' should fail to build"
fi

if nix build "$drv^" --no-link --json; then
fail "'empty outputs list' should fail to build"
fi

if nix build "$drv^*nope" --no-link --json; then
fail "'* must be entire string' should fail to build"
fi

nix build "$drv^first" --no-link --json | jq --exit-status '
(.[0] |
(.drvPath | match(".*multiple-outputs-a.drv")) and
(.outputs |
(keys | length == 1) and
(.first | match(".*multiple-outputs-a-first")) and
(has("second") | not)))
'

nix build "$drv^first,second" --no-link --json | jq --exit-status '
(.[0] |
(.drvPath | match(".*multiple-outputs-a.drv")) and
(.outputs |
(keys | length == 2) and
(.first | match(".*multiple-outputs-a-first")) and
(.second | match(".*multiple-outputs-a-second"))))
'

nix build "$drv^*" --no-link --json | jq --exit-status '
(.[0] |
(.drvPath | match(".*multiple-outputs-a.drv")) and
(.outputs |
(keys | length == 2) and
(.first | match(".*multiple-outputs-a-first")) and
(.second | match(".*multiple-outputs-a-second"))))
'

# Make sure that `--impure` works (regression test for https://github.com/NixOS/nix/issues/6488)
nix build --impure -f multiple-outputs.nix --json e --no-link | jq --exit-status '
(.[0] |
Expand Down
1 change: 0 additions & 1 deletion tests/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ nix_tests = \
ssh-relay.sh \
plugins.sh \
build.sh \
build-explicit-output.sh \
ca/nix-run.sh \
selfref-gc.sh ca/selfref-gc.sh \
db-migration.sh \
Expand Down