File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,14 +19,13 @@ runs:
1919 - name : Install Nix
2020 uses : nixbuild/nix-quick-install-action@master
2121 with :
22+ # TODO: When ready to migrate from nix-csi to nixkube module naming:
23+ # - Update trusted-public-keys: nix-csi.cachix.org-1 → nixkube.cachix.org-1
24+ # - Update substituters: https://nix-csi.cachix.org → https://nixkube.cachix.org
25+ # - Recreate/migrate Cachix cache from nix-csi to nixkube
2226 nix_conf : |
23- experimental-features = nix-command flakes
24- access-tokens = github.com=${{ inputs.github_token }}
25- # TODO: When ready to migrate from nix-csi to nixkube module naming:
26- # - Update trusted-public-keys: nix-csi.cachix.org-1 → nixkube.cachix.org-1
27- # - Update substituters: https://nix-csi.cachix.org → https://nixkube.cachix.org
28- # - Recreate/migrate Cachix cache from nix-csi to nixkube
2927 trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o= nixbuild.net/CHEAKK-1:IvfuR1Ldmkef8pMcSuCl9N2jppEb8KpBzdoB8uKQdxE= nix-csi.cachix.org-1:i4w33gR4efO67jpz8U7g/MdvRQ6mQ3LEF9fB8tES60g=
28+ extra-platforms = aarch64-linux qemu-user
3029 builders = ssh-ng://eu.nixbuild.net aarch64-linux ; ssh-ng://eu.nixbuild.net x86_64-linux
3130 substituters = https://cache.nixos.org?priority=1 https://nix-csi.cachix.org?priority=2 https://cache.lix.systems?priority=3 ssh-ng://eu.nixbuild.net?priority=4
3231 keep-env-derivations = true
Original file line number Diff line number Diff line change @@ -254,32 +254,6 @@ jobs:
254254 limit-access-to-actor : true
255255 wait-timeout-minutes : 5
256256
257- test-nixos :
258- needs : build
259- runs-on : ubuntu-latest
260- continue-on-error : true
261- steps :
262- - name : Checkout
263- uses : actions/checkout@main
264-
265- - name : Setup Nix environment
266- uses : ./.github/actions/setup-nix
267- with :
268- nixbuild_key : ${{ secrets.NIXBUILD_KEY }}
269- github_token : ${{ secrets.GITHUB_TOKEN }}
270- cache_key : test-nixos
271-
272- - name : Ensure KVM is available
273- run : |
274- if [ ! -e /dev/kvm ]; then
275- echo "::warning::KVM not available, test will likely fail"
276- fi
277- sudo chmod 666 /dev/kvm || true
278-
279- - name : Run NixOS integration test
280- run : |
281- nix build --show-trace --file . nixosTests.containerd --print-build-logs
282-
283257 release :
284258 needs : [build, test-kind-cache, test-kind-nocache]
285259 runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 1+ # SPDX-License-Identifier: MIT
2+
3+ on :
4+ push :
5+ branches :
6+ - ' *'
7+ pull_request :
8+ workflow_dispatch :
9+
10+ env :
11+ REPO_USERNAME : ${{ github.actor }}
12+ REPO_TOKEN : ${{ secrets.GITHUB_TOKEN }}
13+
14+ permissions :
15+ contents : read
16+
17+ jobs :
18+ test-nixos :
19+ runs-on : ubuntu-latest
20+ continue-on-error : true
21+ steps :
22+ - name : Checkout
23+ uses : actions/checkout@main
24+
25+ - name : Install Nix
26+ uses : nixbuild/nix-quick-install-action@master
27+ with :
28+ nix_conf : |
29+ experimental-features = nix-command flakes
30+ access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
31+ trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o= nixbuild.net/CHEAKK-1:IvfuR1Ldmkef8pMcSuCl9N2jppEb8KpBzdoB8uKQdxE= nix-csi.cachix.org-1:i4w33gR4efO67jpz8U7g/MdvRQ6mQ3LEF9fB8tES60g=
32+ extra-platforms = aarch64-linux
33+ builders = ssh-ng://eu.nixbuild.net aarch64-linux ; ssh-ng://eu.nixbuild.net x86_64-linux
34+ substituters = https://cache.nixos.org?priority=1 https://nix-csi.cachix.org?priority=2 https://cache.lix.systems?priority=3 ssh-ng://eu.nixbuild.net?priority=4
35+
36+ - name : Configure SSH Keys
37+ shell : bash
38+ run : |
39+ echo "${{ secrets.NIXBUILD_KEY }}" | install -D -m 600 /dev/stdin ~/.ssh/nixbuild_key
40+ install -m 644 "${{ github.workspace }}/.github/assets/ssh-config" ~/.ssh/config
41+
42+ - name : Setup upterm session
43+ uses : owenthereal/action-upterm@v1
Original file line number Diff line number Diff line change @@ -169,6 +169,31 @@ rec {
169169 } ;
170170 } ;
171171
172+ # Register binfmt handlers for cross-architecture builds (e.g., aarch64-linux on x86_64).
173+ #
174+ # Uses static QEMU with the F flag (fix binary). The kernel pre-opens the interpreter
175+ # at registration time, so it works inside Nix sandboxes without requiring /run/binfmt
176+ # symlinks or extra-sandbox-paths configuration.
177+ #
178+ # Magic/mask bytes match 64-bit little-endian aarch64 ELF binaries (both ET_EXEC and ET_DYN).
179+ register-binfmt =
180+ let
181+ qemuStatic = lib . getExe' pkgs . pkgsStatic . qemu-user "qemu-aarch64" ;
182+ in
183+ pkgs . writeShellScriptBin "register-binfmt" ''
184+ set -euo pipefail
185+ echo "Registering binfmt handler for aarch64-linux with static QEMU..."
186+ # Remove any existing registrations (ignore errors if not present)
187+ echo -1 | sudo tee /proc/sys/fs/binfmt_misc/aarch64-linux > /dev/null 2>&1 || true
188+ echo -1 | sudo tee /proc/sys/fs/binfmt_misc/qemu-aarch64 > /dev/null 2>&1 || true
189+ echo -1 | sudo tee /proc/sys/fs/binfmt_misc/qemu-aarch64-static > /dev/null 2>&1 || true
190+
191+ # Register with F flag: kernel pre-opens the interpreter, so it works in sandboxes
192+ printf ':aarch64-linux:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\x00\xff\xfe\xff\xff\xff:${ qemuStatic } :F\n' | \
193+ sudo tee /proc/sys/fs/binfmt_misc/register > /dev/null
194+ echo "Done!"
195+ '' ;
196+
172197 lixImage = pkgs . callPackage ./liximage.nix { } ;
173198 scratchImage = pkgs . callPackage ./scratchimage.nix { } ;
174199}
Original file line number Diff line number Diff line change 1515 environment . systemPackages = [
1616 pkgs . kubernetes # kubectl, kubeadm, kubelet
1717 pkgs . cri-tools # crictl
18+ pkgs . helix # editor
1819 ] ;
1920
21+ environment . variables . EDITOR = "hx" ;
22+
2023 # -- Containerd CRI --
2124 virtualisation . containerd = {
2225 enable = true ;
130133 cores = 4 ;
131134 } ;
132135
136+ # -- Interactive debug user --
137+ users . users . nixkube = {
138+ isNormalUser = true ;
139+ initialPassword = "nixkube" ;
140+ extraGroups = [ "wheel" ] ;
141+ } ;
142+
143+ # Allow nixkube to use sudo without password
144+ security . sudo . wheelNeedsPassword = false ;
145+
133146 # Disable COW on etcd data dir (etcd doesn't tolerate COW filesystems)
134147 system . activationScripts . noCOWs . text = ''
135148 ${ lib . getExe' pkgs . coreutils "mkdir" } --parents /var/lib/etcd
140153 systemd . tmpfiles . rules = [
141154 "d /var/run/nri 0755 root root -"
142155 ] ;
156+
157+ # Enable external networking for image pulls and nix binary cache access
158+ networking = {
159+ useDHCP = true ;
160+ firewall . enable = false ;
161+ } ;
162+ systemd . services . systemd-resolved . enable = true ;
143163}
You can’t perform that action at this time.
0 commit comments