Skip to content

Commit

Permalink
Merge pull request #75 from Scrumplex/aarch64-support
Browse files Browse the repository at this point in the history
Add aarch64 support
  • Loading branch information
zimbatm authored Mar 7, 2024
2 parents d08f067 + df76ac6 commit 88be071
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 8 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,24 @@ jobs:
- nixos-unstable
- nixos-23.05
- nixos-23.11
system:
- x86_64-linux
- aarch64-linux
runs-on: ubuntu-latest
steps:
- 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
- uses: DeterminateSystems/magic-nix-cache-action@main

- run: nix-shell --run ./ci.sh
env:
CI_REGISTRY_AUTH: '${{ secrets.REGISTRY_AUTH }}'
NIXPKGS_CHANNEL: '${{ matrix.channel }}'
NIX_SYSTEM_NAME: '${{ matrix.system }}'
2 changes: 2 additions & 0 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ channel=${NIXPKGS_CHANNEL:-nixos-unstable}
registry=${CI_REGISTRY:-docker.io}
registry_auth=${CI_REGISTRY_AUTH:-}
image_prefix=${CI_PROJECT_PATH:-nixpkgs}
system_name=${NIX_SYSTEM_NAME:-x86_64-linux}

if [[ $channel == nixos-unstable ]]; then
image_tag=latest
Expand All @@ -30,6 +31,7 @@ banner "Building images"
nix-build \
--no-out-link \
--option sandbox true \
--argstr system "$system_name"

if [[ $(git rev-parse --abbrev-ref HEAD) != master ]]; then
banner "Skipping push on non-master branch"
Expand Down
6 changes: 4 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
let
pkgs = import ./pkgs.nix;
{
system ? builtins.currentSystem
}: let
pkgs = import ./pkgs.nix system;
in
pkgs.docker-nixpkgs
3 changes: 2 additions & 1 deletion dockerhub-metadata
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ set -euo pipefail

user=$1
org=${2:-nixpkgs}
system_name=${NIX_SYSTEM_NAME:-x86_64-linux}

nix_eval() {
nix-instantiate --strict --eval --json "$@"
nix-instantiate --strict --eval --argstr system "$system_name" --json "$@"
}

releases_json=$(nix_eval)
Expand Down
6 changes: 4 additions & 2 deletions pkgs.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
system:
# docker images run on Linux
assert builtins.elem system ["x86_64-linux" "aarch64-linux"];
import <nixpkgs> {
# docker images run on Linux
system = "x86_64-linux";
config = { };
inherit system;
overlays = [
(import ./overlay.nix)
];
Expand Down
3 changes: 2 additions & 1 deletion push-all
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ set -euo pipefail
registry=${1:-docker.io}
image_prefix=${2:-nixpkgs}
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"

Expand Down
4 changes: 3 additions & 1 deletion readme-image-matrix
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
# Usage: ./dockerhub-image-matrix
set -euo pipefail

system_name=${NIX_SYSTEM_NAME:-x86_64-linux}

## Main ##

releases_json=$(nix-instantiate --strict --eval --json)
releases_json=$(nix-instantiate --strict --argstr system "$system_name" --eval --json)

echo "| Image / Tag | Pull |"
echo "| --- | --- |"
Expand Down

0 comments on commit 88be071

Please sign in to comment.