aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules/default.nix
blob: d45cb0ad9f6fb9bc587cf6a7ac87ffe2f4dc5bac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
  lib,
  default_modules ? [],
}: let
  inherit (builtins) readDir;
  inherit (lib) filterAttrs hasSuffix attrValues mapAttrs' nameValuePair removeSuffix;

  modules =
    mapAttrs'
    (fname: _: nameValuePair (removeSuffix ".nix" fname) (./. + ("/" + fname)))
    (filterAttrs (
      n: v:
        v == "regular" && n != "default.nix" && hasSuffix ".nix" n
    ) (readDir ./.));
in
  modules
  // {
    default = {
      imports = attrValues modules ++ default_modules;
    };
  }