nixos/coredump: migrate to RFC 42-style settings (#497098)

This commit is contained in:
nikstur
2026-05-04 16:48:39 +00:00
committed by GitHub
3 changed files with 43 additions and 20 deletions
@@ -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:
+25 -18
View File
@@ -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";
})
];
+16 -2
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)