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

Recursive Nix is broken with --store #5360

Closed
L-as opened this issue Oct 8, 2021 · 1 comment · Fixed by #5364
Closed

Recursive Nix is broken with --store #5360

L-as opened this issue Oct 8, 2021 · 1 comment · Fixed by #5364
Labels

Comments

@L-as
Copy link
Member

L-as commented Oct 8, 2021

Describe the bug

addDependency uses setns which needs privileges to enter the mount namespace to add bind mounts. With --store when not run as root, this fails.

When using Recursive Nix with --store and root, it fails here instead for some yet unknown reason.

In practice, this means that any non-trivial derivation built inside the sandbox will fail as it causes addDependency to be called.

Steps To Reproduce

{ pkgs ? import <nixpkgs> {} }:

let
  hello-nix = pkgs.writeText "hello.nix" ''
    with import ${pkgs.path} {}; hello
  '';
in pkgs.runCommand "djE" {
  nativeBuildInputs = [ pkgs.nixUnstable ];
  requiredSystemFeatures = [ "recursive-nix" ];
} ''
  nix-build ${hello-nix}
  cp -L ./result $out
''

Expected behavior

It should work.

nix-env --version output

nix (Nix) 2.4pre20210922_bcd73eb

@L-as L-as added the bug label Oct 8, 2021
@L-as
Copy link
Member Author

L-as commented Oct 8, 2021

This bug seems to have existed from the start.

L-as added a commit to L-as/nix that referenced this issue Oct 8, 2021
Before this, `setns` would fail when switching to the mount namespace,
since we did not have the privileges to do so when not root.

Closes NixOS#5360
L-as added a commit to L-as/nix that referenced this issue Oct 8, 2021
Before this, `setns` would fail when switching to the mount namespace,
since we did not have the privileges to do so when not root.

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

Successfully merging a pull request may close this issue.

1 participant