diff --git a/nixos/modules/config/nix-channel.nix b/nixos/modules/config/nix-channel.nix index 4abc846b0858..0565c9cc8dad 100644 --- a/nixos/modules/config/nix-channel.nix +++ b/nixos/modules/config/nix-channel.nix @@ -99,7 +99,7 @@ in systemd.tmpfiles.rules = lib.mkIf cfg.channel.enable [ "f /root/.nix-channels -" - ''w "/root/.nix-channels" - - - - "${config.system.defaultChannel} nixos\n"'' + ''w+ "/root/.nix-channels" - - - - ${config.system.defaultChannel} nixos\n'' ]; }; } diff --git a/nixos/tests/activation/nix-channel.nix b/nixos/tests/activation/nix-channel.nix index 8416ff0347ac..a01a66ebc1bf 100644 --- a/nixos/tests/activation/nix-channel.nix +++ b/nixos/tests/activation/nix-channel.nix @@ -10,7 +10,8 @@ nix.channel.enable = true; }; - testScript = '' - print(machine.succeed("cat /root/.nix-channels")) + testScript = { nodes, ... }: '' + assert machine.succeed("cat /root/.nix-channels") == "${nodes.machine.system.defaultChannel} nixos\n" ''; + }