1
Fork 0

Fix install script for non-nixos

This commit is contained in:
caem 2024-06-06 16:28:28 +02:00
parent 8136b7633f
commit e7e618f42b
Signed by: caem
GPG key ID: 69A830D03203405F

View file

@ -1,4 +1,4 @@
#!/usr/bin/env sh
#!/usr/bin/env bash
# This script sets up nix and home-manager for distributions that are not NixOS.
@ -8,13 +8,18 @@ BASE_PATH="$(dirname "$(realpath "$0")")"
if [ ! -d "/nix" ]; then
# Do multi-user installation
sh <(curl -L https://nixos.org/nix/install) --daemon
exec bash -e "$(realpath "$0")"
fi
if [ -z "$(nix-channel --list | grep nixpkgs)" ]; then
nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
nix-channel --update
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"
ln -svf "$BASE_PATH/users/blank/nix" "$HOME/.config/nix"
ln -svf "$BASE_PATH/users/i/home-manager" "$HOME/.config/home-manager"
ln -svf "$BASE_PATH/users/i/nixpkgs" "$HOME/.config/nixpkgs"
ln -svf "$BASE_PATH/users/i/nix" "$HOME/.config/nix"
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update