surrender
Some checks failed
ci/woodpecker/push/job Pipeline failed

This commit is contained in:
polwex 2026-04-19 08:51:24 +07:00
parent 0790da4e32
commit 78cc1b95bb
3 changed files with 49 additions and 2 deletions

View file

@ -2,6 +2,14 @@
let
cfg = config.services.kotsukotsu;
launcher = pkgs.writeShellScript "kotsukotsu-launch" ''
exec ${cfg.currentPath}/bin/kotsukotsu
'';
ensureCurrent = pkgs.writeShellScript "kotsukotsu-ensure-current" ''
if [ ! -e ${cfg.currentPath} ]; then
ln -sfn ${cfg.package} ${cfg.currentPath}
fi
'';
in
{
options.services.kotsukotsu = {
@ -38,6 +46,12 @@ in
description = "Directory for the persistent SQLite database.";
};
currentPath = lib.mkOption {
type = lib.types.str;
default = "/var/lib/kotsukotsu/current";
description = "Stable symlink path that points at the active app package.";
};
user = lib.mkOption {
type = lib.types.str;
default = "kotsukotsu";
@ -71,6 +85,10 @@ in
assertion = lib.hasPrefix "/" cfg.dataDir;
message = "services.kotsukotsu.dataDir must be an absolute path.";
}
{
assertion = lib.hasPrefix "/" cfg.currentPath;
message = "services.kotsukotsu.currentPath must be an absolute path.";
}
];
users.groups = lib.mkIf (cfg.group == "kotsukotsu") {
@ -104,7 +122,8 @@ in
};
serviceConfig = {
ExecStart = lib.getExe cfg.package;
ExecStart = launcher;
ExecStartPre = ensureCurrent;
Group = cfg.group;
Restart = "on-failure";
User = cfg.user;