flake.nix: add systemd service user option

This commit is contained in:
Elnu 2025-03-26 14:11:44 -07:00
parent a1f947eb50
commit d3f2d25a0f

View file

@ -65,6 +65,13 @@ Some utility commands:
The ji-chan package that should be used.
'';
};
user = lib.mkOption {
type = lib.types.str;
default = "ji-chan";
description = lib.mdDoc ''
User account under which ji-chan runs.
'';
};
domain = lib.mkOption {
type = lib.types.str;
default = "tegakituesday.com";
@ -106,10 +113,9 @@ Some utility commands:
after = [ "network.target" ];
wantedBy = [ "network.target" ];
serviceConfig = {
ExecStart = ''
${cfg.package}/bin/ji-chan --domain ${cfg.domain} --token ${cfg.token} --prefix "${builtins.replaceStrings ["\""] ["\\\""] cfg.prefix}" --hugo ${cfg.hugo} --guilds ${cfg.guildData}
'';
ExecStart = "${cfg.package}/bin/ji-chan --domain ${cfg.domain} --token ${cfg.token} --prefix \"${builtins.replaceStrings ["\""] ["\\\""] cfg.prefix}\" --hugo ${cfg.hugo} --guilds ${cfg.guildData}";
Restart = "always";
User = cfg.user;
DynamicUser = true;
};
};