about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2022-11-30 16:17:07 +0000
committerDavid Morgan <djm_uk@protonmail.com>2022-11-30 16:17:07 +0000
commit259a6ed52e62ae0da44295ecf6b0840c1172c4d3 (patch)
tree29a02d35433382fa749a653155330f5501fda1d7
parent2281d0164b6309f45e3e6325183dafa453b6b1ce (diff)
downloaddotfiles-259a6ed52e62ae0da44295ecf6b0840c1172c4d3.tar.gz
Add correct channels
-rw-r--r--setup-home.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/setup-home.sh b/setup-home.sh
index f36c94a..75cd79c 100644
--- a/setup-home.sh
+++ b/setup-home.sh
@@ -2,7 +2,16 @@
 
 [ -e ~/dotfiles ] || git clone git@codeberg.org:djm/dotfiles.git
 
-nix-channel --add https://github.com/nix-community/home-manager/archive/release-$(nixos-version | cut -d. -f1-2).tar.gz home-manager
+if [ -x "$(command -v nixos-version)" ]; then
+  # On NixOS use the hm version corresponding to the NixOS version, and add nixos-unstable as unstable
+  nix-channel --add https://github.com/nix-community/home-manager/archive/release-$(nixos-version | cut -d. -f1-2).tar.gz home-manager
+  nix-channel --add https://nixos.org/channels/nixos-unstable unstable
+else
+  # On other systems use master, and add nixpkgs-unstable as unstable for compatibility between NixOS and non-NixOS installations
+  nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
+  nix-channel --add https://nixos.org/channels/nixpkgs-unstable unstable
+fi
+
 nix-channel --update
 
 export NIX_PATH=$HOME/.nix-defexpr/channels:/nix/var/nix/profiles/per-user/root/channels${NIX_PATH:+:$NIX_PATH}