1 # Miscellaneous small tests that don't warrant their own VM run.
7 default = testsForPackage { nixPackage = pkgs.nix; };
8 lix = testsForPackage { nixPackage = pkgs.lix; };
11 testsForPackage = args: lib.recurseIntoAttrs {
12 # If the attribute is not named 'test'
13 # You will break all the universe on the release-*.nix side of things.
14 # `discoverTests` relies on `test` existence to perform a `callTest`.
15 test = testMiscFeatures args;
16 passthru.override = args': testsForPackage (args // args');
19 testMiscFeatures = { nixPackage, ... }: pkgs.testers.nixosTest (
21 foo = pkgs.writeText "foo" "Hello World";
23 name = "${nixPackage.pname}-misc";
24 meta.maintainers = with lib.maintainers; [ raitobezarius artturin ];
29 system.extraDependencies = [ foo ];
31 nix.package = nixPackage;
38 def get_path_info(path):
39 result = machine.succeed(f"nix --option experimental-features nix-command path-info --json {path}")
40 parsed = json.loads(result)
43 with subtest("nix-db"):
45 info = get_path_info(out)
48 pathinfo = info[0] if isinstance(info, list) else info[out]
52 != "sha256-BdMdnb/0eWy3EddjE83rdgzWWpQjfWPAj3zDIFMD3Ck="
54 raise Exception("narHash not set")
56 if pathinfo["narSize"] != 128:
57 raise Exception("narSize not set")
59 with subtest("nix-db"):
60 machine.succeed("nix-store -qR /run/current-system | grep nixos-")