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

CA-derivations aren’t compatible with IFD #5805

Closed
thufschmitt opened this issue Dec 20, 2021 · 1 comment · Fixed by #5807
Closed

CA-derivations aren’t compatible with IFD #5805

thufschmitt opened this issue Dec 20, 2021 · 1 comment · Fixed by #5807
Assignees
Labels
bug ca-derivations Derivations with content addressed outputs

Comments

@thufschmitt
Copy link
Member

Describe the bug

Using IFD on a CA derivation (or depends on a ca derivation) fails with a cryptic error message like error: access to absolute path '/0vfggackkifmvxhxpaapx26lswwg5xcr54dk1cmdgg90j4jw9njc' is forbidden in pure eval mode (use '--impure' to override) or error: getting status of '/1ix2zgscfhpnx492z7i2fr62fmipxcnw2ssjrhj0i802vliq88jv': No such file or directory

Steps To Reproduce

$ cat <<EOF > default.nix
let pkgs = import <nixpkgs> { config.contentAddressedByDefault = true; }; in

let
  drvToImport = pkgs.writeText "foo.nix" ''
    let pkgs = import <nixpkgs> {}; in pkgs.hello
  '';
in
import drvToImport
EOF
$ nix-build
error: getting status of '/1ix2zgscfhpnx492z7i2fr62fmipxcnw2ssjrhj0i802vliq88jv': No such file or directory

Expected behavior

Should work

Additional context

IFD works because import (and I guess readFile) have some magic to realise the context of their string argument before being called. But this isn’t enough with CA derivations because these strings don’t contain the output paths of the realisations they refer to, but only their placeholder (the /<bigHash> thing above). Hence the cryptic error.

It should be possible (and hopefully not too hard) to rewrite these strings before passing them to the primops

@thufschmitt thufschmitt added bug ca-derivations Derivations with content addressed outputs labels Dec 20, 2021
@thufschmitt thufschmitt self-assigned this Dec 20, 2021
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/content-addressed-nix-call-for-testers/12881/148

thufschmitt added a commit that referenced this issue Dec 20, 2021
Rewrite the string taken by the IFD-like primops to contain the actual
output paths of the derivations rather than the placeholders

Fix #5805
thufschmitt added a commit that referenced this issue Dec 21, 2021
Rewrite the string taken by the IFD-like primops to contain the actual
output paths of the derivations rather than the placeholders

Fix #5805
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ca-derivations Derivations with content addressed outputs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants