From 9f0507cf7d62472650bb3f2d936d0d43ef6009b4 Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Wed, 6 Sep 2017 23:55:14 +0200 Subject: [PATCH] activation-checks: add check for user channels --- modules/system/activation-checks.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/modules/system/activation-checks.nix b/modules/system/activation-checks.nix index 7c885d8a..9dac0040 100644 --- a/modules/system/activation-checks.nix +++ b/modules/system/activation-checks.nix @@ -34,6 +34,25 @@ let fi ''; + nixChannels = '' + channelsLink=$(readlink "$HOME/.nix-defexpr/channels") || true + case "$channelsLink" in + *"$USER"*) + ;; + "") + ;; + *) + echo "error: The ~/.nix-defexpr/channels symlink does not point your users channels" >&2 + echo "Running nix-channel will regenerate it" >&2 + echo >&2 + echo " rm ~/.nix-defexpr/channels" >&2 + echo " nix-channel --update" >&2 + echo >&2 + exit 2 + ;; + esac + ''; + nixPath = '' darwinConfig=$(NIX_PATH=${concatStringsSep ":" config.nix.nixPath} nix-instantiate --eval -E '') || true if ! test -e "$darwinConfig"; then @@ -84,6 +103,7 @@ in system.activationScripts.checks.text = '' ${darwinChanges} ${buildUsers} + ${nixChannels} ${nixPath} if test ''${checkActivation:-0} -eq 1; then