Using Nix Home Manager without NixOS

Requirements

unshare --user --pid echo YES || echo NO

The expected result is YES .

Installing nix-user-chroot

RELEASE=1.2.2
URL=https://github.com/nix-community/nix-user-chroot/releases/download
FILENAME=nix-user-chroot-bin-${RELEASE}-x86_64-unknown-linux-musl
curl -L $URL/$RELEASE/$FILENAME -o ~/.local/bin/nix-user-chroot

Installing nix

mkdir -m 0755 ~/.nix
nix-user-chroot ~/.nix bash -c "curl -L https://nixos.org/nix/install | bash"
nix-user-chroot bash -l

Installing home-manager

nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
nix-shell '<home-manager>' -A install

References