systemd-coredump: temporary fix
authorJulien Moutinho <julm+sourcephile-nix@sourcephile.fr>
Sat, 30 Oct 2021 08:33:46 +0000 (10:33 +0200)
committerJulien Moutinho <julm+sourcephile-nix@sourcephile.fr>
Sat, 30 Oct 2021 08:33:46 +0000 (10:33 +0200)
flake.nix
nixpkgs/patches/systemd-coredump.diff [new file with mode: 0644]

index 652cae729256482ff0af98a88a117df7332f7d02..da08a6890ae511e8e4674f5946af62f5cefc17de 100644 (file)
--- a/flake.nix
+++ b/flake.nix
@@ -27,6 +27,7 @@ outputs = inputs: let
   remoteNixpkgsPatches = import nixpkgs/patches.nix;
   localNixpkgsPatches = [
     nixpkgs/patches/sourcehut.diff
+    nixpkgs/patches/systemd-coredump.diff
   ];
   originPkgs = inputs.nixpkgs.legacyPackages."x86_64-linux";
   nixpkgs = originPkgs.applyPatches {
diff --git a/nixpkgs/patches/systemd-coredump.diff b/nixpkgs/patches/systemd-coredump.diff
new file mode 100644 (file)
index 0000000..bbbfe1b
--- /dev/null
@@ -0,0 +1,31 @@
+diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
+index 77997ac7686..b1d87e6253a 100644
+--- a/nixos/modules/system/boot/systemd.nix
++++ b/nixos/modules/system/boot/systemd.nix
+@@ -1018,6 +1018,18 @@ in
+           [Coredump]
+           ${config.systemd.coredump.extraConfig}
+         '';
++      # CORENAME_MAX_SIZE being only 128, overflowing happens
++      # when the Nix store path includes a cross-compiling suffix,
++      # hence this workaround to use a shorter path.
++      "systemd/coredump".source = "${systemd}/lib/systemd/systemd-coredump";
++      "sysctl.d/50-coredump.conf".source = pkgs.runCommand "50-coredump.conf" {
++          preferLocalBuild = true;
++          coredumpConf = "${systemd}/example/sysctl.d/50-coredump.conf";
++        } ''
++          substitute $coredumpConf $out \
++            --replace 'core_pattern=|${systemd}/lib/systemd/systemd-coredump' \
++                      'core_pattern=|/etc/systemd/coredump'
++        '';
+       "systemd/logind.conf".text = ''
+         [Login]
+@@ -1034,7 +1046,6 @@ in
+       '';
+       # install provided sysctl snippets
+-      "sysctl.d/50-coredump.conf".source = "${systemd}/example/sysctl.d/50-coredump.conf";
+       "sysctl.d/50-default.conf".source = "${systemd}/example/sysctl.d/50-default.conf";
+       "tmpfiles.d".source = (pkgs.symlinkJoin {