lib/modules: fixup paths

This commit is contained in:
Johannes Kirschbauer
2025-10-21 20:31:21 +02:00
parent 346e3d816a
commit c838e08d77
8 changed files with 52 additions and 54 deletions

View File

@@ -1,8 +1,10 @@
clanServices/.* @pinpox @kenji clanServices/.* @pinpox @kenji
lib/test/container-test-driver/.* @DavHau @mic92 lib/test/container-test-driver/.* @DavHau @mic92
lib/modules/inventory/.* @hsjobeki lib/inventory/.* @hsjobeki
lib/modules/inventoryClass/.* @hsjobeki lib/inventoryClass/.* @hsjobeki
modules/.* @hsjobeki
pkgs/clan-app/ui/.* @hsjobeki @brianmcgee pkgs/clan-app/ui/.* @hsjobeki @brianmcgee
pkgs/clan-app/clan_app/.* @qubasa @hsjobeki pkgs/clan-app/clan_app/.* @qubasa @hsjobeki

View File

@@ -2,7 +2,7 @@
lib ? import <nixpkgs/lib>, lib ? import <nixpkgs/lib>,
}: }:
let let
clanLibOrig = (import ./.. { inherit lib; }).__unfix__; clanLibOrig = (import ./. { inherit lib; }).__unfix__;
clanLibWithFs = clanLibWithFs =
{ virtual_fs }: { virtual_fs }:
lib.fix ( lib.fix (
@@ -11,19 +11,19 @@ let
let let
clan-core = { clan-core = {
clanLib = final; clanLib = final;
modules.clan.default = lib.modules.importApply ./clan { inherit clan-core; }; modules.clan.default = lib.modules.importApply ../modules/clan { inherit clan-core; };
# Note: Can add other things to "clan-core" # Note: Can add other things to "clan-core"
# ... Not needed for this test # ... Not needed for this test
}; };
in in
{ {
clan = import ../clan { clan = import ./clan {
inherit lib clan-core; inherit lib clan-core;
}; };
# Override clanLib.fs for unit-testing against a virtual filesystem # Override clanLib.fs for unit-testing against a virtual filesystem
fs = import ../clanTest/virtual-fs.nix { inherit lib; } { fs = import ./clanTest/virtual-fs.nix { inherit lib; } {
inherit rootPath virtual_fs; inherit rootPath virtual_fs;
# Example of a passthru # Example of a passthru
# passthru = [ # passthru = [

View File

@@ -17,9 +17,9 @@ lib.evalModules {
specialArgs._ctx = prefix; specialArgs._ctx = prefix;
modules = [ modules = [
# Base module # Base module
./service-module.nix ./inventory/distributed-service/service-module.nix
# Feature modules # Feature modules
(lib.modules.importApply ./api-feature.nix { (lib.modules.importApply ./inventory/distributed-service/api-feature.nix {
inherit clanLib prefix; inherit clanLib prefix;
}) })
] ]

View File

@@ -100,6 +100,35 @@ rec {
touch $out touch $out
''; '';
}; };
# Run: nix-unit --extra-experimental-features flakes --flake .#legacyPackages.x86_64-linux.evalTests-build-clan
legacyPackages.evalTests-build-clan = import ./tests.nix {
inherit lib;
clan-core = self;
};
checks = {
eval-lib-build-clan = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } ''
export HOME="$(realpath .)"
nix-unit --eval-store "$HOME" \
--extra-experimental-features flakes \
--show-trace \
${inputOverrides} \
--flake ${
self.filter {
include = [
"flakeModules"
"inventory.json"
"lib"
"machines"
"nixosModules"
];
}
}#legacyPackages.${system}.evalTests-build-clan
touch $out
'';
};
}; };
} }

View File

@@ -13,16 +13,17 @@ in
let let
# Common filtered source for inventory tests # Common filtered source for inventory tests
inventoryTestsSrc = lib.fileset.toSource { inventoryTestsSrc = lib.fileset.toSource {
root = ../../../..; root = ../../..;
fileset = lib.fileset.unions [ fileset = lib.fileset.unions [
../../../../flake.nix ../../../flake.nix
../../../../flake.lock ../../../flake.lock
(lib.fileset.fileFilter (file: file.name == "flake-module.nix") ../../../..) (lib.fileset.fileFilter (file: file.name == "flake-module.nix") ../../..)
../../../../flakeModules ../../../flakeModules
../../../../lib ../../../lib
../../../../nixosModules/clanCore ../../../nixosModules/clanCore
../../../../machines ../../../machines
../../../../inventory.json ../../../inventory.json
../../../modules
]; ];
}; };
in in

View File

@@ -105,7 +105,7 @@ in
self = { self = {
inputs = { }; inputs = { };
}; };
directory = ../../.; directory = ../.;
meta.name = "test-clan-core"; meta.name = "test-clan-core";
}; };
in in
@@ -123,7 +123,7 @@ in
self = { self = {
inputs = { }; inputs = { };
}; };
directory = ../../.; directory = ../.;
meta.name = "test-clan-core"; meta.name = "test-clan-core";
}; };
in in

View File

@@ -1,11 +1,7 @@
{ {
self, self,
inputs,
... ...
}: }:
let
inputOverrides = self.clanLib.flake-inputs.getOverrides inputs;
in
{ {
imports = [ imports = [
./clan/flake-module.nix ./clan/flake-module.nix
@@ -14,7 +10,6 @@ in
{ {
pkgs, pkgs,
lib, lib,
system,
... ...
}: }:
let let
@@ -25,34 +20,5 @@ in
in in
{ {
legacyPackages.clan-options = jsonDocs.optionsJSON; legacyPackages.clan-options = jsonDocs.optionsJSON;
# Run: nix-unit --extra-experimental-features flakes --flake .#legacyPackages.x86_64-linux.evalTests-build-clan
legacyPackages.evalTests-build-clan = import ./tests.nix {
inherit lib;
clan-core = self;
};
checks = {
eval-lib-build-clan = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } ''
export HOME="$(realpath .)"
nix-unit --eval-store "$HOME" \
--extra-experimental-features flakes \
--show-trace \
${inputOverrides} \
--flake ${
self.filter {
include = [
"flakeModules"
"inventory.json"
"lib"
"machines"
"nixosModules"
];
}
}#legacyPackages.${system}.evalTests-build-clan
touch $out
'';
};
}; };
} }

View File

@@ -118,7 +118,7 @@
_file = "docs flake-module"; _file = "docs flake-module";
imports = [ imports = [
{ _module.args = { inherit clanLib; }; } { _module.args = { inherit clanLib; }; }
(import ../../lib/modules/inventoryClass/roles-interface.nix { (import ../../modules/inventoryClass/roles-interface.nix {
nestedSettingsOption = mkOption { nestedSettingsOption = mkOption {
type = types.raw; type = types.raw;
description = '' description = ''