Merge pull request #245038 from R-VdP/fix_nix_channel

nixos/nix-channel: only try to remove the nix-channel binary if it exists

authored by Robert Hensing and committed by GitHub c9f9df2f 27112e18

+7 -7
+7 -7
nixos/modules/config/nix-channel.nix
··· 3 3 configuration to work. 4 4 5 5 See also 6 - - ./nix.nix 7 - - ./nix-flakes.nix 6 + - ./nix.nix 7 + - ./nix-flakes.nix 8 8 */ 9 9 { config, lib, ... }: 10 10 let ··· 28 28 Whether the `nix-channel` command and state files are made available on the machine. 29 29 30 30 The following files are initialized when enabled: 31 - - `/nix/var/nix/profiles/per-user/root/channels` 32 - - `/root/.nix-channels` 33 - - `$HOME/.nix-defexpr/channels` (on login) 31 + - `/nix/var/nix/profiles/per-user/root/channels` 32 + - `/root/.nix-channels` 33 + - `$HOME/.nix-defexpr/channels` (on login) 34 34 35 35 Disabling this option will not remove the state files from the system. 36 36 ''; ··· 48 48 "nixos-config=/etc/nixos/configuration.nix" 49 49 "/nix/var/nix/profiles/per-user/root/channels" 50 50 ] 51 - else []; 51 + else [ ]; 52 52 defaultText = '' 53 53 if nix.channel.enable 54 54 then [ ··· 86 86 ''; 87 87 88 88 environment.extraSetup = mkIf (!cfg.channel.enable) '' 89 - rm $out/bin/nix-channel 89 + rm --force $out/bin/nix-channel 90 90 ''; 91 91 92 92 # NIX_PATH has a non-empty default according to Nix docs, so we don't unset