crosup icon indicating copy to clipboard operation
crosup copied to clipboard

support for container and non-systemd

Open kwekewk opened this issue 1 year ago • 3 comments

Hi, I'm new to Nix, and I find the determinate Nix installer somewhat awkward to deal with within a container. I always use the following to install for a single user, but I'm unsure if it's the best solution:

# Setup Nix
sudo install -d -m755 -o $(id -u) -g $(id -g) /nix
curl -L https://nixos.org/nix/install | sh

When crosup installing Flox, it causes an issue because it depends on the daemon. Is it due to [nix.install.pkg] being incompatible with the method above?

crosup install devenv
-> Checking if Nix is already installed
   Nix is /home/snoremote/.nix-profile/bin/nix
-> Nix is already installed, skipping
-> Checking if Cachix is already installed
bash: line 1: type: cachix: not found
-> Failed to check Cachix version
-> 🚚 Installing Cachix
bash: line 1: /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh: No such file or directory
-> Checking if Devenv is already installed
bash: line 1: type: devenv: not found
-> Failed to check Devenv version
-> 🚚 Installing Devenv
-> Running preinstall command:
echo "trusted-users = root $USER" | sudo tee -a /etc/nix/nix.conf
sudo pkill nix-daemon
cachix use devenv
bash: line 1: /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh: No such file or directory
bash: line 1: /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh: No such file or directory
bash: line 1: /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh: No such file or directory
bash: line 1: /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh: No such file or directory

It's the same with Flox, but it works with the official command line for a personal profile:

crosup install flox
-> Checking if Nix is already installed
   Nix is /home/snoremote/.nix-profile/bin/nix
-> Nix is already installed, skipping
-> Checking if Flox is already installed
bash: line 1: type: flox: not found
-> Failed to check Flox version
-> 🚚 Installing Flox
-> Running preinstall command:
echo 'extra-trusted-substituters = https://cache.floxdev.com' | sudo tee -a /etc/nix/nix.conf && echo 'extra-trusted-public-keys = flox-store-public-0:8c/B+kjIaQ+BloCmNkRUKwaVPFWkriSAd0JJvuDu4F0=' | sudo tee -a /etc/nix/nix.conf
bash: line 1: /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh: No such file or directory
bash: line 1: /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh: No such file or directory

I apologize if it's a bit incomprehensible. My question is: Is the above method a viable option for a container?

kwekewk avatar Dec 27 '23 06:12 kwekewk

Hi @kwekewk , thanks for reporting the issue. I always use the determinate systems installer, but I think that in containers you need to pass the --init none option to nix determinate systems installer if you don't have systemd.

The error /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh: No such file or directory is due to the hardcoded source command in crosup here

tsirysndr avatar Dec 27 '23 11:12 tsirysndr

Hi @kwekewk , thanks for reporting the issue. I always use the determinate systems installer, but I think that in containers you need to pass the --init none option to nix determinate systems installer if you don't have systemd.

Dumb question should it be okay to let a single user profile own /nix without depend on sudo?

kwekewk avatar Dec 27 '23 17:12 kwekewk

no entiendo esto

asggWa avatar Jan 13 '24 18:01 asggWa