From 6e6167ac64b51336a90a8dd50cc93c8c55f18eed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 17 Jun 2025 19:34:19 +0200 Subject: [PATCH] trusted-nix-caches: migrate to clan.nixosTests module --- .../trusted-nix-caches/flake-module.nix | 21 ++++---- .../trusted-nix-caches/tests/vm/default.nix | 48 +++++++------------ 2 files changed, 26 insertions(+), 43 deletions(-) diff --git a/clanServices/trusted-nix-caches/flake-module.nix b/clanServices/trusted-nix-caches/flake-module.nix index 81c2dc33c..a1cb3ca60 100644 --- a/clanServices/trusted-nix-caches/flake-module.nix +++ b/clanServices/trusted-nix-caches/flake-module.nix @@ -1,17 +1,16 @@ -{ lib, self, ... }: +{ lib, ... }: +let + module = lib.modules.importApply ./default.nix { }; +in { - clan.modules = { - trusted-nix-caches = lib.modules.importApply ./default.nix { }; - }; + clan.modules.trusted-nix-caches = module; perSystem = - { pkgs, ... }: + { ... }: { - checks = lib.optionalAttrs (pkgs.stdenv.isLinux) { - trusted-nix-caches = import ./tests/vm/default.nix { - inherit pkgs; - clan-core = self; - nixosLib = import (self.inputs.nixpkgs + "/nixos/lib") { }; - }; + clan.nixosTests.trusted-nix-caches = { + imports = [ ./tests/vm/default.nix ]; + + clan.modules."@clan/trusted-nix-caches" = module; }; }; } diff --git a/clanServices/trusted-nix-caches/tests/vm/default.nix b/clanServices/trusted-nix-caches/tests/vm/default.nix index df7245aed..97adbfd60 100644 --- a/clanServices/trusted-nix-caches/tests/vm/default.nix +++ b/clanServices/trusted-nix-caches/tests/vm/default.nix @@ -1,40 +1,24 @@ { - pkgs, - nixosLib, - clan-core, - ... -}: -nixosLib.runTest ( - { ... }: - { - imports = [ - clan-core.modules.nixosVmTest.clanTest - ]; + name = "trusted-nix-caches"; - hostPkgs = pkgs; + clan = { + directory = ./.; + inventory = { + machines.server = { }; - name = "trusted-nix-caches"; - - clan = { - directory = ./.; - modules."@clan/trusted-nix-caches" = ../../default.nix; - inventory = { - machines.server = { }; - - instances = { - trusted-nix-caches = { - module.name = "@clan/trusted-nix-caches"; - roles.default.machines."server" = { }; - }; + instances = { + trusted-nix-caches = { + module.name = "@clan/trusted-nix-caches"; + roles.default.machines."server" = { }; }; }; }; + }; - nodes.server = { }; + nodes.server = { }; - testScript = '' - start_all() - server.succeed("grep -q 'cache.clan.lol' /etc/nix/nix.conf") - ''; - } -) + testScript = '' + start_all() + server.succeed("grep -q 'cache.clan.lol' /etc/nix/nix.conf") + ''; +}