Merge pull request #176133 from SuperSandro2000/asf-2
This commit is contained in:
commit
d8fad83d2c
|
@ -13,7 +13,7 @@ let
|
||||||
# is in theory not needed as this is already the default for default builds
|
# is in theory not needed as this is already the default for default builds
|
||||||
UpdateChannel = 0;
|
UpdateChannel = 0;
|
||||||
Headless = true;
|
Headless = true;
|
||||||
} // lib.optionalAttrs (cfg.ipcPasswordFile != "") {
|
} // lib.optionalAttrs (cfg.ipcPasswordFile != null) {
|
||||||
IPCPassword = "#ipcPassword#";
|
IPCPassword = "#ipcPassword#";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -94,7 +94,8 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
ipcPasswordFile = mkOption {
|
ipcPasswordFile = mkOption {
|
||||||
type = types.path;
|
type = types.nullOr types.path;
|
||||||
|
default = null;
|
||||||
description = "Path to a file containig the password. The file must be readable by the <literal>asf</literal> user/group.";
|
description = "Path to a file containig the password. The file must be readable by the <literal>asf</literal> user/group.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -159,7 +160,6 @@ in
|
||||||
users = {
|
users = {
|
||||||
users.asf = {
|
users.asf = {
|
||||||
home = cfg.dataDir;
|
home = cfg.dataDir;
|
||||||
homeMode = "700";
|
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
group = "asf";
|
group = "asf";
|
||||||
description = "Archis-Steam-Farm service user";
|
description = "Archis-Steam-Farm service user";
|
||||||
|
@ -174,13 +174,17 @@ in
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
serviceConfig = mkMerge [
|
serviceConfig = mkMerge [
|
||||||
(mkIf (cfg.dataDir == "/var/lib/asf") { StateDirectory = "asf"; })
|
(mkIf (cfg.dataDir == "/var/lib/asf") {
|
||||||
|
StateDirectory = "asf";
|
||||||
|
StateDirectoryMode = "700";
|
||||||
|
})
|
||||||
{
|
{
|
||||||
User = "asf";
|
User = "asf";
|
||||||
Group = "asf";
|
Group = "asf";
|
||||||
WorkingDirectory = cfg.dataDir;
|
WorkingDirectory = cfg.dataDir;
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
ExecStart = "${cfg.package}/bin/ArchiSteamFarm --path ${cfg.dataDir} --process-required --no-restart --service --no-config-migrate";
|
ExecStart = "${cfg.package}/bin/ArchiSteamFarm --path ${cfg.dataDir} --process-required --no-restart --service --no-config-migrate";
|
||||||
|
Restart = "always";
|
||||||
|
|
||||||
# mostly copied from the default systemd service
|
# mostly copied from the default systemd service
|
||||||
PrivateTmp = true;
|
PrivateTmp = true;
|
||||||
|
@ -222,7 +226,10 @@ in
|
||||||
mkdir -p config
|
mkdir -p config
|
||||||
|
|
||||||
cp --no-preserve=mode ${asf-config} config/ASF.json
|
cp --no-preserve=mode ${asf-config} config/ASF.json
|
||||||
${replaceSecretBin} '#ipcPassword#' '${cfg.ipcPasswordFile}' config/ASF.json
|
|
||||||
|
${optionalString (cfg.ipcPasswordFile != null) ''
|
||||||
|
${replaceSecretBin} '#ipcPassword#' '${cfg.ipcPasswordFile}' config/ASF.json
|
||||||
|
''}
|
||||||
|
|
||||||
${optionalString (cfg.ipcSettings != {}) ''
|
${optionalString (cfg.ipcSettings != {}) ''
|
||||||
ln -fs ${ipc-config} config/IPC.config
|
ln -fs ${ipc-config} config/IPC.config
|
||||||
|
@ -243,6 +250,6 @@ in
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
buildDocsInSandbox = false;
|
buildDocsInSandbox = false;
|
||||||
maintainers = with maintainers; [ lom ];
|
maintainers = with maintainers; [ lom SuperSandro2000 ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue