Add support for non-nixos systems

I run Debian on my Thinkpad and wanted to take advantage of nix on there
without also installing NixOS there, so here is added support for it.
This commit is contained in:
caem 2024-06-06 12:41:31 +02:00
parent c2ba41fd36
commit 62a2c850ae
Signed by: caem
GPG key ID: 69A830D03203405F
11 changed files with 103 additions and 21 deletions

22
non-nixos-install.sh Executable file
View file

@ -0,0 +1,22 @@
#!/usr/bin/env sh
# This script sets up nix and home-manager for distributions that are not NixOS.
set -e
BASE_PATH="$(dirname "$(realpath "$0")")"
if [ ! -d "/nix" ]; then
# Do multi-user installation
sh <(curl -L https://nixos.org/nix/install) --daemon
nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
fi
if [ ! -x "$HOME/.nix-profile/bin/home-manager" ]; then
ln -svf "$BASE_PATH/users/blank/home-manager" "$HOME/.config/home-manager"
ln -svf "$BASE_PATH/users/blank/nixpkgs" "$HOME/.config/nixpkgs"
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
fi