about summary refs log tree commit diff
path: root/nixos/tests/activation/nix-channel.nix
blob: d26ea98e56cc5727db7b7961590e805babe1b96f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{ lib, ... }:

{

  name = "activation-nix-channel";

  meta.maintainers = with lib.maintainers; [ nikstur ];

  nodes.machine = {
    nix.channel.enable = true;
  };

  testScript = { nodes, ... }: ''
    machine.start(allow_reboot=True)

    assert machine.succeed("cat /root/.nix-channels") == "${nodes.machine.system.defaultChannel} nixos\n"

    nixpkgs_unstable_channel = "https://nixos.org/channels/nixpkgs-unstable nixpkgs"
    machine.succeed(f"echo '{nixpkgs_unstable_channel}' > /root/.nix-channels")

    machine.reboot()

    assert machine.succeed("cat /root/.nix-channels") == f"{nixpkgs_unstable_channel}\n"
  '';

}