-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
builtins.addDrvOutputDependencies
End goal: make `(mkDerivation x).drvPath` behave like a non-DrvDeep context. Problem: users won't be able to recover the DrvDeep behavior when nixpkgs makes this change. Solution: add this primop. The new primop is fairly simple, and is supposed to complement other existing ones (`builtins.storePath`, `builtins.outputOf`) so there are simple ways to construct strings with every type of string context element. (It allows nothing we couldn't already do with `builtins.getContext` and `builtins.appendContext`, which is also true of those other two primops.) This was originally in #8595, but then it was proposed to land some doc changes separately. So now the code changes proper is just moved to this, and the doc will be done in that. Co-authored-by: Robert Hensing <[email protected]> Co-authored-by: Théophane Hufschmitt <[email protected] github.com> Co-authored-by: Valentin Gagarin <[email protected]
- Loading branch information
1 parent
8b68bbb
commit 845c771
Showing
9 changed files
with
177 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
tests/functional/lang/eval-fail-addDrvOutputDependencies-empty-context.err.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error: | ||
… while calling the 'addDrvOutputDependencies' builtin | ||
|
||
at /pwd/lang/eval-fail-addDrvOutputDependencies-empty-context.nix:1:1: | ||
|
||
1| builtins.addDrvOutputDependencies "" | ||
| ^ | ||
2| | ||
|
||
error: context of string '' must have exactly one element, but has 0 |
1 change: 1 addition & 0 deletions
1
tests/functional/lang/eval-fail-addDrvOutputDependencies-empty-context.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
builtins.addDrvOutputDependencies "" |
11 changes: 11 additions & 0 deletions
11
tests/functional/lang/eval-fail-addDrvOutputDependencies-multi-elem-context.err.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error: | ||
… while calling the 'addDrvOutputDependencies' builtin | ||
|
||
at /pwd/lang/eval-fail-addDrvOutputDependencies-multi-elem-context.nix:18:4: | ||
|
||
17| | ||
18| in builtins.addDrvOutputDependencies combo-path | ||
| ^ | ||
19| | ||
|
||
error: context of string '/nix/store/pg9yqs4yd85yhdm3f4i5dyaqp5jahrsz-fail.drv/nix/store/2dxd5frb715z451vbf7s8birlf3argbk-fail-2.drv' must have exactly one element, but has 2 |
18 changes: 18 additions & 0 deletions
18
tests/functional/lang/eval-fail-addDrvOutputDependencies-multi-elem-context.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
let | ||
drv0 = derivation { | ||
name = "fail"; | ||
builder = "/bin/false"; | ||
system = "x86_64-linux"; | ||
outputs = [ "out" "foo" ]; | ||
}; | ||
|
||
drv1 = derivation { | ||
name = "fail-2"; | ||
builder = "/bin/false"; | ||
system = "x86_64-linux"; | ||
outputs = [ "out" "foo" ]; | ||
}; | ||
|
||
combo-path = "${drv0.drvPath}${drv1.drvPath}"; | ||
|
||
in builtins.addDrvOutputDependencies combo-path |
11 changes: 11 additions & 0 deletions
11
tests/functional/lang/eval-fail-addDrvOutputDependencies-wrong-element-kind.err.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error: | ||
… while calling the 'addDrvOutputDependencies' builtin | ||
|
||
at /pwd/lang/eval-fail-addDrvOutputDependencies-wrong-element-kind.nix:9:4: | ||
|
||
8| | ||
9| in builtins.addDrvOutputDependencies drv.outPath | ||
| ^ | ||
10| | ||
|
||
error: `addDrvOutputDependencies` can only act on derivations, not on a derivation output such as 'out' |
9 changes: 9 additions & 0 deletions
9
tests/functional/lang/eval-fail-addDrvOutputDependencies-wrong-element-kind.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
let | ||
drv = derivation { | ||
name = "fail"; | ||
builder = "/bin/false"; | ||
system = "x86_64-linux"; | ||
outputs = [ "out" "foo" ]; | ||
}; | ||
|
||
in builtins.addDrvOutputDependencies drv.outPath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[ true true true true true true ] | ||
[ true true true true true true true true true true true true true ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters