summaryrefslogtreecommitdiffstats
path: root/nixos/tests/nix-local-store.nix
blob: d756805958d5dcbc5b1c63e864205634665863e4 (plain)
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
27
28
{ ... }: {
  name = "nix-local-store";

  nodes.machine = { pkgs, ... }: {
    nix.daemon.enable = false;
    nix.settings = {
      experimental-features = [ "nix-command" ];
      log-lines = 26;
    };
    nix.enable = true; # disabled by default. See all-tests.nix / tag(no-nix-by-default)

    # Easiest way to get a file onto the machine
    environment.etc."test.nix".text = ''
      derivation {
        name = "test";
        builder = "/bin/sh";
        args = [ "-c" "echo succeeded > $out" ];
        system = "${pkgs.stdenv.hostPlatform.system}";
      }
    '';
  };
  testScript = ''
    start_all()
    machine.succeed("nix-build /etc/test.nix")
    log_lines = machine.succeed("nix config show log-lines").strip()
    assert int(log_lines) == 26, "Nix settings not respected by local store"
  '';
}