mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-05 21:03:40 +00:00
nixos/actual: Allow for user and group setting
This commit is contained in:
@@ -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";
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user