diff --git a/nixos/default.nix b/nixos/default.nix index c9f9259..b0d14c8 100755 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -1,7 +1,5 @@ let modulesPath = ./modules; - servicePath = modulesPath + "/services"; - moduleImport = path: nameTransform: builtins.listToAttrs ( map @@ -15,10 +13,22 @@ let (builtins.attrNames (builtins.readDir path)) ) ); - modules = moduleImport modulesPath (name: builtins.replaceStrings [".nix"] [""] name) - // moduleImport servicePath (name: builtins.replaceStrings [".nix"] [""] name); + // (path: + builtins.listToAttrs ( + map + (name: { + name = name; + value = import (path + "/${name}"); + }) + ( + builtins.filter + (name: (builtins.readDir path).${name} == "directory") + (builtins.attrNames (builtins.readDir path)) + ) + )) + modulesPath; in { flake.nixosModules = { personal = { @@ -59,19 +69,7 @@ in { imports = builtins.attrValues { inherit (modules) - acme - caddy - jellyfin - logrotate - mastodon - minecraft - nextcloud - ollama - owncast - peertube - postgresql - samba - vaultwarden + services ; }; }; diff --git a/nixos/modules/services/default.nix b/nixos/modules/services/default.nix new file mode 100644 index 0000000..96fbf9f --- /dev/null +++ b/nixos/modules/services/default.nix @@ -0,0 +1,27 @@ +{ + imports = let + configPath = ./config; + in + (map + (folder: (configPath + ./${folder})) + [ + "mastodon" + ]) + ++ (map + (file: (configPath + ./${file}.nix)) + [ + "acme" + "caddy" + "jellyfin" + "logrotate" + "minecraft" + "ollama" + "peertube" + "postgresql" + "owncast" + "samba" + "vaultwarden" + # "forgejo" + # "nextcloud" + ]); +} diff --git a/nixos/modules/services/chars.patch b/nixos/modules/services/mastodon/chars.patch similarity index 100% rename from nixos/modules/services/chars.patch rename to nixos/modules/services/mastodon/chars.patch diff --git a/nixos/modules/services/mastodon.nix b/nixos/modules/services/mastodon/default.nix similarity index 100% rename from nixos/modules/services/mastodon.nix rename to nixos/modules/services/mastodon/default.nix diff --git a/nixos/modules/services/twitter.txt b/nixos/modules/services/mastodon/twitter.txt similarity index 100% rename from nixos/modules/services/twitter.txt rename to nixos/modules/services/mastodon/twitter.txt