From 0a479349f975dce8e9832fb80416c4a631713cb2 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 1 Oct 2015 03:07:31 +0200 Subject: default out: filter unknown dirs --- default.nix | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'default.nix') diff --git a/default.nix b/default.nix index 7f3f621b..c6a635c2 100644 --- a/default.nix +++ b/default.nix @@ -12,14 +12,19 @@ let user-pkgs-path = ./. + "/${current-user-name}/5pkgs"; out = - (lib.mapAttrs - (k: v: - if builtins.pathExists (./. + "/${k}/1systems") - then mk-namespace (./. + "/${k}") - else import (./. + "/${k}")) - (lib.filterAttrs - (k: v: !lib.hasPrefix "." k && v == "directory") - (builtins.readDir ./.))); + lib.mapAttrs (_: builtins.getAttr "main") + (lib.filterAttrs (_: builtins.hasAttr "main") + (lib.mapAttrs + (k: v: + if lib.hasPrefix "." k || v != "directory" then + {} + else if builtins.pathExists (./. + "/${k}/default.nix") then + { main = import (./. + "/${k}"); } + else if builtins.pathExists (./. + "/${k}/1systems") then + { main = mk-namespace (./. + "/${k}"); } + else + {}) + (builtins.readDir ./.))); eval = path: import { system = builtins.currentSystem; -- cgit v1.2.3