nixos/sing-box: generate config file into RuntimeDirectory (#338457)

This commit is contained in:
Nick Cao 2024-10-19 10:11:00 -04:00 committed by GitHub
commit f8b17f235e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -55,11 +55,17 @@ in
systemd.packages = [ cfg.package ];
systemd.services.sing-box = {
preStart = ''
umask 0077
mkdir -p /etc/sing-box
${utils.genJqSecretsReplacementSnippet cfg.settings "/etc/sing-box/config.json"}
'';
preStart = utils.genJqSecretsReplacementSnippet cfg.settings "/run/sing-box/config.json";
serviceConfig = {
StateDirectory = "sing-box";
StateDirectoryMode = "0700";
RuntimeDirectory = "sing-box";
RuntimeDirectoryMode = "0700";
ExecStart = [
""
"${lib.getExe cfg.package} -D \${STATE_DIRECTORY} -C \${RUNTIME_DIRECTORY} run"
];
};
wantedBy = [ "multi-user.target" ];
};
};