about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorK900 <me@0upti.me>2022-08-03 19:57:55 +0300
committerGitHub <noreply@github.com>2022-08-03 19:57:55 +0300
commiteabbad8af1947336d66e63073e75759049e78326 (patch)
tree9deb01f89a7812db44ebf67de14a1360db824b6d /nixos
parenteb4ca541853393da68862c898d011d2cae0dd21f (diff)
parentde93795b4655bb9d7fab75290474f584ce67582d (diff)
Merge pull request #185036 from K900/goblinization
make-initrd-ng: parse ELFs ourselves instead of shelling out to patchelf and friends
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/system/boot/systemd/initrd.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/systemd/initrd.nix b/nixos/modules/system/boot/systemd/initrd.nix
index 59cdc3077b16a..4c12088b41a69 100644
--- a/nixos/modules/system/boot/systemd/initrd.nix
+++ b/nixos/modules/system/boot/systemd/initrd.nix
@@ -129,6 +129,7 @@ let
   initialRamdisk = pkgs.makeInitrdNG {
     name = "initrd-${kernel-name}";
     inherit (config.boot.initrd) compressor compressorArgs prepend;
+    inherit (cfg) strip;
 
     contents = map (path: { object = path; symlink = ""; }) (subtractLists cfg.suppressedStorePaths cfg.storePaths)
       ++ mapAttrsToList (_: v: { object = v.source; symlink = v.target; }) (filterAttrs (_: v: v.enable) cfg.contents);
@@ -169,6 +170,19 @@ in {
       default = [];
     };
 
+    strip = mkOption {
+      description = lib.mdDoc ''
+        Whether to completely strip executables and libraries copied to the initramfs.
+
+        Setting this to false may save on the order of 30MiB on the
+        machine building the system (by avoiding a binutils
+        reference), at the cost of ~1MiB of initramfs size. This puts
+        this option firmly in the territory of micro-optimisation.
+      '';
+      type = types.bool;
+      default = true;
+    };
+
     extraBin = mkOption {
       description = lib.mdDoc ''
         Tools to add to /bin