hm-modules: extract getModules function
This commit is contained in:
parent
3df5994159
commit
13c97347f8
1 changed files with 10 additions and 5 deletions
|
@ -1,14 +1,19 @@
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
dirEntries = builtins.removeAttrs (builtins.readDir ./.) [ "default.nix" ];
|
getModules = path:
|
||||||
moduleEntries = lib.attrsets.filterAttrs (n: v: v == "regular") dirEntries;
|
let
|
||||||
moduleNames = builtins.attrNames moduleEntries;
|
dirEntries = builtins.removeAttrs (builtins.readDir path) [ "default.nix" ];
|
||||||
|
moduleEntries = lib.attrsets.filterAttrs (n: v: v == "regular") dirEntries;
|
||||||
|
moduleNames = builtins.attrNames moduleEntries;
|
||||||
|
|
||||||
modulePaths = builtins.map (name: ./${name}) moduleNames;
|
|
||||||
|
modulePaths = builtins.map (name: path + /${name}) moduleNames;
|
||||||
|
in
|
||||||
|
modulePaths;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = modulePaths;
|
imports = getModules ./.;
|
||||||
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue