{ description = "my project description"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; flake-utils.url = "github:numtide/flake-utils"; colmena.url = "github:zhaofengli/colmena"; graphfix.url = "git+https://git.sr.ht/~mtxyz/graphfix"; graphfix.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = inputs@{self, nixpkgs, flake-utils, ...}: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; overlays = [ inputs.colmena.overlay ]; }; crossPkgs = pkgs.pkgsCross.aarch64-multiplatform; in { devShell = pkgs.mkShell { packages = with pkgs; [ colmena ]; }; apps.default = { type = "app"; program = self.outputs.packages.${system}.vmscript + "/bin/vmscript"; }; packages.vmscript = pkgs.writeScriptBin "vmscript" '' #!${pkgs.runtimeShell} -e img=./sd-card.img ${pkgs.zstd}/bin/zstd -k -d ${self.outputs.image}/sd-image/orange.img.zst -o $img chmod 640 $img truncate -s 16G $img ${pkgs.qemu}/bin/qemu-system-aarch64 \ -machine raspi3b \ -kernel "${crossPkgs.ubootRaspberryPi3_64bit}/u-boot.bin" \ -cpu max \ -m 1G \ -smp 4 \ -drive file="$img",format=raw \ -nographic \ -serial null \ -serial mon:stdio ''; }) // (let pkgs = import nixpkgs { system = "aarch64-linux"; overlays = [ inputs.graphfix.overlay ]; }; in rec { colmena = { meta = { nixpkgs = pkgs; }; orange = { imports = [ ./configuration.nix "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix" ]; }; }; nixosConfigurations.orange = nixpkgs.lib.nixosSystem { modules = [ ./configuration.nix "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix" { nixpkgs.overlays = [inputs.graphfix.overlay]; sdImage.imageName = "orange.img"; } ]; }; image = nixosConfigurations.orange.config.system.build.sdImage; }); }