Enable ISO ARM cross-compilation & update CI config
Some checks are pending
Build NixOS ISOs / build-iso (arm, desktop) (push) Waiting to run
Build NixOS ISOs / build-iso (arm, server) (push) Waiting to run
Build NixOS ISOs / build-iso (x86, desktop) (push) Waiting to run
Build NixOS ISOs / build-iso (x86, server) (push) Waiting to run
Build NixOS ISOs / create-release (push) Blocked by required conditions
Some checks are pending
Build NixOS ISOs / build-iso (arm, desktop) (push) Waiting to run
Build NixOS ISOs / build-iso (arm, server) (push) Waiting to run
Build NixOS ISOs / build-iso (x86, desktop) (push) Waiting to run
Build NixOS ISOs / build-iso (x86, server) (push) Waiting to run
Build NixOS ISOs / create-release (push) Blocked by required conditions
- Allow rune to cross compile ARM binaries
This commit is contained in:
parent
d9eaddc9db
commit
526abcaf28
4 changed files with 43 additions and 22 deletions
43
.github/workflows/build-iso.yml
vendored
43
.github/workflows/build-iso.yml
vendored
|
@ -17,22 +17,16 @@ jobs:
|
|||
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: x86
|
||||
- iso-type: desktop
|
||||
arch: arm
|
||||
runner: ubuntu-latest-arm64
|
||||
|
||||
runs-on: ${{ matrix.runner }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
|
@ -41,9 +35,22 @@ jobs:
|
|||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@v9
|
||||
|
||||
- name: Setup QEMU for ARM emulation
|
||||
if: ${{ matrix.arch == 'arm' }}
|
||||
uses: docker/setup-qemu-action@v3
|
||||
with:
|
||||
platforms: arm64
|
||||
|
||||
- name: Setup Nix cache
|
||||
uses: DeterminateSystems/magic-nix-cache-action@v2
|
||||
|
||||
- name: Enable ARM emulation
|
||||
if: ${{ matrix.arch == 'arm' }}
|
||||
run: |
|
||||
echo "extra-platforms = aarch64-linux" >> $HOME/.config/nix/nix.conf
|
||||
echo "extra-sandbox-paths = /run/binfmt" >> $HOME/.config/nix/nix.conf
|
||||
sudo systemctl restart nix-daemon.service
|
||||
|
||||
- name: Build ISO (with retry)
|
||||
uses: nick-fields/retry@v3
|
||||
with:
|
||||
|
@ -52,15 +59,27 @@ jobs:
|
|||
retry_wait_seconds: 30
|
||||
command: |
|
||||
cd iso
|
||||
nix build .#${{ matrix.iso-type }}-iso-${{ matrix.arch }} \
|
||||
if [ "${{ matrix.arch }}" = "arm" ]; then
|
||||
nix build .#${{ matrix.iso-type }}-iso-arm \
|
||||
--system x86_64-linux \
|
||||
--extra-platforms aarch64-linux \
|
||||
--print-build-logs \
|
||||
--accept-flake-config
|
||||
else
|
||||
nix build .#${{ matrix.iso-type }}-iso-x86 \
|
||||
--print-build-logs \
|
||||
--accept-flake-config
|
||||
fi
|
||||
|
||||
- name: Get ISO filename
|
||||
id: iso-info
|
||||
run: |
|
||||
cd iso
|
||||
ISO_PATH=$(nix build .#${{ matrix.iso-type }}-iso-${{ matrix.arch }} --print-out-paths --no-link)
|
||||
if [ "${{ matrix.arch }}" = "arm" ]; then
|
||||
ISO_PATH=$(nix build .#${{ matrix.iso-type }}-iso-arm --print-out-paths --no-link)
|
||||
else
|
||||
ISO_PATH=$(nix build .#${{ matrix.iso-type }}-iso-x86 --print-out-paths --no-link)
|
||||
fi
|
||||
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
|
||||
|
@ -99,7 +118,7 @@ jobs:
|
|||
- **Server ISOs**: Minimal server environment with SSH access
|
||||
- **Desktop ISOs**: GNOME desktop environment for installation
|
||||
- **x86**: Intel/AMD 64-bit systems
|
||||
- **ARM**: ARM64 systems
|
||||
- **ARM**: ARM64 systems (cross-compiled)
|
||||
|
||||
### Usage:
|
||||
1. Download the appropriate ISO for your system
|
||||
|
|
|
@ -48,6 +48,9 @@
|
|||
"amdgpu"
|
||||
];
|
||||
extraModulePackages = [ ];
|
||||
|
||||
# Allow running ARM binaries on x86_64; for Cross Compilation
|
||||
binfmt.emulatedSystems = [ "aarch64-linux" ];
|
||||
};
|
||||
|
||||
# For less permission issues with SSHFS
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue