From f7d15215eab93d6f557dab363c593bf3db30c9f8 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Sun, 30 Mar 2025 16:58:26 +0200 Subject: [PATCH] feat(clanLib): expose clanInternals.clanLib This is usefully for: - As api via python - for testing clanLib downstream --- lib/build-clan/interface.nix | 2 +- lib/build-clan/module.nix | 5 +---- pkgs/clan-cli/clan_cli/flake.py | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/build-clan/interface.nix b/lib/build-clan/interface.nix index ed4268ec3..010d86819 100644 --- a/lib/build-clan/interface.nix +++ b/lib/build-clan/interface.nix @@ -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; }; diff --git a/lib/build-clan/module.nix b/lib/build-clan/module.nix index f4bd10d58..8c689cc20 100644 --- a/lib/build-clan/module.nix +++ b/lib/build-clan/module.nix @@ -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}"; diff --git a/pkgs/clan-cli/clan_cli/flake.py b/pkgs/clan-cli/clan_cli/flake.py index e23d012b4..057454d60 100644 --- a/pkgs/clan-cli/clan_cli/flake.py +++ b/pkgs/clan-cli/clan_cli/flake.py @@ -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():