mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-23 16:29:42 -04:00
pruned
This commit is contained in:
commit
072951659a
114 changed files with 6922 additions and 0 deletions
35
system/machines/server/modules/default.nix
Normal file
35
system/machines/server/modules/default.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
let
|
||||
mkModules = dir: isRoot:
|
||||
let
|
||||
entries = builtins.readDir dir;
|
||||
names = builtins.attrNames entries;
|
||||
|
||||
isModuleDir = path:
|
||||
builtins.pathExists path &&
|
||||
builtins.readFileType path == "directory" &&
|
||||
builtins.baseNameOf path != "config" &&
|
||||
builtins.baseNameOf path != "plugins" &&
|
||||
builtins.baseNameOf path != "home-manager" &&
|
||||
builtins.baseNameOf path != "disko";
|
||||
isModule = file: file == "default.nix";
|
||||
isNix = file: builtins.match ".*\\.nix" file != null && file != "default.nix";
|
||||
|
||||
in
|
||||
builtins.concatMap (name:
|
||||
let
|
||||
path = "${dir}/${name}";
|
||||
in
|
||||
if isModuleDir path then
|
||||
mkModules path false
|
||||
else if isModule name && !isRoot then
|
||||
[dir]
|
||||
else if isNix name then
|
||||
[path]
|
||||
else
|
||||
[]
|
||||
) names;
|
||||
|
||||
in
|
||||
{
|
||||
imports = mkModules ./. true;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue