From 73b298d0b27cacf126bda420fc7b6d1a8a829148 Mon Sep 17 00:00:00 2001 From: DavHau Date: Mon, 30 Jun 2025 19:04:21 +0700 Subject: [PATCH] checks: rename attributes for better discoverability - all eval checks prefixed with `eval-` - all service checks prefixed with `service-` --- docs/site/guides/contributing/testing.md | 8 ++-- lib/flake-parts/clan-nixos-test.nix | 38 ++++++++++--------- lib/introspection/flake-module.nix | 2 +- lib/modules/flake-module.nix | 2 +- .../distributed-service/flake-module.nix | 2 +- lib/modules/inventory/flake-module.nix | 4 +- nixosModules/clanCore/vars/flake-module.nix | 2 +- 7 files changed, 30 insertions(+), 28 deletions(-) diff --git a/docs/site/guides/contributing/testing.md b/docs/site/guides/contributing/testing.md index 782e3207e..0019e02c7 100644 --- a/docs/site/guides/contributing/testing.md +++ b/docs/site/guides/contributing/testing.md @@ -234,16 +234,16 @@ Failing nix eval tests look like this: > error: Tests failed ``` -To locate the definition, find the flake attribute name of the failing test near the top of the CI Job page, like for example `gitea:clan/clan-core#checks.x86_64-linux.lib-values-eval/1242`. +To locate the definition, find the flake attribute name of the failing test near the top of the CI Job page, like for example `gitea:clan/clan-core#checks.x86_64-linux.eval-lib-values/1242`. -In this case `lib-values-eval` is the attribute we are looking for. +In this case `eval-lib-values` is the attribute we are looking for. Find the attribute via ripgrep: ```shellSession -$ rg "lib-values-eval =" +$ rg "eval-lib-values =" lib/values/flake-module.nix -21: lib-values-eval = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } '' +21: eval-lib-values = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } '' grmpf@grmpf-nix ~/p/c/clan-core (test-docs)> ``` diff --git a/lib/flake-parts/clan-nixos-test.nix b/lib/flake-parts/clan-nixos-test.nix index 6a635c742..e27ef98e0 100644 --- a/lib/flake-parts/clan-nixos-test.nix +++ b/lib/flake-parts/clan-nixos-test.nix @@ -62,26 +62,28 @@ in in lib.mkMerge [ # Add the VM tests as checks - (lib.mapAttrs ( - _name: testModule: - nixosLib.runTest ( - { ... }: - { - imports = [ - self.modules.nixosTest.clanTest - testModule - ]; - - hostPkgs = pkgs; - - defaults = { + (lib.mapAttrs' ( + name: testModule: + lib.nameValuePair "service-${name}" ( + nixosLib.runTest ( + { ... }: + { imports = [ - { - _module.args.clan-core = self; - } + self.modules.nixosTest.clanTest + testModule ]; - }; - } + + hostPkgs = pkgs; + + defaults = { + imports = [ + { + _module.args.clan-core = self; + } + ]; + }; + } + ) ) ) cfg) diff --git a/lib/introspection/flake-module.nix b/lib/introspection/flake-module.nix index ee18b5999..e54f87542 100644 --- a/lib/introspection/flake-module.nix +++ b/lib/introspection/flake-module.nix @@ -18,7 +18,7 @@ in { legacyPackages.evalTests-values = tests; checks = { - lib-values-eval = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } '' + eval-lib-values = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } '' export HOME="$(realpath .)" nix-unit --eval-store "$HOME" \ --extra-experimental-features flakes \ diff --git a/lib/modules/flake-module.nix b/lib/modules/flake-module.nix index 2109af68a..27fe36909 100644 --- a/lib/modules/flake-module.nix +++ b/lib/modules/flake-module.nix @@ -36,7 +36,7 @@ in buildClan = self.clanLib.buildClan; }; checks = { - lib-build-clan-eval = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } '' + eval-lib-build-clan = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } '' export HOME="$(realpath .)" nix-unit --eval-store "$HOME" \ diff --git a/lib/modules/inventory/distributed-service/flake-module.nix b/lib/modules/inventory/distributed-service/flake-module.nix index 0486b70ce..3940c44ed 100644 --- a/lib/modules/inventory/distributed-service/flake-module.nix +++ b/lib/modules/inventory/distributed-service/flake-module.nix @@ -20,7 +20,7 @@ in }; checks = { - lib-distributedServices-eval = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } '' + eval-lib-distributedServices = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } '' export HOME="$(realpath .)" nix-unit --eval-store "$HOME" \ --extra-experimental-features flakes \ diff --git a/lib/modules/inventory/flake-module.nix b/lib/modules/inventory/flake-module.nix index c52abbd24..06824258d 100644 --- a/lib/modules/inventory/flake-module.nix +++ b/lib/modules/inventory/flake-module.nix @@ -26,7 +26,7 @@ in devShells.inventory-schema = pkgs.mkShell { name = "clan-inventory-schema"; inputsFrom = with config.checks; [ - lib-inventory-eval + eval-lib-inventory self'.devShells.default ]; }; @@ -62,7 +62,7 @@ in }; checks = { - lib-inventory-eval = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } '' + eval-lib-inventory = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } '' export HOME="$(realpath .)" export NIX_ABORT_ON_WARN=1 nix-unit --eval-store "$HOME" \ diff --git a/nixosModules/clanCore/vars/flake-module.nix b/nixosModules/clanCore/vars/flake-module.nix index 6ec77ce85..577d0efba 100644 --- a/nixosModules/clanCore/vars/flake-module.nix +++ b/nixosModules/clanCore/vars/flake-module.nix @@ -18,7 +18,7 @@ in clan-core = self; pkgs = inputs.nixpkgs.legacyPackages.${system}; }; - checks.module-clan-vars-eval = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } '' + checks.eval-module-clan-vars = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } '' export HOME="$(realpath .)" nix-unit --eval-store "$HOME" \