nixos/github-runners: use mkMerge for serviceConfig

The `serviceOverrides` module option is commonly used to loosen the
systemd unit's hardening. This commit merges the `serviceConfig` with
`mkMerge` instead of using the update operator `//` which discards all
existing values on conflict. To avoid a breaking change which requires
defining each option with a higher priority (e.g., through `mkForce`),
this commit prefixes hardening values with `mkDefault`.

Notable exceptions are list hardening options which use `mkBefore`
instead of `mkDefault`. This allows for easy extension of the existing
settings. Resetting redefinitions are still possible through `mkForce`.
This commit is contained in:
Vincent Haupert
2023-01-08 01:42:01 +01:00
parent aca6ac3269
commit 66dbf9b199
2 changed files with 35 additions and 34 deletions

View File

@@ -127,10 +127,11 @@ with lib;
serviceOverrides = mkOption {
type = types.attrs;
description = lib.mdDoc ''
Overrides for the systemd service. Can be used to adjust the sandboxing options.
Modify the systemd service. Can be used to, e.g., adjust the sandboxing options.
'';
example = {
ProtectHome = false;
RestrictAddressFamilies = [ "AF_PACKET" ];
};
default = {};
};