git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #37397 from obsidiansystems/nixpkgs
commit5bb50fb9f6b8c303a8a5e11656e6d2be76c45b33 authorJohn Ericson <John.Ericson@Obsidian.Systems> dateMon 19 Mar 2018, 21:50 (9 years ago) parent47d3f10b9a720c
3 files changed+57−38
nixos/release.nix+25−25 pkgs/top-level/release-cross.nix+1−1 pkgs/top-level/release-lib.nix+31−12
nixos/release.nix+25−25
@@ -17,14 +17,14 @@ let
1717 } // args);
1818
1919 # Note: only supportedSystems are considered.
20− callTestOnTheseSystems = systems: fn: args:
21− forTheseSystems
20+ callTestOnMatchingSystems = systems: fn: args:
21+ forMatchingSystems
2222 (intersectLists supportedSystems systems)
2323 (system: hydraJob (importTest fn args system));
24− callTest = callTestOnTheseSystems supportedSystems;
24+ callTest = callTestOnMatchingSystems supportedSystems;
2525
26− callSubTests = callSubTestsOnTheseSystems supportedSystems;
27− callSubTestsOnTheseSystems = systems: fn: args: let
26+ callSubTests = callSubTestsOnMatchingSystems supportedSystems;
27+ callSubTestsOnMatchingSystems = systems: fn: args: let
2828 discover = attrs: let
2929 subTests = filterAttrs (const (hasAttr "test")) attrs;
3030 in mapAttrs (const (t: hydraJob t.test)) subTests;
@@ -127,7 +127,7 @@ in rec {
127127 # Build the initial ramdisk so Hydra can keep track of its size over time.
128128 initialRamdisk = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.initialRamdisk);
129129
130− netboot = forTheseSystems [ "x86_64-linux" "aarch64-linux" ] (system: makeNetboot {
130+ netboot = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system: makeNetboot {
131131 inherit system;
132132 modules = [
133133 ./modules/installer/netboot/netboot-minimal.nix
@@ -141,7 +141,7 @@ in rec {
141141 inherit system;
142142 });
143143
144− iso_graphical = forTheseSystems [ "x86_64-linux" ] (system: makeIso {
144+ iso_graphical = forMatchingSystems [ "x86_64-linux" ] (system: makeIso {
145145 module = ./modules/installer/cd-dvd/installation-cd-graphical-kde.nix;
146146 type = "graphical";
147147 inherit system;
@@ -149,7 +149,7 @@ in rec {
149149
150150 # A variant with a more recent (but possibly less stable) kernel
151151 # that might support more hardware.
152− iso_minimal_new_kernel = forTheseSystems [ "x86_64-linux" ] (system: makeIso {
152+ iso_minimal_new_kernel = forMatchingSystems [ "x86_64-linux" ] (system: makeIso {
153153 module = ./modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix;
154154 type = "minimal-new-kernel";
155155 inherit system;
@@ -157,7 +157,7 @@ in rec {
157157
158158
159159 # A bootable VirtualBox virtual appliance as an OVA file (i.e. packaged OVF).
160− ova = forTheseSystems [ "x86_64-linux" ] (system:
160+ ova = forMatchingSystems [ "x86_64-linux" ] (system:
161161
162162 with import nixpkgs { inherit system; };
163163
@@ -233,9 +233,9 @@ in rec {
233233 tests.boot-stage1 = callTest tests/boot-stage1.nix {};
234234 tests.borgbackup = callTest tests/borgbackup.nix {};
235235 tests.buildbot = callTest tests/buildbot.nix {};
236− tests.cadvisor = callTestOnTheseSystems ["x86_64-linux"] tests/cadvisor.nix {};
237− tests.ceph = callTestOnTheseSystems ["x86_64-linux"] tests/ceph.nix {};
238− tests.chromium = (callSubTestsOnTheseSystems ["x86_64-linux"] tests/chromium.nix {}).stable or {};
236+ tests.cadvisor = callTestOnMatchingSystems ["x86_64-linux"] tests/cadvisor.nix {};
237+ tests.ceph = callTestOnMatchingSystems ["x86_64-linux"] tests/ceph.nix {};
238+ tests.chromium = (callSubTestsOnMatchingSystems ["x86_64-linux"] tests/chromium.nix {}).stable or {};
239239 tests.cjdns = callTest tests/cjdns.nix {};
240240 tests.cloud-init = callTest tests/cloud-init.nix {};
241241 tests.containers-ipv4 = callTest tests/containers-ipv4.nix {};
@@ -249,21 +249,21 @@ in rec {
249249 tests.containers-hosts = callTest tests/containers-hosts.nix {};
250250 tests.containers-macvlans = callTest tests/containers-macvlans.nix {};
251251 tests.couchdb = callTest tests/couchdb.nix {};
252− tests.docker = callTestOnTheseSystems ["x86_64-linux"] tests/docker.nix {};
253− tests.docker-tools = callTestOnTheseSystems ["x86_64-linux"] tests/docker-tools.nix {};
254− tests.docker-edge = callTestOnTheseSystems ["x86_64-linux"] tests/docker-edge.nix {};
252+ tests.docker = callTestOnMatchingSystems ["x86_64-linux"] tests/docker.nix {};
253+ tests.docker-tools = callTestOnMatchingSystems ["x86_64-linux"] tests/docker-tools.nix {};
254+ tests.docker-edge = callTestOnMatchingSystems ["x86_64-linux"] tests/docker-edge.nix {};
255255 tests.dovecot = callTest tests/dovecot.nix {};
256− tests.dnscrypt-proxy = callTestOnTheseSystems ["x86_64-linux"] tests/dnscrypt-proxy.nix {};
256+ tests.dnscrypt-proxy = callTestOnMatchingSystems ["x86_64-linux"] tests/dnscrypt-proxy.nix {};
257257 tests.ecryptfs = callTest tests/ecryptfs.nix {};
258− tests.etcd = callTestOnTheseSystems ["x86_64-linux"] tests/etcd.nix {};
259− tests.ec2-nixops = (callSubTestsOnTheseSystems ["x86_64-linux"] tests/ec2.nix {}).boot-ec2-nixops or {};
260− tests.ec2-config = (callSubTestsOnTheseSystems ["x86_64-linux"] tests/ec2.nix {}).boot-ec2-config or {};
261− tests.elk = callSubTestsOnTheseSystems ["x86_64-linux"] tests/elk.nix {};
258+ tests.etcd = callTestOnMatchingSystems ["x86_64-linux"] tests/etcd.nix {};
259+ tests.ec2-nixops = (callSubTestsOnMatchingSystems ["x86_64-linux"] tests/ec2.nix {}).boot-ec2-nixops or {};
260+ tests.ec2-config = (callSubTestsOnMatchingSystems ["x86_64-linux"] tests/ec2.nix {}).boot-ec2-config or {};
261+ tests.elk = callSubTestsOnMatchingSystems ["x86_64-linux"] tests/elk.nix {};
262262 tests.env = callTest tests/env.nix {};
263263 tests.ferm = callTest tests/ferm.nix {};
264264 tests.firefox = callTest tests/firefox.nix {};
265265 tests.firewall = callTest tests/firewall.nix {};
266− tests.fleet = callTestOnTheseSystems ["x86_64-linux"] tests/fleet.nix {};
266+ tests.fleet = callTestOnMatchingSystems ["x86_64-linux"] tests/fleet.nix {};
267267 tests.fwupd = callTest tests/fwupd.nix {};
268268 #tests.gitlab = callTest tests/gitlab.nix {};
269269 tests.gitolite = callTest tests/gitolite.nix {};
@@ -296,7 +296,7 @@ in rec {
296296 tests.kernel-copperhead = callTest tests/kernel-copperhead.nix {};
297297 tests.kernel-latest = callTest tests/kernel-latest.nix {};
298298 tests.kernel-lts = callTest tests/kernel-lts.nix {};
299− tests.kubernetes = callSubTestsOnTheseSystems ["x86_64-linux"] tests/kubernetes/default.nix {};
299+ tests.kubernetes = callSubTestsOnMatchingSystems ["x86_64-linux"] tests/kubernetes/default.nix {};
300300 tests.latestKernel.login = callTest tests/login.nix { latestKernel = true; };
301301 tests.ldap = callTest tests/ldap.nix {};
302302 #tests.lightdm = callTest tests/lightdm.nix {};
@@ -326,14 +326,14 @@ in rec {
326326 tests.nginx = callTest tests/nginx.nix { };
327327 tests.nghttpx = callTest tests/nghttpx.nix { };
328328 tests.nix-ssh-serve = callTest tests/nix-ssh-serve.nix { };
329− tests.novacomd = callTestOnTheseSystems ["x86_64-linux"] tests/novacomd.nix { };
329+ tests.novacomd = callTestOnMatchingSystems ["x86_64-linux"] tests/novacomd.nix { };
330330 tests.leaps = callTest tests/leaps.nix { };
331331 tests.nsd = callTest tests/nsd.nix {};
332332 tests.openssh = callTest tests/openssh.nix {};
333333 tests.openldap = callTest tests/openldap.nix {};
334334 tests.owncloud = callTest tests/owncloud.nix {};
335335 tests.pam-oath-login = callTest tests/pam-oath-login.nix {};
336− #tests.panamax = callTestOnTheseSystems ["x86_64-linux"] tests/panamax.nix {};
336+ #tests.panamax = callTestOnMatchingSystems ["x86_64-linux"] tests/panamax.nix {};
337337 tests.peerflix = callTest tests/peerflix.nix {};
338338 tests.php-pcre = callTest tests/php-pcre.nix {};
339339 tests.postgresql = callSubTests tests/postgresql.nix {};
@@ -366,7 +366,7 @@ in rec {
366366 tests.tomcat = callTest tests/tomcat.nix {};
367367 tests.udisks2 = callTest tests/udisks2.nix {};
368368 tests.vault = callTest tests/vault.nix {};
369− tests.virtualbox = callSubTestsOnTheseSystems ["x86_64-linux"] tests/virtualbox.nix {};
369+ tests.virtualbox = callSubTestsOnMatchingSystems ["x86_64-linux"] tests/virtualbox.nix {};
370370 tests.wordpress = callTest tests/wordpress.nix {};
371371 tests.xautolock = callTest tests/xautolock.nix {};
372372 tests.xfce = callTest tests/xfce.nix {};
pkgs/top-level/release-cross.nix+1−1
@@ -88,7 +88,7 @@ in
8888 f (["buildPackages"] ++ path) { inherit system crossSystem; }
8989 );
9090
91− testEqual = path: systems: forTheseSystems systems (testEqualOne path);
91+ testEqual = path: systems: forMatchingSystems systems (testEqualOne path);
9292
9393 mapTestEqual = lib.mapAttrsRecursive testEqual;
9494
pkgs/top-level/release-lib.nix+31−12
@@ -48,33 +48,56 @@ rec {
4848 pkgs_x86_64_cygwin = allPackages { system = "x86_64-cygwin"; };
4949
5050
51+ # Given a list of 'meta.platforms'-style patterns, return the sublist of
52+ # `supportedSystems` containing systems that matches at least one of the given
53+ # patterns.
54+ #
55+ # This is written in a funny way so that we only elaborate the systems once.
56+ supportedMatches = let
57+ supportedPlatforms = map
58+ (system: lib.systems.elaborate { inherit system; })
59+ supportedSystems;
60+ in metaPatterns: let
61+ anyMatch = platform:
62+ lib.any (lib.meta.platformMatch platform) metaPatterns;
63+ matchingPlatforms = lib.filter anyMatch supportedPlatforms;
64+ in map ({ system, ...}: system) matchingPlatforms;
65+
66+
5167 assertTrue = bool:
5268 if bool
5369 then pkgs.runCommand "evaluated-to-true" {} "touch $out"
5470 else pkgs.runCommand "evaluated-to-false" {} "false";
5571
72+
5673 /* The working or failing mails for cross builds will be sent only to
5774 the following maintainers, as most package maintainers will not be
5875 interested in the result of cross building a package. */
5976 crossMaintainers = [ maintainers.viric ];
6077
78+
79+ # Generate attributes for all supported systems.
6180 forAllSystems = genAttrs supportedSystems;
62− forTheseSystems = systems: f:
63− genAttrs (filter (x: elem x supportedSystems) systems) f;
81+
82+
83+ # Generate attributes for all sytems matching at least one of the given
84+ # patterns
85+ forMatchingSystems = metaPatterns: genAttrs (supportedMatches metaPatterns);
86+
6487
6588 /* Build a package on the given set of platforms. The function `f'
6689 is called for each supported platform with Nixpkgs for that
6790 platform as an argument . We return an attribute set containing
6891 a derivation for each supported platform, i.e. ‘{ x86_64-linux =
6992 f pkgs_x86_64_linux; i686-linux = f pkgs_i686_linux; ... }’. */
70− testOn = systems: f: forTheseSystems systems
93+ testOn = metaPatterns: f: forMatchingSystems metaPatterns
7194 (system: hydraJob' (f (pkgsFor system)));
7295
7396
7497 /* Similar to the testOn function, but with an additional
7598 'crossSystem' parameter for allPackages, defining the target
7699 platform for cross builds. */
77− testOnCross = crossSystem: systems: f: forTheseSystems systems
100+ testOnCross = crossSystem: metaPatterns: f: forMatchingSystems metaPatterns
78101 (system: hydraJob' (f (allPackages { inherit system crossSystem; })));
79102
80103
@@ -82,14 +105,14 @@ rec {
82105 map each leaf node to `testOn [platforms...] (pkgs:
83106 pkgs.<attrPath>)'. */
84107 mapTestOn = mapAttrsRecursive
85− (path: systems: testOn systems (pkgs: getAttrFromPath path pkgs));
108+ (path: metaPatterns: testOn metaPatterns (pkgs: getAttrFromPath path pkgs));
86109
87110
88111 /* Similar to the testOn function, but with an additional 'crossSystem'
89112 * parameter for allPackages, defining the target platform for cross builds,
90113 * and triggering the build of the host derivation (cross built - crossDrv). */
91114 mapTestOnCross = crossSystem: mapAttrsRecursive
92− (path: systems: testOnCross crossSystem systems
115+ (path: metaPatterns: testOnCross crossSystem metaPatterns
93116 (pkgs: addMetaAttrs { maintainers = crossMaintainers; } (getAttrFromPath path pkgs)));
94117
95118
@@ -98,12 +121,8 @@ rec {
98121 packagePlatforms = mapAttrs (name: value:
99122 let res = builtins.tryEval (
100123 if isDerivation value then
101− value.meta.hydraPlatforms or (let
102− linuxDefaulted = value.meta.platforms or [ "x86_64-linux" ];
103− pred = system: lib.any
104− (lib.meta.platformMatch (lib.systems.elaborate { inherit system; }))
105− linuxDefaulted;
106− in lib.filter pred supportedSystems)
124+ value.meta.hydraPlatforms
125+ or supportedMatches (value.meta.platforms or [ "x86_64-linux" ])
107126 else if value.recurseForDerivations or false || value.recurseForRelease or false then
108127 packagePlatforms value
109128 else