summaryrefslogtreecommitdiffstats
path: root/nixos/modules
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-01-30 21:26:21 +0100
committerGitHub <noreply@github.com>2023-01-30 21:26:21 +0100
commitcd47b8e4233b8e49b2c31b696551ffaf8ed8c61e (patch)
treee61131cbdd177ea940c93b709a48e29590d0f095 /nixos/modules
parent31931ffc350ef628e264c01b7cd21c7b92390bc9 (diff)
parent7f35c8b2ac51c9c93abaa4eaa23f4ac39e5db5a5 (diff)
Merge pull request #213445 from Majiir/fix-systemd-coredump-truncation
nixos/systemd/coredump: fix kernel.core_pattern truncation
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/system/boot/systemd/coredump.nix16
1 files changed, 15 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/systemd/coredump.nix b/nixos/modules/system/boot/systemd/coredump.nix
index c2ca973d3807..03ef00e5683c 100644
--- a/nixos/modules/system/boot/systemd/coredump.nix
+++ b/nixos/modules/system/boot/systemd/coredump.nix
@@ -44,7 +44,21 @@ in {
'';
# install provided sysctl snippets
- "sysctl.d/50-coredump.conf".source = "${systemd}/example/sysctl.d/50-coredump.conf";
+ "sysctl.d/50-coredump.conf".source =
+ # Fix systemd-coredump error caused by truncation of `kernel.core_pattern`
+ # when the `systemd` derivation name is too long. This works by substituting
+ # the path to `systemd` with a symlink that has a constant-length path.
+ #
+ # See: https://github.com/NixOS/nixpkgs/issues/213408
+ pkgs.substitute {
+ src = "${systemd}/example/sysctl.d/50-coredump.conf";
+ replacements = [
+ "--replace"
+ "${systemd}"
+ "${pkgs.symlinkJoin { name = "systemd"; paths = [ systemd ]; }}"
+ ];
+ };
+
"sysctl.d/50-default.conf".source = "${systemd}/example/sysctl.d/50-default.conf";
};