summaryrefslogtreecommitdiffstats
path: root/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'default.nix')
-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;