nixos/actual: Allow for user and group setting

This commit is contained in:
Luana
2026-01-02 19:17:17 -03:00
parent e506f4feb9
commit 3a535dc67f

View File

@@ -31,6 +31,26 @@ in
description = "Whether to open the firewall for the specified port.";
};
user = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = ''
User account under which Actual runs.
If null is specified (default), a temporary user will be created by systemd. Otherwise won't be automatically created by the service.
'';
};
group = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = ''
Group account under which Actual runs.
If null is specified (default), a temporary user will be created by systemd. Otherwise won't be automatically created by the service.
'';
};
settings = mkOption {
default = { };
description = ''
@@ -101,9 +121,6 @@ in
serviceConfig = {
ExecStart = getExe cfg.package;
DynamicUser = true;
User = "actual";
Group = "actual";
StateDirectory = "actual";
RuntimeDirectory = "actual";
WorkingDirectory = cfg.settings.dataDir;
@@ -146,7 +163,21 @@ in
"@pkey"
];
UMask = "0077";
};
}
// (
if cfg.user != null then
{
DynamicUser = false;
Group = cfg.group;
User = cfg.user;
}
else
{
DynamicUser = true;
User = "actual";
Group = "actual";
}
);
};
};