mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-09-11 22:37:18 +03:00
modules: export also core modules
This commit is contained in:
parent
e9fac8985c
commit
88087f6b88
@ -46,7 +46,7 @@ in {
|
||||
imports = flakePartsModules;
|
||||
|
||||
options.flake.modules = mkOption {
|
||||
type = types.lazyAttrsOf types.raw;
|
||||
type = types.lazyAttrsOf (types.lazyAttrsOf types.raw);
|
||||
};
|
||||
|
||||
# generates future flake outputs: `modules.<kind>.<module-name>`
|
||||
|
33
modules/flake-parts/core-modules.nix
Normal file
33
modules/flake-parts/core-modules.nix
Normal file
@ -0,0 +1,33 @@
|
||||
# Automatically exports modules from the `/**/modules` directory to:
|
||||
# `flake.modules.<kind>.<name>`
|
||||
# Automatically imports all flake-parts modules from `/**/modules/flake-parts`
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
self,
|
||||
...
|
||||
}: let
|
||||
# inherit all lib functions used below
|
||||
inherit
|
||||
(builtins)
|
||||
readDir
|
||||
;
|
||||
inherit
|
||||
(lib)
|
||||
mapAttrs'
|
||||
filterAttrs
|
||||
nameValuePair
|
||||
removeSuffix
|
||||
;
|
||||
|
||||
mapModules = path:
|
||||
mapAttrs'
|
||||
(fn: _:
|
||||
nameValuePair
|
||||
(removeSuffix ".nix" fn)
|
||||
(path + "/${fn}"))
|
||||
(filterAttrs (_: type: type == "regular" || type == "directory") (readDir path));
|
||||
in {
|
||||
# generates future flake outputs: `modules.<kind>.<module-name>`
|
||||
config.flake.modules.dream2nix = mapModules (self + "/modules/dream2nix/core");
|
||||
}
|
Loading…
Reference in New Issue
Block a user