DavHau/nix-portable

Ability to simply enter the sandbox

Opened this issue · 3 comments

I would love if nix-portable could simply drop me into the sandbox (in my case bwrap) where the store and in turn nix profile are available, without going via a nix derivation.
nix-portable nix run nixpkgs#bash will fetch the newest nixpkgs version, and then build bash, causing me to have to wait, while nix-portable nix-shell -p bash both changes the ps1 and will require me to update the channel every now and then.

my current workaround/illegal incantation:

nix-portable ../../../../../../../../../../../../../"$(command -v "$SHELL")"

and in .bashrc/.profile:

if test -d $HOME/.nix-profile/bin; then
    export PATH="$HOME/.nix-profile/bin:$PATH"
fi

You can pin a version of nixpkgs so that it is used every time:

nix-portable nix registry pin nixpkgs

After this nix-portable nix run should always use the version you pinned. You can use nix registry to change the pin as well.

I found that entering a nix bash shell caused everything sourced from /etc/skel to fail, where a lot of the SLURM logic is set up on this host. Here I explicitly want to enter the bwrap without neccesarily entering a nix shell

I would also like to be able to just drop into the sandbox.

In my case I don't even have the flake on the machine I'm running nix-portable on. Instead I do a 'nix copy' to that host and 'nix profile install' to access the binaries. But since the profiles are in /nix I need to be in the sandbox to access it. It seems possible to get a shell by running 'nix-portable nix-shell -p', but it feels like a hack.