refactor homeModules
This commit is contained in:
parent
0603a85579
commit
4a870d4a18
26 changed files with 126 additions and 65 deletions
27
homeModules/flake-module.nix
Normal file
27
homeModules/flake-module.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
flake.homeModules =
|
||||
(builtins.readDir ./.)
|
||||
|> lib.filterAttrs (
|
||||
path: type:
|
||||
(type == "directory" && lib.filesystem.pathIsRegularFile (./${path}/default.nix))
|
||||
|| (type == "regular" && (lib.hasSuffix ".nix" path))
|
||||
)
|
||||
|> lib.mapAttrs' (
|
||||
path: type:
|
||||
if type == "directory" then
|
||||
{
|
||||
name = path;
|
||||
value = {
|
||||
imports = [ ./${path} ];
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
name = lib.removeSuffix ".nix" path;
|
||||
value = {
|
||||
imports = [ ./${path} ];
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue