From 0083ea86dfd2f0befae41a7d43e6ed791391c18a Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Sun, 30 Mar 2025 16:11:04 +0200 Subject: [PATCH] feat(lib): init callLib; helper to bootstrap clanLib --- lib/default.nix | 2 ++ lib/flake-module.nix | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/default.nix b/lib/default.nix index 64355d074..359bbb8f7 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -13,6 +13,8 @@ lib.fix (clanLib: { # We should reduce the dependency on 'self' aka the 'flake' object # This makes it easier to test # most of the time passing the whole flake is unnecessary + callLib = file: args: import file { inherit lib clanLib; } // args; + evalClan = import ./eval-clan-modules { inherit lib; clan-core = self; diff --git a/lib/flake-module.nix b/lib/flake-module.nix index 219e1a230..5d729ee68 100644 --- a/lib/flake-module.nix +++ b/lib/flake-module.nix @@ -10,7 +10,9 @@ let pathExists ; in -{ +rec { + # We should remove this. + # It would enforce treating at least 'lib' as a module in a whole imports = filter pathExists [ ./jsonschema/flake-module.nix ./inventory/flake-module.nix @@ -18,9 +20,10 @@ in ./values/flake-module.nix ./distributed-service/flake-module.nix ]; - flake.lib = import ./default.nix { - inherit lib inputs; + flake.clanLib = import ./default.nix { + inherit lib inputs self; inherit (inputs) nixpkgs; - clan-core = self; }; + # TODO: remove this legacy alias + flake.lib = flake.clanLib; }