From dc35d4335f9d554cdef8e2c7297a380789157394 Mon Sep 17 00:00:00 2001 From: Chris Toph Date: Mon, 16 Jun 2025 19:59:36 -0400 Subject: [PATCH] Enable ISO ARM cross-compilation & update CI config - Allow rune to cross compile ARM binaries - Github workflow only compiles x86 for now --- .github/workflows/build-iso.yml | 38 +++++++++++---------------------- iso/default.nix | 7 +++--- iso/flake.nix | 6 ++---- 3 files changed, 19 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build-iso.yml b/.github/workflows/build-iso.yml index 111cf59..a2f270f 100644 --- a/.github/workflows/build-iso.yml +++ b/.github/workflows/build-iso.yml @@ -1,4 +1,4 @@ -name: Build NixOS ISOs +name: Build NixOS ISOs (x86 only) on: push: @@ -16,23 +16,10 @@ jobs: build-iso: strategy: matrix: - include: - # x86 ISOs on x86 runners - - iso-type: server - arch: x86 - runner: ubuntu-latest - - iso-type: desktop - arch: x86 - runner: ubuntu-latest - # ARM ISOs on ARM runners - - iso-type: server - arch: arm - runner: ubuntu-latest-arm64 - - iso-type: desktop - arch: arm - runner: ubuntu-latest-arm64 + iso-type: [server, desktop] + arch: [x86] - runs-on: ${{ matrix.runner }} + runs-on: ubuntu-latest steps: - name: Checkout repository @@ -47,12 +34,12 @@ jobs: - name: Build ISO (with retry) uses: nick-fields/retry@v3 with: - timeout_minutes: 60 + timeout_minutes: 45 max_attempts: 3 retry_wait_seconds: 30 command: | cd iso - nix build .#${{ matrix.iso-type }}-iso-${{ matrix.arch }} \ + nix build .#${{ matrix.iso-type }}-iso-x86 \ --print-build-logs \ --accept-flake-config @@ -60,7 +47,7 @@ jobs: id: iso-info run: | cd iso - ISO_PATH=$(nix build .#${{ matrix.iso-type }}-iso-${{ matrix.arch }} --print-out-paths --no-link) + ISO_PATH=$(nix build .#${{ matrix.iso-type }}-iso-x86 --print-out-paths --no-link) ISO_FILE=$(find $ISO_PATH -name "*.iso" -o -name "*.iso.zst" | head -1) ISO_NAME=$(basename "$ISO_FILE") echo "iso-path=$ISO_FILE" >> $GITHUB_OUTPUT @@ -96,10 +83,9 @@ jobs: This release contains automatically built NixOS ISOs based on my configuration. ### Available ISOs: - - **Server ISOs**: Minimal server environment with SSH access - - **Desktop ISOs**: GNOME desktop environment for installation - - **x86**: Intel/AMD 64-bit systems - - **ARM**: ARM64 systems + - **Server ISO**: Minimal server environment with SSH access + - **Desktop ISO**: GNOME desktop environment for installation + - **Architecture**: x86_64 (Intel/AMD systems) ### Usage: 1. Download the appropriate ISO for your system @@ -107,6 +93,8 @@ jobs: 3. Default credentials: user `nixos`, password `nixos` 4. SSH is enabled for remote installation + Note: ARM ISOs are not provided in this build. Users requiring ARM versions should build locally. + Built automatically from commit: ${{ github.sha }} draft: false - prerelease: false + prerelease: false \ No newline at end of file diff --git a/iso/default.nix b/iso/default.nix index ccd76b5..41b2cbd 100644 --- a/iso/default.nix +++ b/iso/default.nix @@ -7,15 +7,17 @@ system, ... }: +let + isCross = pkgs.stdenv.buildPlatform.system != pkgs.stdenv.hostPlatform.system; +in { - ## ISO ## isoImage = { isoName = lib.mkForce "nixos-${config.hostSpec.hostName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.iso"; makeEfiBootable = true; makeUsbBootable = true; compressImage = false; squashfsCompression = lib.mkIf isARM "gzip"; - includeSystemBuildDependencies = lib.mkIf isARM false; + includeSystemBuildDependencies = lib.mkIf (isARM || isCross) false; }; ## SSH & NETWORK ## @@ -56,7 +58,6 @@ system.stateVersion = "25.05"; nixpkgs.hostPlatform = system; users.mutableUsers = lib.mkForce true; # Allow password changes - boot.kernelPackages = pkgs.linuxPackages_latest; nixpkgs.config = { allowUnsupportedSystem = true; diff --git a/iso/flake.nix b/iso/flake.nix index 2331ce9..db0b52e 100644 --- a/iso/flake.nix +++ b/iso/flake.nix @@ -87,7 +87,7 @@ }) configs ); - # Generate packages per system - each system only exposes its own packages + # Generate packages per system - all available on x86_64 via cross-compilation mkPackages = system: let @@ -103,13 +103,11 @@ { nixosConfigurations = mkConfigurations; - # Each system only exposes packages it can build packages = { - "${X86}" = mkPackages X86; + "${X86}" = (mkPackages X86) // (mkPackages ARM); "${ARM}" = mkPackages ARM; }; - # For convenience - all systems get all configs inherit (dot-nix.outputs) overlays; }; }