about summary refs log tree commit diff
path: root/nixos/modules/system/boot/coredump.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-03-25 17:29:02 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-03-25 17:29:29 +0100
commit54ca7e9f7514f97d4cd7d7d1a29f7e3ccc73683e (patch)
tree7085238c16dd84c9947788bcdee4284121fd8fc6 /nixos/modules/system/boot/coredump.nix
parent5455a71414dee91d5485487c6bee6d787b54ba19 (diff)
downloadnixlib-54ca7e9f7514f97d4cd7d7d1a29f7e3ccc73683e.tar
nixlib-54ca7e9f7514f97d4cd7d7d1a29f7e3ccc73683e.tar.gz
nixlib-54ca7e9f7514f97d4cd7d7d1a29f7e3ccc73683e.tar.bz2
nixlib-54ca7e9f7514f97d4cd7d7d1a29f7e3ccc73683e.tar.lz
nixlib-54ca7e9f7514f97d4cd7d7d1a29f7e3ccc73683e.tar.xz
nixlib-54ca7e9f7514f97d4cd7d7d1a29f7e3ccc73683e.tar.zst
nixlib-54ca7e9f7514f97d4cd7d7d1a29f7e3ccc73683e.zip
Restore core dumps
Systemd 229 sets kernel.core_pattern to "|/bin/false" by default,
unless systemd-coredump is enabled. Revert back to the default of
writing "core" in the current directory.
Diffstat (limited to 'nixos/modules/system/boot/coredump.nix')
-rw-r--r--nixos/modules/system/boot/coredump.nix27
1 files changed, 16 insertions, 11 deletions
diff --git a/nixos/modules/system/boot/coredump.nix b/nixos/modules/system/boot/coredump.nix
index 25b11ed9c8a9..3d80da9e4571 100644
--- a/nixos/modules/system/boot/coredump.nix
+++ b/nixos/modules/system/boot/coredump.nix
@@ -33,19 +33,24 @@ with lib;
 
   };
 
-  config = mkIf config.systemd.coredump.enable {
+  config = mkMerge [
+    (mkIf config.systemd.coredump.enable {
 
-    environment.etc."systemd/coredump.conf".text =
-      ''
-        [Coredump]
-        ${config.systemd.coredump.extraConfig}
-      '';
+      environment.etc."systemd/coredump.conf".text =
+        ''
+          [Coredump]
+          ${config.systemd.coredump.extraConfig}
+        '';
 
-    # Have the kernel pass core dumps to systemd's coredump helper binary.
-    # From systemd's 50-coredump.conf file. See:
-    # <https://github.com/systemd/systemd/blob/v218/sysctl.d/50-coredump.conf.in>
-    boot.kernel.sysctl."kernel.core_pattern" = "|${pkgs.systemd}/lib/systemd/systemd-coredump %p %u %g %s %t %e";
+      # Have the kernel pass core dumps to systemd's coredump helper binary.
+      # From systemd's 50-coredump.conf file. See:
+      # <https://github.com/systemd/systemd/blob/v218/sysctl.d/50-coredump.conf.in>
+      boot.kernel.sysctl."kernel.core_pattern" = "|${pkgs.systemd}/lib/systemd/systemd-coredump %p %u %g %s %t %e";
+    })
 
-  };
+    (mkIf (!config.systemd.coredump.enable) {
+      boot.kernel.sysctl."kernel.core_pattern" = mkDefault "core";
+    })
+  ];
 
 }