Loading nixos/modules/config/nix-channel.nix +1 −21 Original line number Diff line number Diff line Loading @@ -100,26 +100,6 @@ in ]; system.activationScripts.no-nix-channel = mkIf (!cfg.channel.enable) (stringAfter [ "etc" "users" ] '' explainChannelWarning=0 if [ -e "/root/.nix-defexpr/channels" ]; then 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 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 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 ''); (stringAfter [ "etc" "users" ] (builtins.readFile ./nix-channel/activation-check.sh)); }; } nixos/modules/config/nix-channel/activation-check.sh 0 → 100644 +21 −0 Original line number Diff line number Diff line # shellcheck shell=bash explainChannelWarning=0 if [[ -e "/root/.nix-defexpr/channels" ]]; then 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 warn "/nix/var/nix/profiles/per-user/root/channels exists, but channels have been disabled." explainChannelWarning=1 fi while IFS=: read -r _ _ _ _ _ home _ ; do if [[ -n "$home" && -e "$home/.nix-defexpr/channels" ]]; then warn "$home/.nix-defexpr/channels exists, but channels have been disabled." 1>&2 explainChannelWarning=1 fi done < <(getent passwd) 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 nixos/modules/config/nix-channel/test.nix 0 → 100644 +19 −0 Original line number Diff line number Diff line # Run: # nix-build -A nixosTests.nix-channel { lib, testers }: let inherit (lib) fileset; runShellcheck = testers.shellcheck { src = fileset.toSource { root = ./.; fileset = fileset.unions [ ./activation-check.sh ]; }; }; in lib.recurseIntoAttrs { inherit runShellcheck; } nixos/tests/all-tests.nix +1 −0 Original line number Diff line number Diff line Loading @@ -610,6 +610,7 @@ in { nbd = handleTest ./nbd.nix {}; ncdns = handleTest ./ncdns.nix {}; ndppd = handleTest ./ndppd.nix {}; nix-channel = pkgs.callPackage ../modules/config/nix-channel/test.nix { }; nebula = handleTest ./nebula.nix {}; netbird = handleTest ./netbird.nix {}; nimdow = handleTest ./nimdow.nix {}; Loading Loading
nixos/modules/config/nix-channel.nix +1 −21 Original line number Diff line number Diff line Loading @@ -100,26 +100,6 @@ in ]; system.activationScripts.no-nix-channel = mkIf (!cfg.channel.enable) (stringAfter [ "etc" "users" ] '' explainChannelWarning=0 if [ -e "/root/.nix-defexpr/channels" ]; then 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 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 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 ''); (stringAfter [ "etc" "users" ] (builtins.readFile ./nix-channel/activation-check.sh)); }; }
nixos/modules/config/nix-channel/activation-check.sh 0 → 100644 +21 −0 Original line number Diff line number Diff line # shellcheck shell=bash explainChannelWarning=0 if [[ -e "/root/.nix-defexpr/channels" ]]; then 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 warn "/nix/var/nix/profiles/per-user/root/channels exists, but channels have been disabled." explainChannelWarning=1 fi while IFS=: read -r _ _ _ _ _ home _ ; do if [[ -n "$home" && -e "$home/.nix-defexpr/channels" ]]; then warn "$home/.nix-defexpr/channels exists, but channels have been disabled." 1>&2 explainChannelWarning=1 fi done < <(getent passwd) 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
nixos/modules/config/nix-channel/test.nix 0 → 100644 +19 −0 Original line number Diff line number Diff line # Run: # nix-build -A nixosTests.nix-channel { lib, testers }: let inherit (lib) fileset; runShellcheck = testers.shellcheck { src = fileset.toSource { root = ./.; fileset = fileset.unions [ ./activation-check.sh ]; }; }; in lib.recurseIntoAttrs { inherit runShellcheck; }
nixos/tests/all-tests.nix +1 −0 Original line number Diff line number Diff line Loading @@ -610,6 +610,7 @@ in { nbd = handleTest ./nbd.nix {}; ncdns = handleTest ./ncdns.nix {}; ndppd = handleTest ./ndppd.nix {}; nix-channel = pkgs.callPackage ../modules/config/nix-channel/test.nix { }; nebula = handleTest ./nebula.nix {}; netbird = handleTest ./netbird.nix {}; nimdow = handleTest ./nimdow.nix {}; Loading