Inventory: add new module class: class='clan'

This commit is contained in:
Johannes Kirschbauer
2025-02-04 15:06:25 +07:00
parent 4878b773cb
commit 9d06dec7d0
8 changed files with 259 additions and 123 deletions

View File

@@ -0,0 +1,4 @@
---
features = [ "inventory" ]
---
Description

View File

@@ -0,0 +1,6 @@
{ ... }:
{
_class = "clan";
perInstance = { };
perService = { };
}

View File

@@ -9,6 +9,44 @@ let
inherit (inventory) buildInventory;
in
{
test_inventory_a =
let
compiled = buildInventory {
inventory = {
machines = {
A = { };
};
services = {
clanModule = { };
legacyModule = { };
};
modules = {
clanModule = ./clanModule;
legacyModule = ./legacyModule;
};
};
directory = ./.;
};
in
{
expr = {
clanModule = lib.filterAttrs (
name: _: name == "isClanModule"
) compiled.machines.A.compiledServices.clanModule;
legacyModule = lib.filterAttrs (
name: _: name == "isClanModule"
) compiled.machines.A.compiledServices.legacyModule;
};
expected = {
clanModule = {
isClanModule = true;
};
legacyModule = {
isClanModule = false;
};
};
};
test_inventory_empty =
let
compiled = buildInventory {

View File

@@ -0,0 +1,4 @@
---
features = [ "inventory" ]
---
Description

View File

@@ -0,0 +1,10 @@
{
lib,
config,
clan-core,
...
}:
{
# Just some random stuff
config.user.user = lib.mapAttrs clan-core.users.root;
}