diff --git a/modules/config/minimal-system.nix b/modules/config/minimal-system.nix index e77476b..2963893 100644 --- a/modules/config/minimal-system.nix +++ b/modules/config/minimal-system.nix @@ -5,6 +5,7 @@ (final: prev: { composefs = final.callPackage ../../pkgs/composefs.nix { inherit prev; }; + erofs-utils = final.callPackage ../../pkgs/erofs-utils.nix { inherit prev; }; qemu_tiny = final.callPackage ../../pkgs/qemu.nix { inherit prev; }; systemdUkify = final.callPackage ../../pkgs/systemd-ukify.nix { inherit prev; }; diff --git a/modules/image/disk/builder.nix b/modules/image/disk/builder.nix index 39f321c..b1d0f3f 100644 --- a/modules/image/disk/builder.nix +++ b/modules/image/disk/builder.nix @@ -46,8 +46,10 @@ let split = true; mkfsOptions = lib.mkIf config.image.compress { erofs = [ - "-zlz4hc,level=12" - "-Efragments,dedupe,ztailpacking" + "-zzstd,6" # Zstd compression + "-T0" # Fixed timestamp for all files + "-C1048576" # 1 MiB cluster size + "-Efragments,dedupe,ztailpacking" # Extra features ]; }; partitions = initialPartitions; diff --git a/pkgs/erofs-utils.nix b/pkgs/erofs-utils.nix new file mode 100644 index 0000000..817c20b --- /dev/null +++ b/pkgs/erofs-utils.nix @@ -0,0 +1,10 @@ +{ prev, ... }: + +# Build mkfs.erofs with zstd support +prev.erofs-utils.overrideAttrs (final: p: { + buildInputs = p.buildInputs ++ [ prev.zstd ]; + configureFlags = p.configureFlags ++ [ + "--enable-multithreading" + "--enable-zstd" + ]; +})