trusted-nix-caches: migrate to clan.nixosTests module

This commit is contained in:
Jörg Thalheim
2025-06-17 19:34:19 +02:00
parent 8e2fc1056f
commit d31c9d1537
2 changed files with 26 additions and 43 deletions

View File

@@ -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;
};
};
}

View File

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