From ab076fc22ddb751249a518de8b3217e1097bcb82 Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Sun, 3 May 2026 14:27:49 -0700 Subject: [PATCH] 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. --- .../manual/release-notes/rl-2605.section.md | 2 ++ .../modules/system/boot/systemd/coredump.nix | 29 ++++++++++++------- nixos/tests/systemd-coredump.nix | 18 ++++++++++-- 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/nixos/doc/manual/release-notes/rl-2605.section.md b/nixos/doc/manual/release-notes/rl-2605.section.md index a652c7a3657c..e2eff27bc5ec 100644 --- a/nixos/doc/manual/release-notes/rl-2605.section.md +++ b/nixos/doc/manual/release-notes/rl-2605.section.md @@ -160,6 +160,8 @@ +- `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: diff --git a/nixos/modules/system/boot/systemd/coredump.nix b/nixos/modules/system/boot/systemd/coredump.nix index c70e0004ca25..2241876baf7f 100644 --- a/nixos/modules/system/boot/systemd/coredump.nix +++ b/nixos/modules/system/boot/systemd/coredump.nix @@ -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 = diff --git a/nixos/tests/systemd-coredump.nix b/nixos/tests/systemd-coredump.nix index 9ab7555279d1..58db509535ff 100644 --- a/nixos/tests/systemd-coredump.nix +++ b/nixos/tests/systemd-coredump.nix @@ -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)