summary refs log tree commit diff
path: root/pkgs/os-specific/linux/systemd/default.nix
diff options
context:
space:
mode:
authorSergei Trofimovich <slyich@gmail.com>2022-04-23 18:49:59 +0100
committerSergei Trofimovich <slyich@gmail.com>2022-04-23 18:54:48 +0100
commit77a189e066a839b1c8bb7cb8c125d434d15854ac (patch)
treeac6ca789665af07642ea74cccdee929795caf337 /pkgs/os-specific/linux/systemd/default.nix
parentf684f5a9553e54ce41ca38e87c1aac0231a8a34a (diff)
downloadnixpkgs-77a189e066a839b1c8bb7cb8c125d434d15854ac.tar
nixpkgs-77a189e066a839b1c8bb7cb8c125d434d15854ac.tar.gz
nixpkgs-77a189e066a839b1c8bb7cb8c125d434d15854ac.tar.bz2
nixpkgs-77a189e066a839b1c8bb7cb8c125d434d15854ac.tar.lz
nixpkgs-77a189e066a839b1c8bb7cb8c125d434d15854ac.tar.xz
nixpkgs-77a189e066a839b1c8bb7cb8c125d434d15854ac.tar.zst
nixpkgs-77a189e066a839b1c8bb7cb8c125d434d15854ac.zip
systemd: disable EFI stripping
In Issue #169693 we found out that systemd-bootaa64.efi does not have
required `#### LoaderInfo: systemd-boot 250.4 ####` marking.

It is destroyed by `nixpkgs`'s `_doStrip` hook (part of `fixupOutputHooks`).
It makes sense as PE32+ is a bit different from ELF where `.sdmagic` section
is inserted.

The change avoids stripping EFI files altogether by moving them out
of default strip directories of _doStrip for the time while `fixupPhase`
is running.

Closes: https://github.com/NixOS/nixpkgs/issues/169693
Diffstat (limited to 'pkgs/os-specific/linux/systemd/default.nix')
-rw-r--r--pkgs/os-specific/linux/systemd/default.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix
index e130abbf27f..a32083850b5 100644
--- a/pkgs/os-specific/linux/systemd/default.nix
+++ b/pkgs/os-specific/linux/systemd/default.nix
@@ -666,6 +666,18 @@ stdenv.mkDerivation {
     rm -rf $out/share/doc
   '';
 
+  # Avoid *.EFI binary stripping. At least on aarch64-linux strip
+  # removes too much from PE32+ files:
+  #   https://github.com/NixOS/nixpkgs/issues/169693
+  # The hack is to move EFI file out of lib/ before doStrip
+  # run and return it after doStrip run.
+  preFixup = lib.optionalString withEfi ''
+    mv $out/lib/systemd/boot/efi $out/dont-strip-me
+  '';
+  postFixup = lib.optionalString withEfi ''
+    mv $out/dont-strip-me $out/lib/systemd/boot/efi
+  '';
+
   passthru = {
     # The interface version prevents NixOS from switching to an
     # incompatible systemd at runtime.  (Switching across reboots is