From 8c1739cafe62ebf2d60d83241ccab871a14ee14c Mon Sep 17 00:00:00 2001 From: nikstur Date: Tue, 31 Oct 2023 16:50:30 +0100 Subject: [PATCH] nixos/nix-channel: fix subscribing to default channel Fixes https://github.com/NixOS/nixpkgs/issues/264602 --- nixos/modules/config/nix-channel.nix | 2 +- nixos/tests/activation/nix-channel.nix | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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" ''; + }