Add installer ISO generator

This commit is contained in:
Michael Smith
2024-08-06 17:27:52 +02:00
parent 75fa469048
commit 01e3c3a9b3
4 changed files with 1108 additions and 0 deletions

View File

@@ -26,6 +26,16 @@
config.allowUnfree = true;
});
in {
nixosConfigurations = {
installer = nixpkgs.lib.nixosSystem {
modules = [
"${nixpkgs}/nixos/modules/installer/cd-dvd/channel.nix"
./machines/installer
];
specialArgs = {inherit inputs;};
};
};
packages = forAllSystems (system: let
pkgs = nixpkgsFor.${system};
in {
@@ -42,6 +52,23 @@
.system
.build
.vm;
installer-demo = pkgs.writeShellScript "installer-demo" ''
set -euo pipefail
disk=installer-demo-root.img
${pkgs.qemu}/bin/qemu-img create -f qcow2 "$disk" 80G
${pkgs.qemu}/bin/qemu-system-x86_64 \
-cpu host \
-enable-kvm \
-m 8G \
-vga virtio \
-display gtk,full-screen=on,grab-on-hover=on \
-bios ${pkgs.OVMF.fd}/FV/OVMF.fd \
-cdrom ${self.packages.${system}.installer-iso}/iso/*.iso \
-hda "$disk"
'';
installer-iso = inputs.self.nixosConfigurations.installer.config.system.build.isoImage;
});
apps = forAllSystems (system: {
@@ -58,6 +85,11 @@
type = "app";
program = "${clean-state-demo}/bin/run";
};
installer-demo = {
type = "app";
program = "${self.packages.${system}.installer-demo}";
};
});
formatter = forAllSystems (system: nixpkgsFor.${system}.alejandra);