From 864e8c0ca6e29c3d01df554303740370f3bb7a7a Mon Sep 17 00:00:00 2001 From: Haonan Chen Date: Tue, 16 Dec 2025 15:55:21 +0800 Subject: [PATCH] modules.services.misskey: fix --- flake.lock | 8 ++-- modules/services/misskey.nix | 72 +++++++++++++++++++----------------- 2 files changed, 43 insertions(+), 37 deletions(-) diff --git a/flake.lock b/flake.lock index 74999b6d..d35dec83 100644 --- a/flake.lock +++ b/flake.lock @@ -716,11 +716,11 @@ "misskey": { "flake": false, "locked": { - "lastModified": 1765853869, - "narHash": "sha256-iqQ33UDp4CIfAgvoGBvKLQ40n7AtyAEq/Q1YfIOwaig=", + "lastModified": 1765875583, + "narHash": "sha256-nwdLJfY7ltQz2812Mq79RUAj+yjl4Hfw4ed9i+GtJx4=", "ref": "refs/heads/chn-mod", - "rev": "eed3e133a6fc263f60fbe958659c9ac81a9b2e57", - "revCount": 28247, + "rev": "8853b0bf6f16684261a8761c044b28ffec829e69", + "revCount": 28248, "submodules": true, "type": "git", "url": "https://github.com/CHN-beta/misskey" diff --git a/modules/services/misskey.nix b/modules/services/misskey.nix index 7c8153e9..b0ca10eb 100644 --- a/modules/services/misskey.nix +++ b/modules/services/misskey.nix @@ -22,8 +22,7 @@ inputs: after = [ "network.target" "redis-misskey-${instance.name}.service" "postgresql.service" ]; requires = after; wantedBy = [ "multi-user.target" ]; - environment.MISSKEY_CONFIG_YML = - inputs.config.nixos.system.sops.templates."misskey/${instance.name}.yml".path; + environment.MISSKEY_CONFIG_HAVE_COMPILED = "1"; serviceConfig = rec { User = "misskey-${instance.name}"; @@ -47,6 +46,11 @@ inputs: device = "${inputs.pkgs.localPackages.misskey}"; options = [ "bind" "private" "x-gvfs-hide" "X-fstrim.notrim" ]; }; + "/var/lib/misskey/${instance.name}/built/.config.json" = + { + device = inputs.config.nixos.system.sops.templates."misskey/${instance.name}.json".path; + options = [ "bind" "private" "x-gvfs-hide" "X-fstrim.notrim" ]; + }; "/var/lib/misskey/${instance.name}/work/files" = { device = "/var/lib/misskey/${instance.name}/files"; @@ -89,43 +93,45 @@ inputs: system.sops.templates = builtins.listToAttrs (builtins.map (instance: { - name = "misskey/${instance.name}.yml"; + name = "misskey/${instance.name}.json"; value = { content = let placeholder = inputs.config.nixos.system.sops.placeholder; redis = inputs.config.nixos.services.redis.instances."misskey-${instance.name}"; - in - '' - url: https://${instance.value.hostname}/ - port: ${toString instance.value.port} - db: - host: 127.0.0.1 - port: 5432 - db: misskey_${builtins.replaceStrings [ "-" ] [ "_" ] instance.name} - user: misskey_${builtins.replaceStrings [ "-" ] [ "_" ] instance.name} - pass: ${placeholder."postgresql/misskey_${builtins.replaceStrings [ "-" ] [ "_" ] instance.name}"} - extra: - statement_timeout: 600000 - dbReplications: false - redis: - host: 127.0.0.1 - port: ${builtins.toString redis.port} - pass: ${placeholder."redis/misskey-${instance.name}"} - id: 'aid' - proxyBypassHosts: - - api.deepl.com - - api-free.deepl.com - - www.recaptcha.net - - hcaptcha.com - - challenges.cloudflare.com - proxyRemoteFiles: true - signToActivityPubGet: true - maxFileSize: 1073741824 - fulltextSearch: - provider: sqlPgroonga - ''; + in builtins.toJSON + { + url = "https://${instance.value.hostname}/"; + port = instance.value.port; + db = + { + host = "127.0.0.1"; + port = 5432; + db = "misskey_${builtins.replaceStrings [ "-" ] [ "_" ] instance.name}"; + user = "misskey_${builtins.replaceStrings [ "-" ] [ "_" ] instance.name}"; + pass = placeholder."postgresql/misskey_${builtins.replaceStrings [ "-" ] [ "_" ] instance.name}"; + extra.statement_timeout = 600000; + }; + dbReplications = false; + redis = + { + host = "127.0.0.1"; + port = redis.port; + pass = placeholder."redis/misskey-${instance.name}"; + }; + id = "aid"; + proxyBypassHosts = + [ + "api.deepl.com" "api-free.deepl.com" "www.recaptcha.net" "hcaptcha.com" + "challenges.cloudflare.com" + ]; + proxyRemoteFiles = true; + signToActivityPubGet = true; + maxFileSize = 1073741824; + fulltextSearch.provider = "sqlPgroonga"; + trustProxy = true; + }; owner = "misskey-${instance.name}"; }; })