Skip to content

Commit

Permalink
lenovo-x1: compress images using zstd
Browse files Browse the repository at this point in the history
This avoids having images on the builders and cache take too much
storage.

Signed-off-by: Humaid Alqasimi <humaid.alqassimi@tii.ae>
  • Loading branch information
humaidq-tii authored and brianmcgillion committed Jun 14, 2024
1 parent fb42e01 commit 17d32a6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
10 changes: 8 additions & 2 deletions modules/disko/lenovo-x1-disko-basic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Example to create a bios compatible gpt partition
# To use this example, you will need to specify a device i.e.
# { disko.devices.disk1.device = "/dev/sda"; }
{
{pkgs, ...}: {
disko.devices = {
disk.disk1 = {
type = "disk";
Expand Down Expand Up @@ -59,5 +59,11 @@
};
};
};
disko.memSize = 2048;
disko = {
memSize = 2048;
extraPostVM = ''
${pkgs.zstd}/bin/zstd --compress $out/*raw
rm $out/*raw
'';
};
}
2 changes: 1 addition & 1 deletion packages/installer/ghaf-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ read -r -p "Device name [e.g. /dev/nvme0n1]: " DEVICE_NAME
read -r -p 'WARNING: Next command will destroy all previous data from your device, press Enter to proceed. '

echo "Installing..."
dd if=@imagePath@ of="${DEVICE_NAME}" bs=32M status=progress
zstdcat @imagePath@ | dd of="${DEVICE_NAME}" bs=32M status=progress

echo ""
echo "Installation done. Please remove the installation media and reboot"
4 changes: 3 additions & 1 deletion targets/lenovo-x1-installer/flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
name = "lenovo-x1-carbon";
system = "x86_64-linux";
installer = generation: variant: let
imagePath = self.packages.x86_64-linux."${name}-${generation}-${variant}" + "/disk1.raw";
imagePath = self.packages.x86_64-linux."${name}-${generation}-${variant}" + "/disk1.raw.zst";
hostConfiguration = lib.nixosSystem {
inherit system;
modules = [
Expand Down Expand Up @@ -39,6 +39,8 @@
installScript
];

isoImage.squashfsCompression = "zstd -Xcompression-level 3";

# NOTE: Stop nixos complains about "warning:
# mdadm: Neither MAILADDR nor PROGRAM has been set. This will cause the `mdmon` service to crash."
# https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/profiles/installation-device.nix#L112
Expand Down

0 comments on commit 17d32a6

Please sign in to comment.