nix-cfg/modules/akkoma-patches.nix

32 lines
888 B
Nix
Raw Normal View History

{ 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 ];
};
}