-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
disallowedReferences/disallowedRequisites should not create a dependency on the disallowed derivations #4629
Comments
I don't think there's really a bug here. |
Maybe you're reading different documentation from me and evidently you're thinking different things from me, but I really don't see how checking that there is no reference to something requires downloading said thing. I admit that what you described is a use case, but I can also imagine more than enough use cases where you just don't want a derivation to depend on another derivation, no matter if you specify it as in input. Especially with |
The nix manual states that "the outputs" of a derivation will not include references to whatever you specify. I guess you might be right that if nix were completely lazy in this regard it wouldn't be necessary to realize Firefox in that case. In the special case of content-adressed-derivations that might no longer be true however. |
I think that proposition makes perfect sense, and it's a bit unfortunate that it doesn't work that way. We can't change that without breaking backwards-compat − that would mean changing the hash of every derivation that uses these attributes, but you can get this behavior by replacing pkgs.runCommand "foo" {
disallowedReferences = [ (builtins.unsafeDiscardStringContext pkgs.firefox) ];
} "echo foo > $out" doesn't depend on firefox, but pkgs.runCommand "foo" {
disallowedReferences = [ (builtins.unsafeDiscardStringContext pkgs.firefox) ];
} "echo ${pkgs.firefox} > $out" will fail because of the disallowed reference |
Hah, I could have come up with that myself. Thanks for reminding me that that exists.
That is also something that could have occurred to me. As nix does not have any versioning, this really can't be changed. I guess we could still leave this open, but we could probably also close it. |
I marked this as stale due to inactivity. → More info |
I ran into this issue when using The trick with I made a PR in nixpkgs for this as well, but fixing this in nix would obviously be preferable. |
Here's how I think this should be implemented in Nix: NixOS/nixpkgs#211783 (comment) |
The current Nixpkgs fix won't work for CA derivations: NixOS/nixpkgs#214044 It seems like this should be properly fixed in Nix instead. |
Any update on this? It has been a little more than a year since the last comment. |
This is a very unfortunate behavior, but mostly a wontfix because we can't changing it would be a language breaking change. Something more to add to the list of #9774 … |
Describe the bug
Adding something to
disallowedRequisites
leads to it being built/substituted and the resulting derivation seemingly depending on it?Take this code for example:
pkgs.hello
obviously already does not depend onpkgs.firefox
, but building this file leads to downloading firefox andnix-store --query --tree
looks like this: https://gist.github.com/ajs124/1a36f6d55c28aa40c6451b5a49d16bfe#file-hello-tree-txt-L557Expected behavior
I expected it not to do this, because it makes this feature much less useful.
nix-env --version
outputnix-env (Nix) 2.3.10
Additional context
Maybe I'm having a fundamental misunderstanding of how this is supposed to work, but the documentation didn't mention any of what I observed above.
The text was updated successfully, but these errors were encountered: