From f9c42b57abb35a7b0089208b610460551d407653 Mon Sep 17 00:00:00 2001 From: kat witch Date: Thu, 2 Sep 2021 21:37:10 +0100 Subject: [PATCH] CI: fixes for armv6+v7 --- .github/workflows/niv-update.yml | 6 +++--- .github/workflows/nodes.yml | 16 ++++++++-------- ci/niv-cron.nix | 33 +++++++++++++++++--------------- ci/nodes.nix | 19 +++++++++--------- 4 files changed, 38 insertions(+), 36 deletions(-) diff --git a/.github/workflows/niv-update.yml b/.github/workflows/niv-update.yml index dc1c22e6..d1274eee 100644 --- a/.github/workflows/niv-update.yml +++ b/.github/workflows/niv-update.yml @@ -48,9 +48,9 @@ jobs: with: attrs: ci.job.niv-update.run.bootstrap quiet: false - - id: aarch64 - name: prepare for aarch64 builds - run: 'sudo $(which aarch64binfmt) + - id: architectures + name: prepare for emulated builds + run: 'sudo $(which archbinfmt) ' - id: ci-dirty diff --git a/.github/workflows/nodes.yml b/.github/workflows/nodes.yml index 323b345e..a424aab4 100644 --- a/.github/workflows/nodes.yml +++ b/.github/workflows/nodes.yml @@ -21,7 +21,7 @@ jobs: with: attrs: ci.job.athame.run.bootstrap quiet: false - - id: aarch64 + - id: architectures name: prepare for emulated builds run: 'sudo $(which archbinfmt) @@ -83,7 +83,7 @@ jobs: with: attrs: ci.job.beltane.run.bootstrap quiet: false - - id: aarch64 + - id: architectures name: prepare for emulated builds run: 'sudo $(which archbinfmt) @@ -170,7 +170,7 @@ jobs: with: attrs: ci.job.daiyousei.run.bootstrap quiet: false - - id: aarch64 + - id: architectures name: prepare for emulated builds run: 'sudo $(which archbinfmt) @@ -232,7 +232,7 @@ jobs: with: attrs: ci.job.ostara.run.bootstrap quiet: false - - id: aarch64 + - id: architectures name: prepare for emulated builds run: 'sudo $(which archbinfmt) @@ -294,7 +294,7 @@ jobs: with: attrs: ci.job.rinnosuke.run.bootstrap quiet: false - - id: aarch64 + - id: architectures name: prepare for emulated builds run: 'sudo $(which archbinfmt) @@ -356,7 +356,7 @@ jobs: with: attrs: ci.job.samhain.run.bootstrap quiet: false - - id: aarch64 + - id: architectures name: prepare for emulated builds run: 'sudo $(which archbinfmt) @@ -418,7 +418,7 @@ jobs: with: attrs: ci.job.shinmyoumaru.run.bootstrap quiet: false - - id: aarch64 + - id: architectures name: prepare for emulated builds run: 'sudo $(which archbinfmt) @@ -480,7 +480,7 @@ jobs: with: attrs: ci.job.yule.run.bootstrap quiet: false - - id: aarch64 + - id: architectures name: prepare for emulated builds run: 'sudo $(which archbinfmt) diff --git a/ci/niv-cron.nix b/ci/niv-cron.nix index d4d94555..2ec96a87 100644 --- a/ci/niv-cron.nix +++ b/ci/niv-cron.nix @@ -5,31 +5,34 @@ with lib; { ci.gh-actions.export = true; - nix.config = { - extra-platforms = "aarch64-linux"; - #extra-sandbox-paths = with channels.cipkgs; map (package: builtins.unsafeDiscardStringContext "${package}?") [bash qemu "/run/binfmt"]; - }; - gh-actions.env.OPENSSH_PRIVATE_KEY = "\${{ secrets.OPENSSH_PRIVATE_KEY }}"; gh-actions.env.CACHIX_SIGNING_KEY = "\${{ secrets.CACHIX_SIGNING_KEY }}"; - # ensure sources are fetched and available in the local store before evaluating host configs + + nix.config = { + extra-platforms = ["aarch64-linux" "armv6l-linux" "armv7l-linux"]; + #extra-sandbox-paths = with channels.cipkgs; map (package: builtins.unsafeDiscardStringContext "${package}?") [bash qemu "/run/binfmt"]; + }; + environment.bootstrap = { - aarch64binfmt = + archbinfmt = let makeQemuWrapper = name: '' mkdir -p /run/binfmt - rm -f /run/binfmt/${name} - cat > /run/binfmt/${name} << 'EOF' + rm -f /run/binfmt/${name}-linux + cat > /run/binfmt/${name}-linux << 'EOF' #!${channels.cipkgs.bash}/bin/sh exec -- ${channels.cipkgs.qemu}/bin/qemu-${name} "$@" EOF - chmod +x /run/binfmt/${name} + chmod +x /run/binfmt/${name}-linux ''; in - channels.cipkgs.writeShellScriptBin "aarch64binfmt" '' + channels.cipkgs.writeShellScriptBin "archbinfmt" '' ${makeQemuWrapper "aarch64"} + ${makeQemuWrapper "arm"} echo 'extra-sandbox-paths = ${channels.cipkgs.bash} ${channels.cipkgs.qemu} /run/binfmt' >> /etc/nix/nix.conf - echo ':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:/run/binfmt/aarch64:' > /proc/sys/fs/binfmt_misc/register + echo ':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:/run/binfmt/aarch64-linux:' > /proc/sys/fs/binfmt_misc/register + echo ':armv6l-linux:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\x00\xff\xfe\xff\xff\xff:/run/binfmt/arm-linux:' > /proc/sys/fs/binfmt_misc/register + echo ':armv7l-linux:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\x00\xff\xfe\xff\xff\xff:/run/binfmt/arm-linux:' > /proc/sys/fs/binfmt_misc/register ''; }; @@ -54,11 +57,11 @@ with lib; { }]; }; jobs = mkIf (config.id != "ci") { - ${config.id}.step.aarch64 = { + ${config.id}.step.architectures = { order = 201; - name = "prepare for aarch64 builds"; + name = "prepare for emulated builds"; run = '' - sudo $(which aarch64binfmt) + sudo $(which archbinfmt) ''; }; }; diff --git a/ci/nodes.nix b/ci/nodes.nix index 44186db1..157382c3 100644 --- a/ci/nodes.nix +++ b/ci/nodes.nix @@ -5,13 +5,13 @@ channels.nixfiles.path = ../.; nix.config = { - extra-platforms = ["aarch64-linux" "armv6l" "armv7l"]; + extra-platforms = ["aarch64-linux" "armv6l-linux" "armv7l-linux"]; #extra-sandbox-paths = with channels.cipkgs; map (package: builtins.unsafeDiscardStringContext "${package}?") [bash qemu "/run/binfmt"]; }; gh-actions = { jobs = mkIf (config.id != "ci") { - ${config.id}.step.aarch64 = { + ${config.id}.step.architectures = { order = 201; name = "prepare for emulated builds"; run = '' @@ -27,21 +27,20 @@ let makeQemuWrapper = name: '' mkdir -p /run/binfmt - rm -f /run/binfmt/${name} - cat > /run/binfmt/${name} << 'EOF' + rm -f /run/binfmt/${name}-linux + cat > /run/binfmt/${name}-linux << 'EOF' #!${channels.cipkgs.bash}/bin/sh exec -- ${channels.cipkgs.qemu}/bin/qemu-${name} "$@" EOF - chmod +x /run/binfmt/${name} + chmod +x /run/binfmt/${name}-linux ''; in channels.cipkgs.writeShellScriptBin "archbinfmt" '' ${makeQemuWrapper "aarch64"} - ${makeQemuWrapper "armv6l"} - ${makeQemuWrapper "armv7l"} + ${makeQemuWrapper "arm"} echo 'extra-sandbox-paths = ${channels.cipkgs.bash} ${channels.cipkgs.qemu} /run/binfmt' >> /etc/nix/nix.conf - echo ':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:/run/binfmt/aarch64:' > /proc/sys/fs/binfmt_misc/register - echo ':armv6l-linux:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\x00\xff\xfe\xff\xff\xff:/run/binfmt/armv6l-linux:' > /proc/sys/fs/binfmt_misc/register - echo ':armv7l-linux:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\x00\xff\xfe\xff\xff\xff:/run/binfmt/armv7l-linux:' > /proc/sys/fs/binfmt_misc/register + echo ':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:/run/binfmt/aarch64-linux:' > /proc/sys/fs/binfmt_misc/register + echo ':armv6l-linux:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\x00\xff\xfe\xff\xff\xff:/run/binfmt/arm-linux:' > /proc/sys/fs/binfmt_misc/register + echo ':armv7l-linux:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\x00\xff\xfe\xff\xff\xff:/run/binfmt/arm-linux:' > /proc/sys/fs/binfmt_misc/register ''; sourceCache = channels.cipkgs.runCommand "sources" {