feat(clanLib): expose clanInternals.clanLib

This is usefully for:
- As api via python
- for testing clanLib downstream
This commit is contained in:
Johannes Kirschbauer
2025-03-30 16:58:26 +02:00
parent c25574bebd
commit f7d15215ea
3 changed files with 4 additions and 7 deletions

View File

@@ -148,7 +148,7 @@ in
clanModules = lib.mkOption { type = lib.types.raw; };
source = lib.mkOption { type = lib.types.raw; };
meta = lib.mkOption { type = lib.types.raw; };
lib = lib.mkOption { type = lib.types.raw; };
clanLib = lib.mkOption { type = lib.types.raw; };
all-machines-json = lib.mkOption { type = lib.types.raw; };
machines = lib.mkOption { type = lib.types.raw; };
machinesFunc = lib.mkOption { type = lib.types.raw; };

View File

@@ -205,7 +205,7 @@ in
inherit lib inventory;
flake = config.self;
};
inherit (clan-core) clanModules;
inherit (clan-core) clanModules clanLib;
inherit inventoryFile;
inventoryValuesPrios =
# Temporary workaround
@@ -217,9 +217,6 @@ in
templates = config.templates;
inventory = config.inventory;
meta = config.inventory.meta;
lib = {
inherit (clan-core.lib) select;
};
source = "${clan-core}";

View File

@@ -86,7 +86,7 @@ class FlakeCacheEntry:
self.selector = {int(selectors[0])}
selector = int(selectors[0])
elif isinstance(selectors[0], str):
self.selector = {(selectors[0])}
self.selector = {selectors[0]}
selector = selectors[0]
elif isinstance(selectors[0], AllSelector):
self.selector = AllSelector()
@@ -481,7 +481,7 @@ class Flake:
flake = builtins.getFlake("path:{self.store_path}?narHash={self.hash}");
in
flake.inputs.nixpkgs.legacyPackages.{config["system"]}.writeText "clan-flake-select" (
builtins.toJSON [ ({" ".join([f"flake.clanInternals.lib.select ''{attr}'' flake" for attr in selectors])}) ]
builtins.toJSON [ ({" ".join([f"flake.clanInternals.clanLib.select ''{attr}'' flake" for attr in selectors])}) ]
)
"""
if tmp_store := nix_test_store():