about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authornikstur <nikstur@outlook.com>2023-10-31 16:50:30 +0100
committernikstur <nikstur@outlook.com>2023-10-31 16:51:23 +0100
commit8c1739cafe62ebf2d60d83241ccab871a14ee14c (patch)
tree864d0a93c9662d2d64f96d0a0ff173b6439abf7c /nixos
parented9263dc61f342d85b8a405d700f5370c9f81078 (diff)
nixos/nix-channel: fix subscribing to default channel
Fixes https://github.com/NixOS/nixpkgs/issues/264602
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/config/nix-channel.nix2
-rw-r--r--nixos/tests/activation/nix-channel.nix5
2 files changed, 4 insertions, 3 deletions
diff --git a/nixos/modules/config/nix-channel.nix b/nixos/modules/config/nix-channel.nix
index 4abc846b08586..0565c9cc8dad9 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 8416ff0347aca..a01a66ebc1bf6 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"
   '';
+
 }