{ description = "my project description"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; }; outputs = inputs@{self, nixpkgs, flake-utils, ...}: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; crossPkgs = pkgs.pkgsCross.aarch64-multiplatform; in { apps.default = { type = "app"; program = "${self.outputs.packages.${system}.vmscript}/bin/vmscript"; }; packages = { default = import ./sd-card.nix { inherit pkgs crossPkgs; }; uncompressed = import ./sd-card.nix { inherit pkgs crossPkgs; compress = false; }; vmscript = pkgs.writeScriptBin "vmscript" '' #!${pkgs.runtimeShell} -e img=./sd-card.img cp -b ${self.outputs.packages.${system}.uncompressed}/sd-card.img $img chmod 640 $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 ''; }; }); }