From 64589bcefaa6f0225327525de602f5754781583d Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Tue, 7 Jun 2022 14:05:59 +0200 Subject: [PATCH] nixos/netboot: use `makeInitrdNG` to shrink ramdisk size Previously, `makeInitrd` added the whole closure of the squashfs derivation to initrd. This closure contains the squashfs.img and some store paths which are still referenced by the compressed squashfs.img. These extra store paths are unused in stage 1. With `makeInitrdNG` only the squashfs.img is added to the initrd. (`makeInitrdNG` only resolves shared library references instead of the whole closure). This shrinks the netboot ramdisk by ~6% for a minimal system and significantly decreases the size of the uncompressed root filesystem in stage 1. --- nixos/modules/installer/netboot/netboot.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/installer/netboot/netboot.nix b/nixos/modules/installer/netboot/netboot.nix index a459e7304cd4..17247f7125ac 100644 --- a/nixos/modules/installer/netboot/netboot.nix +++ b/nixos/modules/installer/netboot/netboot.nix @@ -81,7 +81,7 @@ with lib; # Create the initrd - system.build.netbootRamdisk = pkgs.makeInitrd { + system.build.netbootRamdisk = pkgs.makeInitrdNG { inherit (config.boot.initrd) compressor; prepend = [ "${config.system.build.initialRamdisk}/initrd" ];