diff --git a/clanServices/hello-world/tests/vm/default.nix b/clanServices/hello-world/tests/vm/default.nix index 55d20136c..6cc8d3b4e 100644 --- a/clanServices/hello-world/tests/vm/default.nix +++ b/clanServices/hello-world/tests/vm/default.nix @@ -10,7 +10,7 @@ clanLib.test.makeTestClan { nixosTest = ( { ... }: { - name = "service-hello-test"; + name = "hello-service"; clan = { directory = ./.; diff --git a/clanServices/wifi/tests/vm/default.nix b/clanServices/wifi/tests/vm/default.nix index b5ffe3b69..03998a85d 100644 --- a/clanServices/wifi/tests/vm/default.nix +++ b/clanServices/wifi/tests/vm/default.nix @@ -11,7 +11,7 @@ clanLib.test.makeTestClan { nixosTest = ( { ... }: { - name = "wifi"; + name = "wifi-service"; clan = { directory = ./.; diff --git a/lib/build-clan/interface.nix b/lib/build-clan/interface.nix index ca7a02c65..f8fa919ba 100644 --- a/lib/build-clan/interface.nix +++ b/lib/build-clan/interface.nix @@ -34,7 +34,7 @@ in else if v == null then throw "Please set either clan.self or clan.directory" else - "${v}" + v ) lib.types.path; default = builtins.toString self; defaultText = "Root directory of the flake"; diff --git a/lib/test/default.nix b/lib/test/default.nix index 5f4361f58..43f8e8936 100644 --- a/lib/test/default.nix +++ b/lib/test/default.nix @@ -5,6 +5,7 @@ let inherit (lib) mkOption + removePrefix types ; @@ -37,11 +38,13 @@ in update-vars-script = "${self.packages.${pkgs.system}.generate-test-vars}/bin/generate-test-vars"; + relativeDir = removePrefix ("${self}/") (toString test.config.clan.directory); + update-vars = pkgs.writeShellScriptBin "update-vars" '' - ${update-vars-script} $PRJ_ROOT/checks/${testName} ${testName} + ${update-vars-script} $PRJ_ROOT/${relativeDir} ${testName} ''; - testSrc = lib.cleanSource (self + "/checks/${testName}"); + testSrc = lib.cleanSource test.config.clan.directory; vars-check = pkgs.runCommand "update-vars-check" @@ -67,9 +70,6 @@ in }; } '' - # make the test depend on its vars-check derivation - echo ${vars-check} >/dev/null - ${self.legacyPackages.${pkgs.system}.setupNixInNix} cp -r ${testSrc} ./src chmod +w -R ./src @@ -182,6 +182,8 @@ in # Harder to handle advanced setups (like TPM, LUKS, or LVM-on-LUKS) but not needed since we are in a test # No systemd journal logs from initrd. boot.initrd.systemd.enable = false; + # make the test depend on its vars-check derivation + environment.variables.CLAN_VARS_CHECK = "${vars-check}"; } ); diff --git a/nixosModules/clanCore/vars/interface.nix b/nixosModules/clanCore/vars/interface.nix index 4e3ac3e42..b2a9c33da 100644 --- a/nixosModules/clanCore/vars/interface.nix +++ b/nixosModules/clanCore/vars/interface.nix @@ -246,7 +246,7 @@ in The path to the file containing the content of the generated value. This will be set automatically ''; - type = nullOr str; + type = nullOr path; default = null; }; path = lib.mkOption {