Skip to content

Commit 00a6f9d

Browse files
committed
add back tests for aarch64-linux
1 parent e428213 commit 00a6f9d

File tree

6 files changed

+194
-189
lines changed

6 files changed

+194
-189
lines changed

.github/workflows/nix-portable.yml

+52-134
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,45 @@ on:
77
branches: [ "ci", "main" ]
88

99
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
continue-on-error: true
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
system: [ x86_64-linux, aarch64-linux ]
17+
18+
steps:
19+
20+
- uses: actions/checkout@v4
21+
with:
22+
# Nix Flakes doesn't work on shallow clones
23+
fetch-depth: 0
24+
25+
- uses: cachix/install-nix-action@V27
26+
with:
27+
extra_nix_config: |
28+
experimental-features = nix-command flakes
29+
extra-platforms = ${{ matrix.system }}
30+
31+
- uses: cachix/cachix-action@v14
32+
with:
33+
name: nix-portable
34+
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
35+
36+
- name: Set up QEMU
37+
uses: docker/setup-qemu-action@v2
38+
with:
39+
image: tonistiigi/binfmt@sha256:8de6f2decb92e9001d094534bf8a92880c175bd5dfb4a9d8579f26f09821cfa2
40+
platforms: all
41+
42+
- run: 'nix build -L .#packages.${{ matrix.system }}.nix-portable'
43+
44+
- name: Archive result
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: nix-portable-${{ matrix.system }}
48+
path: result/bin/nix-portable
1049

1150
nix-matrix:
1251
runs-on: ubuntu-latest
@@ -24,7 +63,9 @@ jobs:
2463
2564
nix-build:
2665
name: ${{ matrix.name }} (${{ matrix.system }})
27-
needs: nix-matrix
66+
needs:
67+
- nix-matrix
68+
- build
2869
runs-on: ${{ matrix.os }}
2970
strategy:
3071
matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}}
@@ -34,142 +75,19 @@ jobs:
3475
with:
3576
extra_nix_config: |
3677
experimental-features = nix-command flakes impure-derivations ca-derivations
78+
extra-platforms = aarch64-linux
79+
- uses: cachix/cachix-action@v14
80+
with:
81+
name: nix-portable
82+
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
83+
- name: Set up QEMU
84+
uses: docker/setup-qemu-action@v2
85+
with:
86+
image: tonistiigi/binfmt@sha256:8de6f2decb92e9001d094534bf8a92880c175bd5dfb4a9d8579f26f09821cfa2
87+
platforms: all
3788
- run: nix build -L '.#${{ matrix.attr }}'
3889

3990

40-
# build:
41-
# runs-on: ubuntu-latest
42-
# continue-on-error: true
43-
# strategy:
44-
# fail-fast: false
45-
# matrix:
46-
# system: [ x86_64-linux, aarch64-linux ]
47-
48-
# steps:
49-
50-
# - uses: actions/checkout@v4
51-
# with:
52-
# # Nix Flakes doesn't work on shallow clones
53-
# fetch-depth: 0
54-
55-
# - uses: cachix/install-nix-action@V27
56-
# with:
57-
# extra_nix_config: |
58-
# experimental-features = nix-command flakes
59-
# extra-platforms = ${{ matrix.system }}
60-
61-
# - uses: cachix/cachix-action@v14
62-
# with:
63-
# name: nix-portable
64-
# authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
65-
66-
# - name: Set up QEMU
67-
# uses: docker/setup-qemu-action@v2
68-
# with:
69-
# image: tonistiigi/binfmt@sha256:8de6f2decb92e9001d094534bf8a92880c175bd5dfb4a9d8579f26f09821cfa2
70-
# platforms: all
71-
72-
# - name: Install binfmt support
73-
# run: sudo apt-get install -y
74-
75-
# - run: 'nix build -L .#defaultPackage.${{ matrix.system }}'
76-
77-
# - name: Archive result
78-
# uses: actions/upload-artifact@v4
79-
# with:
80-
# name: nix-portable-${{ matrix.system }}
81-
# path: result/bin/nix-portable
82-
83-
# test_qemu_x86_64:
84-
# name: Test via qemu x86_64-linux
85-
# needs: build
86-
# if: true
87-
# runs-on: ubuntu-latest
88-
# continue-on-error: true
89-
# strategy:
90-
# fail-fast: false
91-
# matrix:
92-
# qemu_os: [ arch, centos7, debian, nixos, ubuntu_22_04, ubuntu_23_10, ubuntu_24_04 ]
93-
# steps:
94-
95-
# - uses: actions/checkout@v4
96-
# with:
97-
# # Nix Flakes doesn't work on shallow clones
98-
# fetch-depth: 0
99-
100-
# - uses: cachix/install-nix-action@V27
101-
# with:
102-
# extra_nix_config: |
103-
# experimental-features = nix-command flakes
104-
# extra-platforms = ${{ matrix.system }}
105-
106-
# - uses: cachix/cachix-action@v14
107-
# with:
108-
# name: nix-portable
109-
# authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
110-
111-
# - run: 'nix run -L .#job-qemu-${{ matrix.qemu_os }}'
112-
113-
# test_qemu_aarch64:
114-
# name: Test via qemu aarch64-linux
115-
# needs: build
116-
# if: true
117-
# runs-on: ubuntu-24.04-arm
118-
# continue-on-error: true
119-
# strategy:
120-
# fail-fast: false
121-
# matrix:
122-
# qemu_os: [ debian-aarch64 ]
123-
# steps:
124-
125-
# - uses: actions/checkout@v4
126-
# with:
127-
# # Nix Flakes doesn't work on shallow clones
128-
# fetch-depth: 0
129-
130-
# - uses: cachix/install-nix-action@V27
131-
# with:
132-
# extra_nix_config: |
133-
# experimental-features = nix-command flakes
134-
# extra-platforms = ${{ matrix.system }}
135-
136-
# - uses: cachix/cachix-action@v14
137-
# with:
138-
# name: nix-portable
139-
# authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
140-
141-
# - run: 'nix run -L .#job-qemu-${{ matrix.qemu_os }}'
142-
143-
# test_nix-static:
144-
# name: Test nix-static via qemu
145-
# needs: build
146-
# if: true
147-
# runs-on: ubuntu-latest
148-
# continue-on-error: true
149-
# strategy:
150-
# fail-fast: false
151-
# matrix:
152-
# qemu_os: [ arch, centos7, debian, nixos, ubuntu, debian-aarch64 ]
153-
# steps:
154-
155-
# - uses: actions/checkout@v4
156-
# with:
157-
# # Nix Flakes doesn't work on shallow clones
158-
# fetch-depth: 0
159-
160-
# - uses: cachix/install-nix-action@V27
161-
# with:
162-
# extra_nix_config: |
163-
# experimental-features = nix-command flakes
164-
# extra-platforms = ${{ matrix.system }}
165-
166-
# - uses: cachix/cachix-action@v14
167-
# with:
168-
# name: nix-portable
169-
# authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
170-
171-
# - run: 'nix run -L .#job-qemu-${{ matrix.qemu_os }}-nix-static'
172-
17391
test_github:
17492
name: Test inside github action
17593
needs: nix-build

default.nix

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ with builtins;
88
unixtools,
99
stdenv,
1010
buildPackages,
11+
upx,
1112

1213
busybox ? pkgs.pkgsStatic.busybox,
1314
cacert ? pkgs.cacert,
@@ -62,7 +63,7 @@ let
6263
binName = (last (splitString "/" binPath)); in
6364
pkgs.runCommand
6465
binName
65-
{ nativeBuildInputs = [ pkgs.upx ]; }
66+
{ nativeBuildInputs = [ upx ]; }
6667
''
6768
mkdir -p $out/bin
6869
upx -9 -o $out/bin/${binName} ${binPath}

flake.nix

+25-10
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
forAllSystems = f: genAttrs supportedSystems
2727
(system: f system (import inp.nixpkgs { inherit system; }));
2828

29-
nixPortableForSystem = { system, crossSystem ? null, }:
29+
nixPortableForSystem = { system, crossSystem ? null, } @ args:
3030
let
3131
pkgsDefaultChannel = import inp.defaultChannel { inherit system crossSystem; };
3232
pkgs = import inp.nixpkgs { inherit system crossSystem; };
@@ -45,8 +45,8 @@
4545
lib = inp.nixpkgs.lib;
4646
compression = "zstd -3 -T1";
4747

48-
nix = inp.nix.packages.${system}.nix;
49-
nixStatic = inp.nix.packages.${system}.nix-static;
48+
nix = inp.nix.packages.${pkgs.stdenv.buildPlatform.system}.nix;
49+
nixStatic = inp.nix.packages.${pkgs.stdenv.buildPlatform.system}.nix-static;
5050

5151
busybox = pkgs.pkgsStatic.busybox;
5252
bwrap = pkgs.pkgsStatic.bubblewrap;
@@ -84,12 +84,26 @@
8484
}
8585
);
8686

87-
checks = forAllSystems (system: pkgs: pkgs.callPackages ./testing/vm-tests.nix
88-
{inherit (self.packages.${system}) nix-portable;}
89-
// {
90-
inherit (self.packages.${system}.nix-portable);
91-
}
92-
);
87+
checks =
88+
lib.recursiveUpdate
89+
(forAllSystems (system: pkgs:
90+
pkgs.callPackages ./testing/vm-tests.nix {inherit (self.packages.${system}) nix-portable;}
91+
))
92+
# github doesn't have KVM in aarch64 runners. -> run aarch64 vm tests on x86_64
93+
{
94+
x86_64-linux =
95+
let
96+
system = "x86_64-linux";
97+
crossSystem = "aarch64-linux";
98+
pkgs = import inp.nixpkgs { inherit system crossSystem; };
99+
in
100+
lib.mapAttrs'
101+
(name: drv: {name = name + "-aarch64-linux"; value = drv;})
102+
(pkgs.callPackages ./testing/vm-tests.nix {
103+
nix-portable = self.packages.${crossSystem}.nix-portable;
104+
pkgsNative = inp.nixpkgs.legacyPackages.${crossSystem};
105+
});
106+
};
93107

94108
packages = forAllSystems (system: pkgs: {
95109
default = self.packages.${system}.nix-portable;
@@ -110,6 +124,7 @@
110124
cp ${self.packages.x86_64-linux.nix-portable}/bin/nix-portable $out/nix-portable-x86_64
111125
cp ${self.packages.aarch64-linux.nix-portable}/bin/nix-portable $out/nix-portable-aarch64
112126
'';
127+
qemu-efi-aarch64 = pkgs.callPackage ./testing/qemu-efi.nix {};
113128
});
114129
})
115130
{ packages = (genAttrs [ "x86_64-linux" ] (system:
@@ -121,7 +136,7 @@
121136
githubActions = nix-github-actions.lib.mkGithubMatrix {
122137
checks =
123138
lib.getAttrs
124-
[ "x86_64-linux" "aarch64-linux" ]
139+
[ "x86_64-linux" ]
125140
self.checks;
126141
};
127142
};

testing/qemu-efi.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
{
44
fetchurl,
5-
gzip,
65
runCommand,
6+
buildPackages,
77
}:
88

99
let
@@ -15,6 +15,6 @@ in
1515

1616
runCommand "QEMU_EFI.img" {} ''
1717
cp ${qemu-efi-gz} QEMU_EFI.img.gz
18-
${gzip}/bin/gunzip QEMU_EFI.img.gz
18+
${buildPackages.gzip}/bin/gunzip QEMU_EFI.img.gz
1919
mv QEMU_EFI.img $out
2020
''

0 commit comments

Comments
 (0)