summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseth <[email protected]>2023-11-07 20:15:13 -0500
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2023-11-08 01:21:16 +0000
commitc55aa767f6417856721130504aa3ceb5b8cb8a08 (patch)
treedcc032349d685d87c72f72249acc1e5b9a7f63ee
parent6fa4fc84f72cce15f38ab3e125f156a5e381bf81 (diff)
pkgs: improve package auto-import
-rw-r--r--pkgs/default.nix18
1 files 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
// {