some security patches + buzz updates

This commit is contained in:
ari committed 2026-09-20 20:55:17 -04:00
1 parent 7a3d64e645
commit df46627173
17 files changed
+62 -36

No files matched your search

@@ -44,6 +44,10 @@ If adding a new per-service option:
- Each group gets **one** systemd unit (`container-services-<group>.service`) that manages the whole stack
- Group units are ordered after `container-networks.target`, so any network declared in
`skyg.nixos.common.containers.networks` exists before a stack starts
- Each unit puts the runtime CLI (`pkgs.podman`/`pkgs.docker`) and `coreutils` on `PATH`:
`podman-compose` shells out to a bare `podman`, and NixOS systemd services do not inherit
`/run/current-system/sw/bin` (Docker worked without this only because `docker-compose` v2
talks to the socket directly)
- Custom files are collected and written by a separate unit (`container-services-<group>-files.service`)
- Env file changes trigger a path unit that restarts the stack (`container-services-<group>-env-reload.*`)
- Compose files are rendered to the store and staged to `/var/lib/container-services/<group>/compose.yml`
@@ -13,6 +13,8 @@ let
composeBin = containerLib.composeBin containersCfg.runtime;
runtimeService = containerLib.runtimeService isDocker;
runtimeBin = containerLib.runtimeBin isDocker;
# Put the runtime CLI on each unit's PATH (podman-compose shells out to `podman`).
runtimePkg = if isDocker then pkgs.docker else pkgs.podman;
enabledGroups = lib.filterAttrs (_: g: g.enable) cfg;
autoUpdateGroups = lib.filterAttrs (_: g: g.autoUpdate.enable) enabledGroups;
@@ -82,7 +84,7 @@ in
in
lib.nameValuePair
"container-services-${groupName}"
(systemdLib.mkSystemdService groupName grpCfg effectiveComposeFile overridesFile composeBin runtimeService hasFiles))
(systemdLib.mkSystemdService groupName grpCfg effectiveComposeFile overridesFile composeBin runtimeService runtimePkg hasFiles))
enabledGroups
// lib.foldAttrs lib.recursiveUpdate { } (
lib.mapAttrsToList
@@ -102,7 +104,7 @@ in
)
// lib.mapAttrs'
(groupName: grpCfg:
let units = systemdLib.mkUpdateUnits groupName grpCfg (mkOverridesFileFor groupName grpCfg) composeBin runtimeBin;
let units = systemdLib.mkUpdateUnits groupName grpCfg (mkOverridesFileFor groupName grpCfg) composeBin runtimeBin runtimePkg;
in lib.nameValuePair "container-services-${groupName}-update" units.services."container-services-${groupName}-update")
autoUpdateGroups;
@@ -119,7 +121,7 @@ in
systemd.timers =
lib.mapAttrs'
(groupName: grpCfg:
let units = systemdLib.mkUpdateUnits groupName grpCfg (mkOverridesFileFor groupName grpCfg) composeBin runtimeBin;
let units = systemdLib.mkUpdateUnits groupName grpCfg (mkOverridesFileFor groupName grpCfg) composeBin runtimeBin runtimePkg;
in lib.nameValuePair "container-services-${groupName}-update" units.timers."container-services-${groupName}-update")
autoUpdateGroups;
};
@@ -74,6 +74,8 @@ rec {
"container-services-${groupName}-files" = {
description = "Write custom files for container service group '${groupName}'";
before = [ "container-services-${groupName}.service" ];
# The script uses bare mkdir/cat/chmod/dirname, so coreutils must be on PATH.
path = [ pkgs.coreutils ];
serviceConfig = {
Type = "oneshot";
ExecStart = scriptFile;
@@ -30,6 +30,12 @@
description = "Seconds to wait for 'compose down' before forcibly killing containers.";
};
timeoutStartSec = lib.mkOption {
type = lib.types.int;
default = 120;
description = "Seconds to wait for 'compose up -d' (image pulls included) before the unit is considered failed.";
};
composeFile = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
@@ -2,7 +2,8 @@
{
# Create a systemd oneshot service that manages the compose stack.
mkSystemdService = groupName: grpCfg: composeFile: overridesFile: composeBin: runtimeService: hasFiles:
# `runtimePkg` is put on PATH because podman-compose shells out to `podman`.
mkSystemdService = groupName: grpCfg: composeFile: overridesFile: composeBin: runtimeService: runtimePkg: hasFiles:
let
stateDir = grpCfg.stateDir;
fileServiceDep = if hasFiles then "container-services-${groupName}-files.service" else null;
@@ -25,12 +26,13 @@
++ lib.optional hasFiles fileServiceDep;
requires = [ runtimeService ]
++ lib.optional hasFiles fileServiceDep;
path = [ runtimePkg pkgs.coreutils ];
startLimitIntervalSec = 300; # 5 minutes window
startLimitBurst = 6; # allow 6 failures before giving up
serviceConfig = {
Restart = "on-failure";
RestartSec = "15s";
TimeoutStartSec = "120s";
TimeoutStartSec = grpCfg.timeoutStartSec;
Type = "oneshot";
RemainAfterExit = true;
TimeoutStopSec = grpCfg.timeoutStopSec;
@@ -44,7 +46,7 @@
};
# Create the update service + timer for a group's autoUpdate config.
mkUpdateUnits = groupName: grpCfg: overridesFile: composeBin: runtimeBin:
mkUpdateUnits = groupName: grpCfg: overridesFile: composeBin: runtimeBin: runtimePkg:
let
auCfg = grpCfg.autoUpdate;
stateDir = grpCfg.stateDir;
@@ -60,6 +62,7 @@
description = "Pull latest images and recreate container service group '${groupName}'";
after = [ "container-services-${groupName}.service" ];
requires = [ "container-services-${groupName}.service" ];
path = [ runtimePkg pkgs.coreutils ];
serviceConfig = {
Type = "oneshot";
ExecStart =