More minimization work
Some checks failed
ci/woodpecker/push/ci Pipeline failed

This commit is contained in:
Daniel Lundin 2024-10-13 23:39:56 +02:00
parent ac4309657b
commit 9470683ac7
Signed by: dln
SSH key fingerprint: SHA256:dQy1Xj3UiqJYpKR5ggQ2bxgz4jCH8IF+k3AB8o0kmdI
7 changed files with 47 additions and 17 deletions

6
flake.lock generated
View file

@ -69,11 +69,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1728492678,
"narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=",
"lastModified": 1728888510,
"narHash": "sha256-nsNdSldaAyu6PE3YUA+YQLqUDJh+gRbBooMMekZJwvI=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "5633bcff0c6162b9e4b5f1264264611e950c8ec7",
"rev": "a3c0b3b21515f74fd2665903d4ce6bc4dc81c77c",
"type": "github"
},
"original": {

View file

@ -36,15 +36,18 @@
{
nativeBuildInputs = with pkgs; [
erofs-utils
xz
zstd
];
}
''
mkdir -p $out
xz -1 -cz ${config.system.build.uki}/${config.system.boot.loader.ukiFile} \
> $out/${config.system.boot.loader.ukiFile}.xz
xz -1 -cz ${config.system.build.image}/${config.boot.uki.name}_${config.system.image.version}.store.raw \
> $out/${config.boot.uki.name}_${config.system.image.version}.img.xz
cp ${config.system.build.image}/${config.boot.uki.name}_${config.system.image.version}.store.raw $out/
zstd -9 ${config.system.build.uki}/${config.system.boot.loader.ukiFile} \
-o $out/${config.system.boot.loader.ukiFile}.zst
zstd -9 ${config.system.build.image}/${config.boot.uki.name}_${config.system.image.version}.store.raw \
-o $out/${config.boot.uki.name}_${config.system.image.version}.img.zst
'';
# Prepare a ready-to-boot disk image.
@ -56,20 +59,27 @@
pkgs.runCommand "update-${config.system.image.version}"
{
nativeBuildInputs = with pkgs; [
erofs-utils
qemu
zstd
];
}
''
mkdir -p $out
cp ${config.system.build.image}/${config.boot.uki.name}_${config.system.image.version}.raw $out/
qemu-img convert -f raw -O qcow2 -C ${config.system.build.image}/${config.boot.uki.name}_${config.system.image.version}.raw $out/disk.qcow2
zstd -9 ${config.system.build.image}/${config.boot.uki.name}_${config.system.image.version}.store.raw \
-o $out/${config.boot.uki.name}_${config.system.image.version}.img.zst
zstd -9 ${config.system.build.uki}/${config.system.boot.loader.ukiFile} \
-o $out/${config.system.boot.loader.ukiFile}.zst
'';
in
{
devShell = pkgs.mkShell {
packages = [
pkgs.erofs-utils
pkgs.just
packages = with pkgs; [
erofs-utils
just
self.packages.${system}.qemu-efi
];
};
@ -79,6 +89,8 @@
patos_image = mkInstallImage self.nixosConfigurations.${system}.patos;
patos_update = mkUpdate self.nixosConfigurations.${system}.patos;
image = system.build;
# FIXME: only do for x86_64
# A helper script to run the disk images above.
qemu-efi = pkgs.writeShellApplication {
@ -88,7 +100,7 @@
text = ''
qemu-system-x86_64 \
-smp 2 -m 2048 -machine q35,accel=kvm \
-smp 4 -m 2048 -machine q35,accel=kvm \
-bios ${pkgs.OVMF.fd}/FV/OVMF.fd \
-snapshot \
-display none \

View file

@ -15,6 +15,10 @@ build: build-image
build-image:
nix build .#patos_image
# Build PatOS update image
build-update:
nix build .#patos_update
run: build-image
qemu-efi -hda ./result/disk.qcow2

View file

@ -9,6 +9,7 @@
boot = {
enableContainers = false;
initrd.systemd.enable = true;
initrd.compressor = "zstd";
kernelParams = [
"console=ttyS0"
];

View file

@ -7,11 +7,12 @@
nix.enable = false;
system.disableInstallerTools = true;
system.etc.overlay.enable = true;
systemd.sysusers.enable = true;
programs.less.lessopen = null;
programs.command-not-found.enable = false;
environment.defaultPackages = [ ];
security.sudo.enable = false;
}

View file

@ -21,10 +21,13 @@
mkfsOptions = {
erofs = [
"-zzstd,6" # Zstd compression
# "-zzstd,6" # Zstd compression
# "-zlz4hc,12"
"-T0" # Fixed timestamp for all files
"-C65536" # 64 KiB cluster size
# "-Efragments,dedupe,ztailpacking" # Extra features
"-C262144" # 256 KiB cluster size
# "-C65536" # 64 KiB cluster size
# "-C1048576" # 1 MiB cluster size
"-Efragments,dedupe,ztailpacking" # Extra features
];
};

View file

@ -7,4 +7,13 @@ final: prev: {
"--enable-zstd"
];
});
util-linux = prev.util-linux.override {
ncursesSupport = false;
nlsSupport = false;
};
dbus = prev.dbus.override {
x11Support = false;
};
}