diff --git a/nixos/doc/manual/release-notes/rl-1909.xml b/nixos/doc/manual/release-notes/rl-1909.xml
index a33027bdbd19..4d9229becc97 100644
--- a/nixos/doc/manual/release-notes/rl-1909.xml
+++ b/nixos/doc/manual/release-notes/rl-1909.xml
@@ -739,7 +739,7 @@
- This also configures the kernel to pass coredumps to systemd-coredump,
+ This also configures the kernel to pass core dumps to systemd-coredump,
and restricts the SysRq key combinations to the sync command only.
These sysctl snippets can be found in /etc/sysctl.d/50-*.conf,
and overridden via boot.kernel.sysctl
@@ -748,12 +748,15 @@
- Coredumps are now acquired by systemd-coredump by default.
- systemd-coredump behaviour can still be modified via
- .
- To stick to the old behaviour (having the kernel dump to a file called core
- in the working directory), without piping it through systemd-coredump, set
- to "core".
+ Core dumps are now processed by systemd-coredump
+ by default. systemd-coredump behaviour can
+ still be modified via
+ . To stick to the
+ old behaviour (having the kernel dump to a file called
+ core in the working directory), without piping
+ it through systemd-coredump, set
+ to
+ false.
diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix
index 564c53465e3a..df8ebe505846 100644
--- a/nixos/modules/rename.nix
+++ b/nixos/modules/rename.nix
@@ -233,7 +233,6 @@ with lib;
(mkRemovedOptionModule [ "services" "mysql" "rootPassword" ] "Use socket authentication or set the password outside of the nix store.")
(mkRemovedOptionModule [ "services" "zabbixServer" "dbPassword" ] "Use services.zabbixServer.database.passwordFile instead.")
(mkRemovedOptionModule [ "systemd" "generator-packages" ] "Use systemd.packages instead.")
- (mkRemovedOptionModule [ "systemd" "coredump" "enable" ] "Enabled by default. Set boot.kernel.sysctl.\"kernel.core_pattern\" = \"core\"; to disable.")
# ZSH
(mkRenamedOptionModule [ "programs" "zsh" "enableSyntaxHighlighting" ] [ "programs" "zsh" "syntaxHighlighting" "enable" ])
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index 5cf437bfbcbe..669eb6a7056b 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -546,6 +546,16 @@ in
'';
};
+ systemd.coredump.enable = mkOption {
+ default = true;
+ type = types.bool;
+ description = ''
+ Whether core dumps should be processed by
+ systemd-coredump. If disabled, core dumps
+ appear in the current directory of the crashing process.
+ '';
+ };
+
systemd.coredump.extraConfig = mkOption {
default = "";
type = types.lines;
@@ -983,6 +993,10 @@ in
# Don't bother with certain units in containers.
systemd.services.systemd-remount-fs.unitConfig.ConditionVirtualization = "!container";
systemd.services.systemd-random-seed.unitConfig.ConditionVirtualization = "!container";
+
+ boot.kernel.sysctl = mkIf (!cfg.coredump.enable) {
+ "kernel.core_pattern" = "core";
+ };
};
# FIXME: Remove these eventually.