From 184e9f34be51e05cc1b8390aa190d9ef6dfae855 Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Wed, 6 Sep 2017 23:37:34 +0200 Subject: [PATCH] nix: include user channels in NIX_PATH --- CHANGELOG | 7 +++++++ README.md | 2 +- bootstrap.sh | 4 ++-- modules/examples/lnl.nix | 1 + modules/nix/default.nix | 1 + modules/system/activation-checks.nix | 8 ++++---- 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e90189bc..c2bf302b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +2017-07-06 +- added user channels to the default nix.nixPath + + Using a user channel now works without any custom configuration. + See https://github.com/NixOS/nix/issues/1548 if you are running into + issues when updating your channel. + 2017-07-28 - added support for command-not-found, using nix-index diff --git a/README.md b/README.md index 2b852111..87debcee 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Either modify the existing file to source/import the one from `/etc/static` or r The bootstrap installer will configure a channel for this repository. ```bash -sudo nix-channel --update darwin +nix-channel --update darwin darwin-rebuild changelog ``` diff --git a/bootstrap.sh b/bootstrap.sh index 31b3b46b..aa383902 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -138,8 +138,8 @@ install(){ # Fetch the nix-darwin repo echo -e ""$YELLOW"Configuring darwin channel..."$ESC"" - sudo nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin || exit - sudo nix-channel --update || exit + nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin || exit + nix-channel --update || exit # Create symlink for old NIX_PATH entry ln -sfn "/nix/var/nix/profiles/per-user/root/channels/darwin" "$HOME/.nix-defexpr/darwin" || exit diff --git a/modules/examples/lnl.nix b/modules/examples/lnl.nix index 48286aa0..3753e8fb 100644 --- a/modules/examples/lnl.nix +++ b/modules/examples/lnl.nix @@ -285,6 +285,7 @@ "nixpkgs=$HOME/.nix-defexpr/nixpkgs" "darwin-config=$HOME/.nixpkgs/darwin-configuration.nix" "/nix/var/nix/profiles/per-user/root/channels" + "$HOME/.nix-defexpr/channels" ]; nixpkgs.config.allowUnfree = true; diff --git a/modules/nix/default.nix b/modules/nix/default.nix index fb525387..eea899c2 100644 --- a/modules/nix/default.nix +++ b/modules/nix/default.nix @@ -286,6 +286,7 @@ in [ # Include default path . "darwin-config=$HOME/.nixpkgs/darwin-configuration.nix" "/nix/var/nix/profiles/per-user/root/channels" + "$HOME/.nix-defexpr/channels" ]; description = '' The default Nix expression search path, used by the Nix diff --git a/modules/system/activation-checks.nix b/modules/system/activation-checks.nix index 91c74b57..7c885d8a 100644 --- a/modules/system/activation-checks.nix +++ b/modules/system/activation-checks.nix @@ -49,8 +49,8 @@ let if ! test -e "$darwinPath"; then echo "error: Changed but target does not exist, aborting activation" >&2 echo "Add the darwin repo as a channel or set nix.nixPath:" >&2 - echo "$ sudo nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin" >&2 - echo "$ sudo nix-channel --update" >&2 + echo "$ nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin" >&2 + echo "$ nix-channel --update" >&2 echo >&2 echo "or set" >&2 echo >&2 @@ -63,8 +63,8 @@ let if ! test -e "$nixpkgsPath"; then echo "error: Changed but target does not exist, aborting activation" >&2 echo "Add a nixpkgs channel or set nix.nixPath:" >&2 - echo "$ sudo nix-channel --add http://nixos.org/channels/nixpkgs-unstable nixpkgs" >&2 - echo "$ sudo nix-channel --update" >&2 + echo "$ nix-channel --add http://nixos.org/channels/nixpkgs-unstable nixpkgs" >&2 + echo "$ nix-channel --update" >&2 echo >&2 echo "or set" >&2 echo >&2