Add aarch64 support

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2024-03-07 12:43:57 +01:00
parent d08f067665
commit 87327a573a
No known key found for this signature in database
GPG key ID: E13DFD4B47127951
7 changed files with 30 additions and 8 deletions

View file

@ -18,11 +18,23 @@ jobs:
- nixos-unstable - nixos-unstable
- nixos-23.05 - nixos-23.05
- nixos-23.11 - nixos-23.11
system:
- x86_64-linux
- aarch64-linux
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: cachix/install-nix-action@v25 - name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: |
extra-platforms = aarch64-linux
- run: nix-shell --run ./ci.sh - run: nix-shell --run ./ci.sh
env: env:
CI_REGISTRY_AUTH: '${{ secrets.REGISTRY_AUTH }}' CI_REGISTRY_AUTH: '${{ secrets.REGISTRY_AUTH }}'
NIXPKGS_CHANNEL: '${{ matrix.channel }}' NIXPKGS_CHANNEL: '${{ matrix.channel }}'
NIX_SYSTEM_NAME: '${{ matrix.system }}'

2
ci.sh
View file

@ -8,6 +8,7 @@ channel=${NIXPKGS_CHANNEL:-nixos-unstable}
registry=${CI_REGISTRY:-docker.io} registry=${CI_REGISTRY:-docker.io}
registry_auth=${CI_REGISTRY_AUTH:-} registry_auth=${CI_REGISTRY_AUTH:-}
image_prefix=${CI_PROJECT_PATH:-nixpkgs} image_prefix=${CI_PROJECT_PATH:-nixpkgs}
system_name=${NIX_SYSTEM_NAME:-x86_64-linux}
if [[ $channel == nixos-unstable ]]; then if [[ $channel == nixos-unstable ]]; then
image_tag=latest image_tag=latest
@ -30,6 +31,7 @@ banner "Building images"
nix-build \ nix-build \
--no-out-link \ --no-out-link \
--option sandbox true \ --option sandbox true \
--argstr system "$system_name"
if [[ $(git rev-parse --abbrev-ref HEAD) != master ]]; then if [[ $(git rev-parse --abbrev-ref HEAD) != master ]]; then
banner "Skipping push on non-master branch" banner "Skipping push on non-master branch"

View file

@ -1,4 +1,6 @@
let {
pkgs = import ./pkgs.nix; system ? builtins.currentSystem
}: let
pkgs = import ./pkgs.nix system;
in in
pkgs.docker-nixpkgs pkgs.docker-nixpkgs

View file

@ -8,9 +8,10 @@ set -euo pipefail
user=$1 user=$1
org=${2:-nixpkgs} org=${2:-nixpkgs}
system_name=${NIX_SYSTEM_NAME:-x86_64-linux}
nix_eval() { nix_eval() {
nix-instantiate --strict --eval --json "$@" nix-instantiate --strict --eval --argstr system "$system_name" --json "$@"
} }
releases_json=$(nix_eval) releases_json=$(nix_eval)

View file

@ -1,7 +1,9 @@
import <nixpkgs> { system:
# docker images run on Linux # docker images run on Linux
system = "x86_64-linux"; assert builtins.elem system ["x86_64-linux" "aarch64-linux"];
import <nixpkgs> {
config = { }; config = { };
inherit system;
overlays = [ overlays = [
(import ./overlay.nix) (import ./overlay.nix)
]; ];

View file

@ -6,8 +6,9 @@ set -euo pipefail
registry=${1:-docker.io} registry=${1:-docker.io}
image_prefix=${2:-nixpkgs} image_prefix=${2:-nixpkgs}
image_tag=${3:-latest} image_tag=${3:-latest}
system_name=${NIX_SYSTEM_NAME:-x86_64-linux}
releases_json=$(nix-instantiate --strict --eval --json) releases_json=$(nix-instantiate --strict --argstr system "$system_name" --eval --json)
echo "=== Pushing images to $registry" echo "=== Pushing images to $registry"

View file

@ -3,9 +3,11 @@
# Usage: ./dockerhub-image-matrix # Usage: ./dockerhub-image-matrix
set -euo pipefail set -euo pipefail
system_name=${NIX_SYSTEM_NAME:-x86_64-linux}
## Main ## ## Main ##
releases_json=$(nix-instantiate --strict --eval --json) releases_json=$(nix-instantiate --strict --argstr system "$system_name" --eval --json)
echo "| Image / Tag | Pull |" echo "| Image / Tag | Pull |"
echo "| --- | --- |" echo "| --- | --- |"