Hacker News new | ask | show | jobs
by whenov 2719 days ago
However, Nix requires you to create a /nix directory, which is not possible in some cases.
1 comments

It doesn't require it:

- You can create the nix store in some directory you own. But this entails recompiling every package, because the precompiled binaries have dependencies on the store being in /nix.

- If user namespaces are enabled, you can bind mount /nix to some directory that you own:

https://nixos.wiki/wiki/Nix_Installation_Guide

Of course, it is more convenient if you can convince a sysadmin to install multi-user Nix. From there on, every user can install their own packages (in a non-conflicting manner).

I don't think recompilation is required. You can use proot (like chroot) to make a local dir look like "/nix" to subprocesses. I've seen it here (but not tested it): https://gist.github.com/mbbx6spp/4f467adb4e0133063fd87e264c6...
Yes, that's a similar approach to the use of user namespaces that I mentioned, which also doesn't require recompilation. I guess proot also works on systems with user namespaces disabled (which is sometimes done for security reasons).
That’s good to know, thanks for sharing!