From c55aa767f6417856721130504aa3ceb5b8cb8a08 Mon Sep 17 00:00:00 2001 From: seth Date: Tue, 7 Nov 2023 20:15:13 -0500 Subject: pkgs: improve package auto-import --- pkgs/default.nix | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pkgs/default.nix b/pkgs/default.nix index dc2f208..7ff9579 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,9 +1,21 @@ final: prev: with prev; let # directories are mapped to packages here for convenience sake - shouldUse = name: type: !(lib.hasPrefix "_" name) && type == "directory"; - dir = lib.filterAttrs shouldUse (builtins.readDir ./.); - imported = lib.mapAttrs (name: _: callPackage ./${name} {}) dir; + imported = lib.pipe ./. [ + builtins.readDir + + ( + lib.filterAttrs ( + name: type: !(lib.hasPrefix "_" name) && type == "directory" + ) + ) + + ( + lib.mapAttrs ( + file: _: callPackage ./${file} {} + ) + ) + ]; in imported // { -- cgit v1.2.3