mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
nixos/nix-channel: Highlight and tidy the warnings
(cherry picked from commit 34fee8c804
)
This commit is contained in:
parent
b096badfeb
commit
5a715379eb
@ -101,23 +101,25 @@ in
|
||||
|
||||
system.activationScripts.no-nix-channel = mkIf (!cfg.channel.enable)
|
||||
(stringAfter [ "etc" "users" ] ''
|
||||
explainChannelWarning=0
|
||||
if [ -e "/root/.nix-defexpr/channels" ]; then
|
||||
echo "WARNING: /root/.nix-defexpr/channels exists, but channels have been disabled." 1>&2
|
||||
echo "Due to https://github.com/NixOS/nix/issues/9574, Nix may still use these channels when NIX_PATH is unset." 1>&2
|
||||
echo "Delete the above directory to prevent this." 1>&2
|
||||
warn '/root/.nix-defexpr/channels exists, but channels have been disabled.'
|
||||
explainChannelWarning=1
|
||||
fi
|
||||
if [ -e "/nix/var/nix/profiles/per-user/root/channels" ]; then
|
||||
echo "WARNING: /nix/var/nix/profiles/per-user/root/channels exists, but channels have been disabled." 1>&2
|
||||
echo "Due to https://github.com/NixOS/nix/issues/9574, Nix may still use these channels when NIX_PATH is unset." 1>&2
|
||||
echo "Delete the above directory to prevent this." 1>&2
|
||||
warn "/nix/var/nix/profiles/per-user/root/channels exists, but channels have been disabled."
|
||||
explainChannelWarning=1
|
||||
fi
|
||||
getent passwd | while IFS=: read -r _ _ _ _ _ home _ ; do
|
||||
if [ -n "$home" -a -e "$home/.nix-defexpr/channels" ]; then
|
||||
echo "WARNING: $home/.nix-defexpr/channels exists, but channels have been disabled." 1>&2
|
||||
echo "Due to https://github.com/NixOS/nix/issues/9574, Nix may still use these channels when NIX_PATH is unset." 1>&2
|
||||
echo "Delete the above directory to prevent this." 1>&2
|
||||
warn "$home/.nix-defexpr/channels exists, but channels have been disabled." 1>&2
|
||||
explainChannelWarning=1
|
||||
fi
|
||||
done
|
||||
if [ $explainChannelWarning -eq 1 ]; then
|
||||
echo "Due to https://github.com/NixOS/nix/issues/9574, Nix may still use these channels when NIX_PATH is unset." 1>&2
|
||||
echo "Delete the above directory or directories to prevent this." 1>&2
|
||||
fi
|
||||
'');
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user