about summary refs log tree commit diff
path: root/nixos/modules/installer
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-05-08 12:07:29 +0000
committerAlyssa Ross <hi@alyssa.is>2023-05-09 14:15:10 +0000
commite5e49df7fd02afb7cbf35f713ebcb9ded02ce1b4 (patch)
tree390efd4cc0e5c37276c2552ba6379cdc0f789019 /nixos/modules/installer
parent096cdeeac406a12886f49eeadd48fd938d28c156 (diff)
nixos/netboot: add squashfsCompression option
This is copied from isoImage.squashfsCompression.  It's useful to be
able to customise, as iteration cycles are very slow with xz, and
subjectively systems booted with less efficiently compressed squashfs
stores appear to have faster reads (although I didn't test that
scientificly so there could be other factors).
Diffstat (limited to 'nixos/modules/installer')
-rw-r--r--nixos/modules/installer/netboot/netboot.nix15
1 files changed, 15 insertions, 0 deletions
diff --git a/nixos/modules/installer/netboot/netboot.nix b/nixos/modules/installer/netboot/netboot.nix
index 03bb529cd8510..a55c0ab2d6557 100644
--- a/nixos/modules/installer/netboot/netboot.nix
+++ b/nixos/modules/installer/netboot/netboot.nix
@@ -8,6 +8,20 @@ with lib;
 {
   options = {
 
+    netboot.squashfsCompression = mkOption {
+      default = with pkgs.stdenv.hostPlatform; "xz -Xdict-size 100% "
+                + lib.optionalString isx86 "-Xbcj x86"
+                # Untested but should also reduce size for these platforms
+                + lib.optionalString isAarch "-Xbcj arm"
+                + lib.optionalString (isPower && is32bit && isBigEndian) "-Xbcj powerpc"
+                + lib.optionalString (isSparc) "-Xbcj sparc";
+      description = lib.mdDoc ''
+        Compression settings to use for the squashfs nix store.
+      '';
+      example = "zstd -Xcompression-level 6";
+      type = types.str;
+    };
+
     netboot.storeContents = mkOption {
       example = literalExpression "[ pkgs.stdenv ]";
       description = lib.mdDoc ''
@@ -77,6 +91,7 @@ with lib;
     # Create the squashfs image that contains the Nix store.
     system.build.squashfsStore = pkgs.callPackage ../../../lib/make-squashfs.nix {
       storeContents = config.netboot.storeContents;
+      comp = config.netboot.squashfsCompression;
     };