Support aarch64-darwin

This commit is contained in:
Graham Christensen 2021-11-11 16:33:14 -05:00 committed by Cole Helbling
parent e64d033fb6
commit 998adc8e2a
5 changed files with 43 additions and 24 deletions

View file

@ -139,6 +139,7 @@ platforms:
- `x86_64-linux` - `x86_64-linux`
- `aarch64-linux` - `aarch64-linux`
- `x86_64-darwin` - `x86_64-darwin`
- `aarch64-darwin`
See [`config.public.json`](./config.public.json) for a list of all trusted users. See [`config.public.json`](./config.public.json) for a list of all trusted users.

View file

@ -26,6 +26,7 @@ impl Acl {
vec![ vec![
System::X8664Darwin, System::X8664Darwin,
System::X8664Linux, System::X8664Linux,
System::Aarch64Darwin,
System::Aarch64Linux, System::Aarch64Linux,
] ]
} else { } else {

View file

@ -11,6 +11,7 @@ let
{ {
supportedSystems = [ supportedSystems = [
"aarch64-linux" "aarch64-linux"
# "aarch64-darwin" # !!!
"i686-linux" "i686-linux"
"x86_64-linux" "x86_64-linux"
"x86_64-darwin" "x86_64-darwin"
@ -26,11 +27,13 @@ let
handleEvalIssue = reason: errormsg: handleEvalIssue = reason: errormsg:
let let
fatalErrors = [ fatalErrors = [
"unknown-meta" "broken-outputs" "unknown-meta"
"broken-outputs"
]; ];
in if builtins.elem reason fatalErrors in
then abort errormsg if builtins.elem reason fatalErrors
else true; then abort errormsg
else true;
inHydra = true; inHydra = true;
}; };
@ -44,17 +47,22 @@ let
(name: val: (name: val:
if name == "recurseForDerivations" then true if name == "recurseForDerivations" then true
else if lib.isAttrs val && val.type or null != "derivation" else if lib.isAttrs val && val.type or null != "derivation"
then recurseIntoAttrs (tweak val) then recurseIntoAttrs (tweak val)
else val else val
); );
# Some of these contain explicit references to platform(s) we want to avoid; # Some of these contain explicit references to platform(s) we want to avoid;
# some even (transitively) depend on ~/.nixpkgs/config.nix (!) # some even (transitively) depend on ~/.nixpkgs/config.nix (!)
blacklist = [ blacklist = [
"tarball" "metrics" "manual" "tarball"
"darwin-tested" "unstable" "stdenvBootstrapTools" "metrics"
"moduleSystem" "lib-tests" # these just confuse the output "manual"
"darwin-tested"
"unstable"
"stdenvBootstrapTools"
"moduleSystem"
"lib-tests" # these just confuse the output
]; ];
in in
tweak (builtins.removeAttrs hydraJobs blacklist) tweak (builtins.removeAttrs hydraJobs blacklist)

View file

@ -3,6 +3,7 @@ pub enum System {
X8664Linux, X8664Linux,
Aarch64Linux, Aarch64Linux,
X8664Darwin, X8664Darwin,
Aarch64Darwin,
} }
impl std::fmt::Display for System { impl std::fmt::Display for System {
@ -11,6 +12,7 @@ impl std::fmt::Display for System {
System::X8664Linux => write!(f, "x86_64-linux"), System::X8664Linux => write!(f, "x86_64-linux"),
System::Aarch64Linux => write!(f, "aarch64-linux"), System::Aarch64Linux => write!(f, "aarch64-linux"),
System::X8664Darwin => write!(f, "x86_64-darwin"), System::X8664Darwin => write!(f, "x86_64-darwin"),
System::Aarch64Darwin => write!(f, "aarch64-darwin"),
} }
} }
} }
@ -25,6 +27,7 @@ impl System {
System::X8664Linux => true, System::X8664Linux => true,
System::Aarch64Linux => true, System::Aarch64Linux => true,
System::X8664Darwin => false, System::X8664Darwin => false,
System::Aarch64Darwin => false,
} }
} }
} }

View file

@ -1,5 +1,5 @@
{ nixpkgs ? ./nix { nixpkgs ? ./nix
, supportedSystems ? [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" ] , supportedSystems ? [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]
}: }:
let let
pkgs = import nixpkgs { pkgs = import nixpkgs {
@ -26,19 +26,23 @@ let
}; };
} }
) )
{} supportedSystems; { }
supportedSystems;
attrForSystem = system: attrpath: attrForSystem = system: attrpath:
if borgpkgs-per-arch ? "${system}" if borgpkgs-per-arch ? "${system}"
then ( then
let (
borgpkgs = borgpkgs-per-arch."${system}"; let
in if lib.hasAttrByPath attrpath borgpkgs borgpkgs = borgpkgs-per-arch."${system}";
then lib.setAttrByPath in
(attrpath ++ [system]) if lib.hasAttrByPath attrpath borgpkgs
(lib.attrByPath attrpath "bogus" borgpkgs) then
lib.setAttrByPath
(attrpath ++ [ system ])
(lib.attrByPath attrpath "bogus" borgpkgs)
else throw "Failed to find ${toString attrpath} for ${system} in borgpkgs" else throw "Failed to find ${toString attrpath} for ${system} in borgpkgs"
) )
else throw "No such system ${system}"; else throw "No such system ${system}";
attrsForAllSystems = path: attrsForAllSystems = path:
@ -46,31 +50,33 @@ let
(collector: system: (collector: system:
lib.recursiveUpdate collector (attrForSystem system path) lib.recursiveUpdate collector (attrForSystem system path)
) )
{} { }
supportedSystems; supportedSystems;
merge = attrsets: merge = attrsets:
builtins.foldl' builtins.foldl'
(collector: set: lib.recursiveUpdate set collector) (collector: set: lib.recursiveUpdate set collector)
{} { }
attrsets; attrsets;
x8664LinuxOnly = path: x8664LinuxOnly = path:
(attrForSystem "x86_64-linux" path); (attrForSystem "x86_64-linux" path);
jobs = merge [ jobs = merge [
(attrsForAllSystems [ "ofborg" "rs" ]) (attrsForAllSystems [ "ofborg" "rs" ])
(x8664LinuxOnly [ "ofborg" "php" ]) (x8664LinuxOnly [ "ofborg" "php" ])
]; ];
in jobs // { in
jobs // {
release = pkgs.releaseTools.aggregate { release = pkgs.releaseTools.aggregate {
name = "release"; name = "release";
meta.description = "Release-critical builds for OfBorg infrastructure"; meta.description = "Release-critical builds for OfBorg infrastructure";
constituents = [ constituents = [
jobs.ofborg.rs.x86_64-linux jobs.ofborg.rs.x86_64-linux
jobs.ofborg.rs.x86_64-darwin 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 jobs.ofborg.php.x86_64-linux
]; ];
}; };