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

nix 2.6 breaks restrict-eval when relying on NIX_PATH #5980

Closed
Mic92 opened this issue Jan 25, 2022 · 2 comments
Closed

nix 2.6 breaks restrict-eval when relying on NIX_PATH #5980

Mic92 opened this issue Jan 25, 2022 · 2 comments
Labels

Comments

@Mic92
Copy link
Member

Mic92 commented Jan 25, 2022

Describe the bug

Before it was possible to restrict the nix path like this:

~/git/nix/result/bin/nix-env -f . -qa \* --meta --xml --option restrict-eval true --option allow-import-from-derivation true --drv-path --show-trace -I nixpkgs=$(nix-instantiate --find-file nixpkgs) -I $(pwd)

Now it throws this error:

warning: Nix search path entry '/home/joerg/.nix-defexpr/channels' does not exist, ignoring
error: access to absolute path '/home/joerg/.nix-defexpr/channels' is forbidden in restricted mode

       … while realising the context of path '/home/joerg/.nix-defexpr/channels'

       at /home/joerg/git/nur-packages-template/default.nix:9:17:

            8|
            9| { pkgs ? import <nixpkgs> { } }:
             |                 ^
           10|

       … while realising the context of a path

       at /home/joerg/git/nur-packages-template/default.nix:9:10:

            8|
            9| { pkgs ? import <nixpkgs> { } }:
             |          ^
           10|

also see this CI error: https://github.com/nix-community/nur-packages-template/runs/4933350451?check_suite_focus=true#step:6:12

Steps To Reproduce

$ git clone https://github.com/nix-community/nur-packages-template
$ nix-env -f . -qa \* --meta --xml --option restrict-eval true --option allow-import-from-derivation true --drv-path --show-trace -I nixpkgs=$(nix-instantiate --find-file nixpkgs) -I $(pwd)

Expected behavior

A way to test if a nix file is only importing from allowed paths. We rely on this in both ofborg and NUR

** tested on master 0a70b37

@Mic92 Mic92 added the bug label Jan 25, 2022
@thufschmitt
Copy link
Member

Didn’t try it, but I suspect it’s due to cbbd21e where I had to do some wonky stuff for <foo> to work properly

thufschmitt added a commit that referenced this issue Jan 27, 2022
It’s totally valid to have entries in `NIX_PATH` that aren’t valid paths
(they can even be arbitrary urls or `channel:<channel-name>`).

Fix #5598 and #5980
thufschmitt added a commit that referenced this issue Jan 27, 2022
It’s totally valid to have entries in `NIX_PATH` that aren’t valid paths
(they can even be arbitrary urls or `channel:<channel-name>`).

Fix #5998 and #5980
@Mic92
Copy link
Member Author

Mic92 commented Jan 29, 2022

Fixed in #6001

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