From 38ba7562467729c0fd4eb7dbd7f6057845499edf Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 23 Nov 2024 20:40:51 -0600 Subject: [PATCH] feat: server test --- nixos/default.nix | 32 +++++++++---------- nixos/modules/services/default.nix | 27 ++++++++++++++++ .../services/{ => mastodon}/chars.patch | 0 .../{mastodon.nix => mastodon/default.nix} | 0 .../services/{ => mastodon}/twitter.txt | 0 5 files changed, 42 insertions(+), 17 deletions(-) create mode 100644 nixos/modules/services/default.nix rename nixos/modules/services/{ => mastodon}/chars.patch (100%) rename nixos/modules/services/{mastodon.nix => mastodon/default.nix} (100%) rename nixos/modules/services/{ => mastodon}/twitter.txt (100%) 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