From b317cd7865996c60dd623e381e34027ea4e0c32a Mon Sep 17 00:00:00 2001 From: Lgmrszd Date: Sun, 18 Feb 2024 00:20:50 +0300 Subject: [PATCH] NixOS module to patch akkoma config, enabling configuration from database --- modules/akkoma-patches.nix | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 modules/akkoma-patches.nix diff --git a/modules/akkoma-patches.nix b/modules/akkoma-patches.nix new file mode 100644 index 0000000..eeb3e6c --- /dev/null +++ b/modules/akkoma-patches.nix @@ -0,0 +1,32 @@ +{ pkgs, lib, config, ... }: +let + configScriptPost = pkgs.writeShellApplication { + text = '' + echo "Patching config.exs" + cd "$RUNTIME_DIRECTORY" + cat >> config.exs << EOF + + # [===========================] + # [ configScriptPost patches: ] + # [===========================] + config :pleroma, configurable_from_database: true + EOF + echo "Done patching!" + ''; + name = "akkoma-config-patch"; + } + "/bin/akkoma-config-patch"; + cfg = config.services.akkoma.patches; +in +with lib; +{ + options.services.akkoma.patches = { + configurableFromDatabase = mkOption { + type = types.bool; + default = false; + }; + }; + config = mkIf cfg.configurableFromDatabase { + systemd.services.akkoma-config.serviceConfig.ExecStart = mkAfter [ configScriptPost ]; + systemd.services.akkoma-config.serviceConfig.ExecReload = mkAfter [ configScriptPost ]; + }; +} \ No newline at end of file