|
| 1 | +# A generic installer ISO for any Apple Silicon Mac: nixos-apple-silicon's |
| 2 | +# installer with ZFS turned back on (it leaves ZFS out, since it does not |
| 3 | +# always build against the Asahi kernel), plus disko and nixos-facter. It |
| 4 | +# holds nothing host-specific: boot it, then install a host's own profile |
| 5 | +# from this flake, e.g. |
| 6 | +# disko --mode format,mount --flake '.?submodules=1#cale' |
| 7 | +# nixos-install --flake '.?submodules=1#cale' |
| 8 | +# Built on this flake's nixpkgs, so its ZFS matches the hosts it installs. |
| 9 | +# |
| 10 | +# .github/workflows/asahi-installer.yml builds it; the ISO is that run's |
| 11 | +# artifact. By hand, on an aarch64-linux machine: |
| 12 | +# nix build .#packages.aarch64-linux.asahi-installer |
| 13 | +{ inputs, ... }: |
| 14 | +let |
| 15 | + system = "aarch64-linux"; |
| 16 | + |
| 17 | + installer = inputs.nixpkgs.lib.nixosSystem { |
| 18 | + modules = [ |
| 19 | + inputs.nixos-apple-silicon.nixosModules.apple-silicon-installer |
| 20 | + ( |
| 21 | + { lib, pkgs, ... }: |
| 22 | + { |
| 23 | + nixpkgs.hostPlatform = system; |
| 24 | + |
| 25 | + # The upstream installer sets this to false; force it back on. |
| 26 | + boot.supportedFilesystems.zfs = lib.mkForce true; |
| 27 | + # ZFS wants a host ID; any fixed one does for a live system. |
| 28 | + networking.hostId = "5a5a5a5a"; |
| 29 | + |
| 30 | + environment.systemPackages = [ |
| 31 | + pkgs.git |
| 32 | + pkgs.nixos-facter |
| 33 | + pkgs.ssh-to-age |
| 34 | + inputs.disko.packages.${system}.disko |
| 35 | + ]; |
| 36 | + |
| 37 | + nix.settings.experimental-features = [ |
| 38 | + "nix-command" |
| 39 | + "flakes" |
| 40 | + ]; |
| 41 | + } |
| 42 | + ) |
| 43 | + ]; |
| 44 | + }; |
| 45 | +in |
| 46 | +{ |
| 47 | + flake.packages.${system}.asahi-installer = installer.config.system.build.isoImage; |
| 48 | +} |
0 commit comments