Open davidak opened 8 years ago
I found a fairly simple workaround:
$ echo "build-users-group =" > /etc/nix/nix.conf
before running the install script.
this suggests that the install
script could be modified so that it creates this configuration file to override the defaults in case the install user is root.
sh: you do not have 'shasum' installed, which I need to verify the binary tarball
this must be a new dependency. i don't have it on that system :/
On CentOS at any rate you need to install perl-Digest-SHA.
I understand this functionality isn't currently supported, but it would allow building of singularity containers more easily using nix. Singularity containers are manipulated only as root
at build-time, then the UID maps to $USER
at run-time, where the container is read-only. I'm currently using docker://nixos/nix as a base image as a workaround, but it would be nice to be able to take any other base image and install nix at build-time.
@alexhrescale Installing single-user Nix under root
is possible, you may find this build script useful, it sets up nix in a Debian image, and also properly initializes the nixbld*
build users.
the build script creates users though, which is not the same as non-root single-user install
$ echo "build-users-group =" > /etc/nix/nix.conf
Is there anything against making @mboes's suggestion part of the installer script?
It seems to work quite well for me.
Does that work? A root installation without build users has serious security implications.
this would be helpful to allow us to test the behaviour of nix-shell
on ubuntu/debian/etc. environments on CI (e.g. circle CI uses root user)
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/installing-from-another-linux-distribution-as-root/10657/9
I marked this as stale due to inactivity. → More info
this build script useful
for
FROM ubuntu:20.10
it results in
mv: cannot stat '/tmp/nix.conf': No such file or directory
How should the file / content get into /tmp/nix.conf
?
I marked this as stale due to inactivity. → More info
Nearly in 2023... What's the recommendation for installing Nix on self-hosted runners such as amazon-linux runners on Github Enterprise where the only user is root
?
@gvolpe: I thought https://github.com/nixos/nix/pull/6882 fixed that? Or do you require single-user install, not multi-user/daemon?
Related: AFAICT, Nix 2.12 has support for allocating temporary build users at runtime (release announcement).
@bjornfor not out of the box at least. After it finishes the multi-user installation as root, the next command is unable to find nix
.
/_work/_temp/1e31ddbb-3e92-4a7c-b3f8-0604adc37fdb.sh: line 1: nix: command not found
I tried running nix-daemon
right after the installation script, but it doesn't work (again, command not found). Running on Github Enterprise runners, now on Ubuntu, previously on Amazon Linux.
Either way, a multi-user installation for a CI build seems to be overkiller...
Related: AFAICT, Nix 2.12 has support for allocating temporary build users at runtime (release announcement).
I missed this part, seems exciting! The example points to a link that doesn't resolve, though, I wonder how I can use it.
The example points to a link that doesn't resolve, though, I wonder how I can use it.
Yes, I noticed too. :cry:
Any updates on this? I'm trying to run nix in a Docker container where creating the non-root user for nix
is causing issues for me (basically, I need a single user that is both root
and can run nix
). I feel like the last few comments were referring to this feature: https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-auto-allocate-uids though I'm not sure how to use it to enable my use case.
How do i install Nix (single-user mode) as root on Linux?
I don't want to do a full manual install (compile it).
I tried the default way, but it fails:
what is missing here? can i do the last steps manually? could you support installing as root?