summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-10-01 03:07:31 +0200
committertv <tv@shackspace.de>2015-10-01 03:07:31 +0200
commit0a479349f975dce8e9832fb80416c4a631713cb2 (patch)
treefe3371af90cc16bac2d9eeece5197085270b00a4
parent3bb7ba2af9a1150a4861c3ab1138e2dd5d0ed2df (diff)
default out: filter unknown dirs
-rw-r--r--default.nix21
1 files changed, 13 insertions, 8 deletions
diff --git a/default.nix b/default.nix
index 7f3f621b8..c6a635c29 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 <nixpkgs/nixos/lib/eval-config.nix> {
system = builtins.currentSystem;