mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-24 08:39:42 -04:00
changed imports to mkModules
This commit is contained in:
parent
649d9e83b6
commit
5c3d410aa0
34 changed files with 67 additions and 448 deletions
|
|
@ -13,7 +13,6 @@ let
|
|||
|
||||
in
|
||||
{ options.modules.system.bitcoin = { enable = mkEnableOption "Bitcoin Server"; };
|
||||
imports = [ ./modules ];
|
||||
config = mkIf cfg.enable {
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./electrum
|
||||
];
|
||||
}
|
||||
|
|
@ -1,5 +1,32 @@
|
|||
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";
|
||||
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 = [
|
||||
./bitcoin
|
||||
];
|
||||
imports = mkModules ./. true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue