12 cfg = config.systemd.coredump;
13 systemd = config.systemd.package;
17 systemd.coredump.enable = mkOption {
21 Whether core dumps should be processed by
22 {command}`systemd-coredump`. If disabled, core dumps
23 appear in the current directory of the crashing process.
27 systemd.coredump.extraConfig = mkOption {
30 example = "Storage=journal";
32 Extra config options for systemd-coredump. See coredump.conf(5) man page
33 for available options.
41 systemd.additionalUpstreamSystemUnits = [
42 "systemd-coredump.socket"
43 "systemd-coredump@.service"
47 "systemd/coredump.conf".text = ''
52 # install provided sysctl snippets
53 "sysctl.d/50-coredump.conf".source =
54 # Fix systemd-coredump error caused by truncation of `kernel.core_pattern`
55 # when the `systemd` derivation name is too long. This works by substituting
56 # the path to `systemd` with a symlink that has a constant-length path.
58 # See: https://github.com/NixOS/nixpkgs/issues/213408
60 src = "${systemd}/example/sysctl.d/50-coredump.conf";
71 "sysctl.d/50-default.conf".source = "${systemd}/example/sysctl.d/50-default.conf";
74 users.users.systemd-coredump = {
75 uid = config.ids.uids.systemd-coredump;
76 group = "systemd-coredump";
78 users.groups.systemd-coredump = { };
82 boot.kernel.sysctl."kernel.core_pattern" = mkDefault "core";