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 18211b960809..2241876baf7f 100644 --- a/nixos/modules/system/boot/systemd/coredump.nix +++ b/nixos/modules/system/boot/systemd/coredump.nix @@ -6,17 +6,23 @@ ... }: -with lib; - let cfg = config.systemd.coredump; systemd = config.systemd.package; in { + imports = [ + (lib.mkRemovedOptionModule [ + "systemd" + "coredump" + "extraConfig" + ] "Use systemd.coredump.settings.Coredump instead.") + ]; + options = { - systemd.coredump.enable = mkOption { + systemd.coredump.enable = lib.mkOption { default = true; - type = types.bool; + type = lib.types.bool; description = '' Whether core dumps should be processed by {command}`systemd-coredump`. If disabled, core dumps @@ -24,30 +30,31 @@ in ''; }; - systemd.coredump.extraConfig = mkOption { - default = ""; - type = 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. ''; }; }; - config = mkMerge [ + config = lib.mkMerge [ - (mkIf cfg.enable { + (lib.mkIf cfg.enable { systemd.additionalUpstreamSystemUnits = [ "systemd-coredump.socket" "systemd-coredump@.service" ]; 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 = @@ -76,8 +83,8 @@ in users.groups.systemd-coredump = { }; }) - (mkIf (!cfg.enable) { - boot.kernel.sysctl."kernel.core_pattern" = mkDefault "core"; + (lib.mkIf (!cfg.enable) { + boot.kernel.sysctl."kernel.core_pattern" = lib.mkDefault "core"; }) ]; 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)