1# shellcheck shell=bash
2
3explainChannelWarning=0
4if [[ -e "/root/.nix-defexpr/channels" ]]; then
5 warn '/root/.nix-defexpr/channels exists, but channels have been disabled.'
6 explainChannelWarning=1
7fi
8if [[ -e "/nix/var/nix/profiles/per-user/root/channels" ]]; then
9 warn "/nix/var/nix/profiles/per-user/root/channels exists, but channels have been disabled."
10 explainChannelWarning=1
11fi
12while IFS=: read -r _ _ _ _ _ home _ ; do
13 if [[ -n "$home" && -e "$home/.nix-defexpr/channels" ]]; then
14 warn "$home/.nix-defexpr/channels exists, but channels have been disabled." 1>&2
15 explainChannelWarning=1
16 fi
17done < <(getent passwd)
18if [[ $explainChannelWarning -eq 1 ]]; then
19 echo "Due to https://github.com/NixOS/nix/issues/9574, Nix may still use these channels when NIX_PATH is unset." 1>&2
20 echo "Delete the above directory or directories to prevent this." 1>&2
21fi