home: automatically create set of HM modules

This commit is contained in:
Tim Schubert 2024-03-02 12:23:11 +01:00
parent cfe49c73fc
commit 0a0cdf7188
Signed by: dadada
SSH key fingerprint: SHA256:bFAjFH3hR8zRBaJjzQDjc3o4jqoq5EZ87l+KXEjxIz0
4 changed files with 9 additions and 36 deletions

8
home/modules.nix Normal file
View file

@ -0,0 +1,8 @@
{ lib, ... }:
with lib; let
modules' = dir: filterAttrs (name: type: (hasSuffix ".nix" name) || (type == "directory"))
(builtins.readDir dir);
modules = dir: mapAttrs' (name: _: nameValuePair (removeSuffix ".nix" name) (import (dir + "/${name}")))
(modules' dir);
in
(modules ./modules)