@ -48,33 +48,56 @@ rec {
pkgs_x86_64_cygwin = allPackages { system = " x 8 6 _ 6 4 - c y g w i n " ; } ;
# Given a list of 'meta.platforms'-style patterns, return the sublist of
# `supportedSystems` containing systems that matches at least one of the given
# patterns.
#
# This is written in a funny way so that we only elaborate the systems once.
supportedMatches = let
supportedPlatforms = map
( system : lib . systems . elaborate { inherit system ; } )
supportedSystems ;
in metaPatterns : let
anyMatch = platform :
lib . any ( lib . meta . platformMatch platform ) metaPatterns ;
matchingPlatforms = lib . filter anyMatch supportedPlatforms ;
in map ( { system , . . . }: system ) matchingPlatforms ;
assertTrue = bool :
if bool
then pkgs . runCommand " e v a l u a t e d - t o - t r u e " { } " t o u c h $ o u t "
else pkgs . runCommand " e v a l u a t e d - t o - f a l s e " { } " f a l s e " ;
/* T h e w o r k i n g o r f a i l i n g m a i l s f o r c r o s s b u i l d s w i l l b e s e n t o n l y t o
the following maintainers , as most package maintainers will not be
interested in the result of cross building a package . * /
crossMaintainers = [ maintainers . viric ] ;
# Generate attributes for all supported systems.
forAllSystems = genAttrs supportedSystems ;
forTheseSystems = systems : f :
genAttrs ( filter ( x : elem x supportedSystems ) systems ) f ;
# Generate attributes for all sytems matching at least one of the given
# patterns
forMatchingSystems = metaPatterns : genAttrs ( supportedMatches metaPatterns ) ;
/* B u i l d a p a c k a g e o n t h e g i v e n s e t o f p l a t f o r m s . T h e f u n c t i o n ` f '
is called for each supported platform with Nixpkgs for that
platform as an argument . We return an attribute set containing
a derivation for each supported platform , i . e . ‘ { x86_64-linux =
f pkgs_x86_64_linux ; i686-linux = f pkgs_i686_linux ; . . . } ’ . * /
testOn = system s: f : forTheseSystems system s
testOn = metaPattern s: f : forMatchingSystems metaPattern s
( system : hydraJob' ( f ( pkgsFor system ) ) ) ;
/* S i m i l a r t o t h e t e s t O n f u n c t i o n , b u t w i t h a n a d d i t i o n a l
' crossSystem' parameter for allPackages , defining the target
platform for cross builds . * /
testOnCross = crossSystem : system s: f : forTheseSystems system s
testOnCross = crossSystem : metaPattern s: f : forMatchingSystems metaPattern s
( system : hydraJob' ( f ( allPackages { inherit system crossSystem ; } ) ) ) ;
@ -82,14 +105,14 @@ rec {
map each leaf node to ` testOn [ platforms . . . ] ( pkgs :
pkgs . <attrPath> ) ' . * /
mapTestOn = mapAttrsRecursive
( path : systems : testOn system s ( pkgs : getAttrFromPath path pkgs ) ) ;
( path : metaPatterns : testOn metaPattern s ( pkgs : getAttrFromPath path pkgs ) ) ;
/* S i m i l a r t o t h e t e s t O n f u n c t i o n , b u t w i t h a n a d d i t i o n a l ' c r o s s S y s t e m '
* parameter for allPackages , defining the target platform for cross builds ,
* and triggering the build of the host derivation ( cross built - crossDrv ) . * /
mapTestOnCross = crossSystem : mapAttrsRecursive
( path : system s: testOnCross crossSystem system s
( path : metaPattern s: testOnCross crossSystem metaPattern s
( pkgs : addMetaAttrs { maintainers = crossMaintainers ; } ( getAttrFromPath path pkgs ) ) ) ;
@ -98,12 +121,8 @@ rec {
packagePlatforms = mapAttrs ( name : value :
let res = builtins . tryEval (
if isDerivation value then
value . meta . hydraPlatforms or ( let
linuxDefaulted = value . meta . platforms or [ " x 8 6 _ 6 4 - l i n u x " ] ;
pred = system : lib . any
( lib . meta . platformMatch ( lib . systems . elaborate { inherit system ; } ) )
linuxDefaulted ;
in lib . filter pred supportedSystems )
value . meta . hydraPlatforms
or supportedMatches ( value . meta . platforms or [ " x 8 6 _ 6 4 - l i n u x " ] )
else if value . recurseForDerivations or false || value . recurseForRelease or false then
packagePlatforms value
else