nixos/nix-channel: substitute getent path in preSwitchCheck (#527769)
This commit is contained in:
@@ -6,7 +6,12 @@
|
||||
- ./nix.nix
|
||||
- ./nix-flakes.nix
|
||||
*/
|
||||
{ config, lib, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib)
|
||||
mkIf
|
||||
@@ -98,7 +103,9 @@ in
|
||||
];
|
||||
|
||||
system.preSwitchChecks.no-nix-channel = mkIf (!cfg.channel.enable) (
|
||||
builtins.readFile ./nix-channel/pre-switch-check.sh
|
||||
lib.replaceStrings [ "@getent@" ] [ (lib.getExe pkgs.getent) ] (
|
||||
builtins.readFile ./nix-channel/pre-switch-check.sh
|
||||
)
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ while IFS=: read -r _ _ _ _ _ home _ ; do
|
||||
warn "$home/.nix-defexpr/channels exists, but channels have been disabled."
|
||||
explainChannelWarning=1
|
||||
fi
|
||||
done < <(getent passwd)
|
||||
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." >&2
|
||||
echo "Delete the above directory or directories to prevent this." >&2
|
||||
|
||||
Reference in New Issue
Block a user