Materials to build a self contained nix store in an environment with network filesystem where you don't have root access and user namespaces are not switched on.
The main downside of this approach (compared to the proot approach) is that you won't be able to utilize exising nix caches, since they assume that the store is located at /nix/store. Everything will be recompiled from scratch.
- Set prefix in
hpc-nix.nixto the full path of target home directory. - run
./build.sh - copy
/tmp/copy-me-to-serverover the target and movecopy-me-to-server/nixto the correct location - Add
sandbox = falseanduse-sqlite-wal = falseto~/.config/nix/nix.conf. The first disables sandbox building which depends on user namespaces. The second is required for sqlite to function correctly on a network filesystem
- set
NIX_SSL_CERT_FILEon the target so nix can fetch things over https - set
NIX_PATH=nixpkgs=<location of nixpkgs> - If
/tmpis mounted to a small device, you may want to setTMPDIR