From f23ec817e64f5695331c43a8fd64d1b5e84073a4 Mon Sep 17 00:00:00 2001 From: seth Date: Wed, 27 Nov 2024 04:28:38 -0500 Subject: [PATCH] refactor(modules): use standalone attrset for lib We don't need to extend nixpkgs.lib anymore --- modules/global.nix | 2 +- modules/lib/default.nix | 9 +++------ modules/lib/mk-ext-lib.nix | 14 -------------- 3 files changed, 4 insertions(+), 21 deletions(-) delete mode 100644 modules/lib/mk-ext-lib.nix diff --git a/modules/global.nix b/modules/global.nix index dc5aaf3c..312844e9 100644 --- a/modules/global.nix +++ b/modules/global.nix @@ -7,7 +7,7 @@ }: let - catppuccinLib = (import ./lib/mk-ext-lib.nix { inherit config lib pkgs; }).ctp; + catppuccinLib = import ./lib { inherit config lib pkgs; }; in { diff --git a/modules/lib/default.nix b/modules/lib/default.nix index 69e89d86..be6e70bf 100644 --- a/modules/lib/default.nix +++ b/modules/lib/default.nix @@ -4,11 +4,8 @@ pkgs, ... }: -let - # this is a recursive attribute with all the functions below - inherit (lib) ctp; -in -{ + +lib.makeExtensible (ctp: { types = { flavor = lib.types.enum [ "latte" @@ -153,4 +150,4 @@ in # [ module ] -> [ module ] # Imports a list of modules with the current library applyToModules = map (lib.flip lib.modules.importApply { catppuccinLib = ctp; }); -} +}) diff --git a/modules/lib/mk-ext-lib.nix b/modules/lib/mk-ext-lib.nix deleted file mode 100644 index 55f39e86..00000000 --- a/modules/lib/mk-ext-lib.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -lib.extend ( - final: _: { - ctp = import ./. { - inherit config pkgs; - lib = final; - }; - } -)