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

Default argument is evaluated (and causes failure in restrict-eval) even though it shouldn't be #7096

Closed
lheckemann opened this issue Sep 26, 2022 · 4 comments
Labels

Comments

@lheckemann
Copy link
Member

lheckemann commented Sep 26, 2022

Describe the bug

The default value for openwrt-src:

https://github.com/lheckemann/uap-nix/blob/84c8bf6ebe0b2a0a48f1fd15deec0f5907bca79a/default.nix#L4-L7

seems to be evaluated even though a replacement value is provided:

https://gist.github.com/lheckemann/6cad751e20ae1364e983fd22537450c9#file-flake-nix-L21

Steps To Reproduce

nix build https://gist.github.com/lheckemann/6cad751e20ae1364e983fd22537450c9/archive/424cb57212242a459cbf2718db198d0c7304797f.zip --restrict-eval

Expected behavior

Evaluation succeeds, because the impure fetchGit is never actually used due to lazy evaluation.

Actual behaviour

error: access to URI 'https://git.openwrt.org/openwrt/openwrt.git' is forbidden in restricted mode

nix-env --version output

nix-env (Nix) 2.12.0pre20220913_2a1c63c (lazy-trees)
Also confirmed on nix (Nix) 2.8.1

@lheckemann lheckemann added the bug label Sep 26, 2022
@lheckemann
Copy link
Member Author

This doesn't seem to be strictly connected to default arguments -- it also happens if I use null as the default and check it in an if or by checking whether the set passed contains that member like in lheckemann/uap-nix@354ff70

@olivia-fl
Copy link

I'm also experiencing this with the vimUtils.buildVimPlugin function, which has a default value for name that depends on attrs.pname and attrs.version. Previously, I was able to provide a value for name without providing pname or version and everything worked fine. When updating to the latest nixpkgs-unstable, this seems to have stopped working.

@olivia-fl
Copy link

olivia-fl commented Oct 3, 2022

I'm guessing this was introduced by #7093

edit: looking closer at that PR, this is clearly impossible. I don't know what I was thinking...

@lheckemann
Copy link
Member Author

I think I was misinterpreting this, and this is actually #7098.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants