Description
To account for float content-addressed derivation outputs, we use "downstream placeholder" to refer to output deriving paths in a abstract way (by hash) and then substitute those hashes for the store paths once those are known.
We do this when building derivations, but do not yet do when realising strings with context as part of IFD.
We should rework the below test as part of the tests/functional/ca/import-from-derivation.sh
/ tests/functional/import-from-derivation.sh
test, probably.
original issue
Describe the bug
Cannot use content-addressed derivation as path for builtins.path
Steps To Reproduce
- Enable ca-derivations feature
- Create file (e.g.
test.nix
) withlet pkgs = (import <nixpkgs> {}); drv = pkgs.runCommand "source" { __contentAddressed = true; } "mkdir $out; touch $out/{foo,bar}"; filtered = builtins.path { path = drv; name = "source"; filter = path: type: path == "${drv}/foo"; }; in pkgs.runCommand "source" { } "ln -s ${filtered} $out"
- Run
nix-build test.nix
Results in error:
error (ignored): error: end of string reached
error:
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:34:12:
33|
34| strict = derivationStrict drvAttrs;
| ^
35|
… while evaluating derivation 'source'
whose name attribute is located at /nix/store/920a6ivyd50598z8djw9x3mr33gys0j5-source/pkgs/stdenv/generic/make-derivation.nix:334:7
… while evaluating attribute 'buildCommand' of derivation 'source'
at /nix/store/920a6ivyd50598z8djw9x3mr33gys0j5-source/pkgs/build-support/trivial-builders/default.nix:68:17:
67| enableParallelBuilding = true;
68| inherit buildCommand name;
| ^
69| passAsFile = [ "buildCommand" ]
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: path '/0y6ypwm99vdjmfincll2xx8y1d145ml711vryyvmandlxrg98kca' does not exist
Expected behavior
Succeeds.
nix-env --version
output
nix-env (Nix) 2.24.1
Additional context
Works in Nix 2.18.5 & 2.19.6, fails in current patch releases of versions 2.20 through 2.24.
Priorities
Add 👍 to issues you find important.
Activity