NixOS module to patch akkoma config, enabling configuration from database

This commit is contained in:
Lgmrszd 2024-02-18 00:20:50 +03:00
parent 4042bf6842
commit b317cd7865
No known key found for this signature in database
GPG key ID: 9396B8BA6FBB14DE

View file

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