nixos/hydra: add system-hydra.slice, fix typo (#338532)

This commit is contained in:
Rick van Schijndel
2024-09-09 19:47:21 +02:00
committed by GitHub

View File

@@ -246,7 +246,7 @@ in
}
{
assertion = cfg.minSpareServers < cfg.maxSpareServers;
message = "services.hydra.minSpareServers cannot be bigger than servives.hydra.maxSpareServers";
message = "services.hydra.minSpareServers cannot be bigger than services.hydra.maxSpareServers";
}
];
@@ -311,6 +311,11 @@ in
)
];
systemd.slices.system-hydra = {
description = "Hydra Slice";
documentation = [ "file://${cfg.package}/share/doc/hydra/index.html" "https://nixos.org/hydra/manual/" ];
};
systemd.services.hydra-init =
{ wantedBy = [ "multi-user.target" ];
requires = lib.optional haveLocalDB "postgresql.service";
@@ -371,6 +376,7 @@ in
serviceConfig.User = "hydra";
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = true;
serviceConfig.Slice = "system-hydra.slice";
};
systemd.services.hydra-server =
@@ -389,6 +395,7 @@ in
User = "hydra-www";
PermissionsStartOnly = true;
Restart = "always";
Slice = "system-hydra.slice";
};
};
@@ -408,6 +415,7 @@ in
ExecStopPost = "${hydra-package}/bin/hydra-queue-runner --unlock";
User = "hydra-queue-runner";
Restart = "always";
Slice = "system-hydra.slice";
# Ensure we can get core dumps.
LimitCORE = "infinity";
@@ -430,6 +438,7 @@ in
User = "hydra";
Restart = "always";
WorkingDirectory = baseDir;
Slice = "system-hydra.slice";
};
};
@@ -442,6 +451,7 @@ in
serviceConfig =
{ ExecStart = "@${hydra-package}/bin/hydra-update-gc-roots hydra-update-gc-roots";
User = "hydra";
Slice = "system-hydra.slice";
};
startAt = "2,14:15";
};
@@ -455,6 +465,7 @@ in
serviceConfig =
{ ExecStart = "@${hydra-package}/bin/hydra-send-stats hydra-send-stats";
User = "hydra";
Slice = "system-hydra.slice";
};
};
@@ -474,6 +485,7 @@ in
User = "hydra-queue-runner";
Restart = "always";
RestartSec = 5;
Slice = "system-hydra.slice";
};
};
@@ -492,6 +504,7 @@ in
fi
'';
startAt = "*:0/5";
serviceConfig.Slice = "system-hydra.slice";
};
# Periodically compress build logs. The queue runner compresses
@@ -509,6 +522,7 @@ in
find ${baseDir}/build-logs -type f -name "*.drv" -mtime +3 -size +0c | xargs -r $compression --force --quiet
'';
startAt = "Sun 01:45";
serviceConfig.Slice = "system-hydra.slice";
};
services.postgresql.enable = lib.mkIf haveLocalDB true;