From 998adc8e2a7fddf9610d10a7657fb34c55492332 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Thu, 11 Nov 2021 16:33:14 -0500 Subject: [PATCH] Support aarch64-darwin --- README.md | 1 + ofborg/src/acl.rs | 1 + ofborg/src/outpaths.nix | 26 +++++++++++++++++--------- ofborg/src/systems.rs | 3 +++ release.nix | 36 +++++++++++++++++++++--------------- 5 files changed, 43 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index fc66195..bb50a45 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,7 @@ platforms: - `x86_64-linux` - `aarch64-linux` - `x86_64-darwin` + - `aarch64-darwin` See [`config.public.json`](./config.public.json) for a list of all trusted users. diff --git a/ofborg/src/acl.rs b/ofborg/src/acl.rs index 6fa9886..dabc11e 100644 --- a/ofborg/src/acl.rs +++ b/ofborg/src/acl.rs @@ -26,6 +26,7 @@ impl Acl { vec![ System::X8664Darwin, System::X8664Linux, + System::Aarch64Darwin, System::Aarch64Linux, ] } else { diff --git a/ofborg/src/outpaths.nix b/ofborg/src/outpaths.nix index 483fcf2..8793f36 100755 --- a/ofborg/src/outpaths.nix +++ b/ofborg/src/outpaths.nix @@ -11,6 +11,7 @@ let { supportedSystems = [ "aarch64-linux" + # "aarch64-darwin" # !!! "i686-linux" "x86_64-linux" "x86_64-darwin" @@ -26,11 +27,13 @@ let handleEvalIssue = reason: errormsg: let fatalErrors = [ - "unknown-meta" "broken-outputs" + "unknown-meta" + "broken-outputs" ]; - in if builtins.elem reason fatalErrors - then abort errormsg - else true; + in + if builtins.elem reason fatalErrors + then abort errormsg + else true; inHydra = true; }; @@ -44,17 +47,22 @@ let (name: val: if name == "recurseForDerivations" then true else if lib.isAttrs val && val.type or null != "derivation" - then recurseIntoAttrs (tweak val) + then recurseIntoAttrs (tweak val) else val ); # Some of these contain explicit references to platform(s) we want to avoid; # some even (transitively) depend on ~/.nixpkgs/config.nix (!) blacklist = [ - "tarball" "metrics" "manual" - "darwin-tested" "unstable" "stdenvBootstrapTools" - "moduleSystem" "lib-tests" # these just confuse the output + "tarball" + "metrics" + "manual" + "darwin-tested" + "unstable" + "stdenvBootstrapTools" + "moduleSystem" + "lib-tests" # these just confuse the output ]; in - tweak (builtins.removeAttrs hydraJobs blacklist) +tweak (builtins.removeAttrs hydraJobs blacklist) diff --git a/ofborg/src/systems.rs b/ofborg/src/systems.rs index f296270..0454455 100644 --- a/ofborg/src/systems.rs +++ b/ofborg/src/systems.rs @@ -3,6 +3,7 @@ pub enum System { X8664Linux, Aarch64Linux, X8664Darwin, + Aarch64Darwin, } impl std::fmt::Display for System { @@ -11,6 +12,7 @@ impl std::fmt::Display for System { System::X8664Linux => write!(f, "x86_64-linux"), System::Aarch64Linux => write!(f, "aarch64-linux"), System::X8664Darwin => write!(f, "x86_64-darwin"), + System::Aarch64Darwin => write!(f, "aarch64-darwin"), } } } @@ -25,6 +27,7 @@ impl System { System::X8664Linux => true, System::Aarch64Linux => true, System::X8664Darwin => false, + System::Aarch64Darwin => false, } } } diff --git a/release.nix b/release.nix index bee79b2..c43b03f 100644 --- a/release.nix +++ b/release.nix @@ -1,5 +1,5 @@ { nixpkgs ? ./nix -, supportedSystems ? [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" ] +, supportedSystems ? [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ] }: let pkgs = import nixpkgs { @@ -26,19 +26,23 @@ let }; } ) - {} supportedSystems; + { } + supportedSystems; attrForSystem = system: attrpath: if borgpkgs-per-arch ? "${system}" - then ( - let - borgpkgs = borgpkgs-per-arch."${system}"; - in if lib.hasAttrByPath attrpath borgpkgs - then lib.setAttrByPath - (attrpath ++ [system]) - (lib.attrByPath attrpath "bogus" borgpkgs) + then + ( + let + borgpkgs = borgpkgs-per-arch."${system}"; + in + if lib.hasAttrByPath attrpath borgpkgs + then + lib.setAttrByPath + (attrpath ++ [ system ]) + (lib.attrByPath attrpath "bogus" borgpkgs) else throw "Failed to find ${toString attrpath} for ${system} in borgpkgs" - ) + ) else throw "No such system ${system}"; attrsForAllSystems = path: @@ -46,31 +50,33 @@ let (collector: system: lib.recursiveUpdate collector (attrForSystem system path) ) - {} + { } supportedSystems; merge = attrsets: builtins.foldl' (collector: set: lib.recursiveUpdate set collector) - {} + { } attrsets; x8664LinuxOnly = path: - (attrForSystem "x86_64-linux" path); + (attrForSystem "x86_64-linux" path); jobs = merge [ (attrsForAllSystems [ "ofborg" "rs" ]) (x8664LinuxOnly [ "ofborg" "php" ]) ]; -in jobs // { +in +jobs // { release = pkgs.releaseTools.aggregate { name = "release"; meta.description = "Release-critical builds for OfBorg infrastructure"; constituents = [ jobs.ofborg.rs.x86_64-linux jobs.ofborg.rs.x86_64-darwin - # jobs.ofborg.rs.aarch64-linux + jobs.ofborg.rs.aarch64-darwin + jobs.ofborg.rs.aarch64-linux jobs.ofborg.php.x86_64-linux ]; };