nixos/coredump: migrate to RFC 42-style settings

Replace the free-form `systemd.coredump.extraConfig` option with a structured `systemd.coredump.settings.Coredump` submodule rendered via `utils.systemdUtils.lib.settingsToSections`, in line with RFC 42. A `mkRemovedOptionModule` entry points existing users at the new option, and the systemd-coredump NixOS test now exercises the new settings option by asserting the rendered `coredump.conf` contents.
This commit is contained in:
Jamie Magee
2026-05-03 14:27:49 -07:00
parent b3a443cd89
commit ab076fc22d
3 changed files with 37 additions and 12 deletions

View File

@@ -160,6 +160,8 @@
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
- `systemd.coredump.extraConfig` has been removed in favor of the structured [](#opt-systemd.coredump.settings.Coredump) option. Use `systemd.coredump.settings.Coredump` to set any `coredump.conf(5)` option directly. For example, replace `systemd.coredump.extraConfig = "Storage=journal";` with `systemd.coredump.settings.Coredump.Storage = "journal";`.
- `opentrack`, `slushload`, `synthesia`, `vtfedit`, `winbox`, `wineasio`, and `yabridge` use wineWow64Packages instead of wineWowPackages as wine versions >= 11.0 have deprecated wineWowPackages. As such, the prefixes for these packages are NOT backwards compatible and need to be regenerated with potential for data loss.
- []{#sec-release-26.05-incompatibilities-profiles-hardened-removed} `profiles/hardened` has been removed, because:

View File

@@ -11,6 +11,14 @@ let
systemd = config.systemd.package;
in
{
imports = [
(lib.mkRemovedOptionModule [
"systemd"
"coredump"
"extraConfig"
] "Use systemd.coredump.settings.Coredump instead.")
];
options = {
systemd.coredump.enable = lib.mkOption {
default = true;
@@ -22,13 +30,17 @@ in
'';
};
systemd.coredump.extraConfig = lib.mkOption {
default = "";
type = lib.types.lines;
example = "Storage=journal";
systemd.coredump.settings.Coredump = lib.mkOption {
default = { };
type = lib.types.submodule {
freeformType = lib.types.attrsOf utils.systemdUtils.unitOptions.unitOption;
};
example = {
Storage = "journal";
};
description = ''
Extra config options for systemd-coredump. See {manpage}`coredump.conf(5)` man page
for available options.
Settings for systemd-coredump. See {manpage}`coredump.conf(5)` for
available options.
'';
};
};
@@ -42,10 +54,7 @@ in
];
environment.etc = {
"systemd/coredump.conf".text = ''
[Coredump]
${cfg.extraConfig}
'';
"systemd/coredump.conf".text = utils.systemdUtils.lib.settingsToSections cfg.settings;
# install provided sysctl snippets
"sysctl.d/50-coredump.conf".source =

View File

@@ -21,10 +21,19 @@ in
maintainers = [ ];
};
nodes.machine1 = { pkgs, lib, ... }: commonConfig;
nodes.machine1 =
{ pkgs, lib, ... }:
{
imports = [ commonConfig ];
systemd.coredump.settings.Coredump = {
Storage = "journal";
ProcessSizeMax = "0";
};
};
nodes.machine2 =
{ pkgs, lib, ... }:
lib.recursiveUpdate commonConfig {
{
imports = [ commonConfig ];
systemd.coredump.enable = false;
systemd.package = pkgs.systemd.override {
withCoredump = false;
@@ -39,6 +48,11 @@ in
machine1.wait_until_succeeds("coredumpctl list | grep crasher", timeout=10)
machine1.fail("stat /var/lib/crasher/core*")
with subtest("settings.Coredump renders coredump.conf"):
machine1.succeed("grep -F '[Coredump]' /etc/systemd/coredump.conf")
machine1.succeed("grep -F 'Storage=journal' /etc/systemd/coredump.conf")
machine1.succeed("grep -F 'ProcessSizeMax=0' /etc/systemd/coredump.conf")
with subtest("systemd-coredump disabled"):
machine2.systemctl("start crasher");
machine2.wait_until_succeeds("stat /var/lib/crasher/core*", timeout=10)