Skip to content

Commit 636fd63

Browse files
authored
asahi installer
2 parents d58284a + 729a149 commit 636fd63

2 files changed

Lines changed: 110 additions & 0 deletions

File tree

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Builds the generic Apple Silicon installer ISO (modules/installer/asahi.nix)
2+
# natively on GitHub's arm64 runner and uploads it as the run's artifact.
3+
#
4+
# Nothing it builds is secret: it checks out without the secrets submodule,
5+
# and the flake leaves secrets/ out when it is not there.
6+
name: asahi-installer
7+
8+
on:
9+
workflow_dispatch:
10+
push:
11+
branches: [main]
12+
paths:
13+
- flake.lock
14+
- modules/installer/asahi.nix
15+
- .github/workflows/asahi-installer.yml
16+
pull_request:
17+
paths:
18+
- flake.lock
19+
- modules/installer/asahi.nix
20+
- .github/workflows/asahi-installer.yml
21+
22+
permissions:
23+
contents: read
24+
25+
concurrency:
26+
group: asahi-installer-${{ github.ref }}
27+
cancel-in-progress: true
28+
29+
jobs:
30+
build:
31+
runs-on: ubuntu-24.04-arm
32+
# The Asahi kernel and ZFS's kernel module are not in cache.nixos.org,
33+
# so both build from source.
34+
timeout-minutes: 360
35+
steps:
36+
- name: Free disk space
37+
run: |
38+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache /usr/local/share/boost
39+
df -h /
40+
41+
- uses: actions/checkout@v4
42+
43+
- uses: cachix/install-nix-action@v31
44+
with:
45+
extra_nix_config: |
46+
experimental-features = nix-command flakes
47+
max-jobs = auto
48+
cores = 0
49+
50+
- name: Build ISO
51+
run: |
52+
nix build -L .#packages.aarch64-linux.asahi-installer
53+
mkdir out
54+
cp result/iso/*.iso out/
55+
ls -lh out
56+
57+
- uses: actions/upload-artifact@v4
58+
with:
59+
name: asahi-installer
60+
path: out/*.iso
61+
compression-level: 0
62+
retention-days: 30

‎modules/installer/asahi.nix‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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

Comments
 (0)