Skip to content

Commit

Permalink
Merge pull request NixOS#245038 from R-VdP/fix_nix_channel
Browse files Browse the repository at this point in the history
 nixos/nix-channel: only try to remove the nix-channel binary if it exists
  • Loading branch information
roberth authored Jul 25, 2023
2 parents 27112e1 + b825f65 commit c9f9df2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions nixos/modules/config/nix-channel.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
configuration to work.
See also
- ./nix.nix
- ./nix-flakes.nix
- ./nix.nix
- ./nix-flakes.nix
*/
{ config, lib, ... }:
let
Expand All @@ -28,9 +28,9 @@ in
Whether the `nix-channel` command and state files are made available on the machine.
The following files are initialized when enabled:
- `/nix/var/nix/profiles/per-user/root/channels`
- `/root/.nix-channels`
- `$HOME/.nix-defexpr/channels` (on login)
- `/nix/var/nix/profiles/per-user/root/channels`
- `/root/.nix-channels`
- `$HOME/.nix-defexpr/channels` (on login)
Disabling this option will not remove the state files from the system.
'';
Expand All @@ -48,7 +48,7 @@ in
"nixos-config=/etc/nixos/configuration.nix"
"/nix/var/nix/profiles/per-user/root/channels"
]
else [];
else [ ];
defaultText = ''
if nix.channel.enable
then [
Expand Down Expand Up @@ -86,7 +86,7 @@ in
'';

environment.extraSetup = mkIf (!cfg.channel.enable) ''
rm $out/bin/nix-channel
rm --force $out/bin/nix-channel
'';

# NIX_PATH has a non-empty default according to Nix docs, so we don't unset
Expand Down

0 comments on commit c9f9df2

Please sign in to comment.