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

Support running Nix as a non-root user #62

Open
exarkun opened this issue Jul 8, 2023 · 2 comments · Fixed by NixOS/nix#9854
Open

Support running Nix as a non-root user #62

exarkun opened this issue Jul 8, 2023 · 2 comments · Fixed by NixOS/nix#9854

Comments

@exarkun
Copy link

exarkun commented Jul 8, 2023

Currently if the Docker container is started as a non-root user (eg nobody), Nix commands fail with permission errors. For example:

❯ docker run --rm -it --user nobody nixos/nix:2.16.1
bash-5.1$ nix --extra-experimental-features 'flakes nix-command' profile install nixpkgs#hello
error: could not set permissions on '/nix/var/nix/profiles/per-user' to 755: Operation not permitted

It would be nice if it were possible to use these commands as some non-root user (not necessarily "nobody") without further modifying the image.

exarkun added a commit to exarkun/tahoe-lafs that referenced this issue Jul 20, 2023
We have root on CircleCI in the docker container.  We can't currently shed
them before we get inside the flake app because we can't run `nix build` as
non-root inside the nix container. :/

nix-community/docker-nixpkgs#62
@the-sun-will-rise-tomorrow

❯ docker run --rm -it --user nobody nixos/nix:2.16.1

@the-sun-will-rise-tomorrow

I made a PR for nixos/nix: NixOS/nix#9854

@exarkun Maybe you can test it?

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

Successfully merging a pull request may close this issue.

2 participants