1
Fork 0
nixos-system-config/non-nixos-install.sh
caem 62a2c850ae
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.
2024-06-06 12:41:31 +02:00

22 lines
723 B
Bash
Executable file

#!/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