depot/third_party/nixpkgs/nixos/tests/activation/nix-channel.nix
Default email 2c76a4cb41 Project import generated by Copybara.
GitOrigin-RevId: c757e9bd77b16ca2e03c89bf8bc9ecb28e0c06ad
2023-11-16 04:20:00 +00:00

26 lines
633 B
Nix

{ 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"
'';
}