git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #33749 from dezgeg/release-refactor-1

nixos/release.nix: Refactoring for better multi-system support

commit4dff3ee959035fadc77b0c2ac949a006b4249b20 authorJohn Ericson <Ericson2314@yahoo.com> dateTue 16 Jan 2018, 12:54 (9 years ago) parentb55d4c04ccf308
3 files changed+16−25
nixos/release.nix+11−21 pkgs/top-level/release-cross.nix+1−1 pkgs/top-level/release-lib.nix+4−3
nixos/release.nix+11−21
@@ -3,6 +3,7 @@
33, supportedSystems ? [ "x86_64-linux" "aarch64-linux" ]
44}:
55
6+with import ../pkgs/top-level/release-lib.nix { inherit supportedSystems; };
67with import ../lib;
78
89let
@@ -11,8 +12,6 @@ let
1112 versionSuffix =
1213 (if stableBranch then "." else "pre") + "${toString nixpkgs.revCount}.${nixpkgs.shortRev}";
1314
14− forAllSystems = genAttrs supportedSystems;
15−
1615 importTest = fn: args: system: import fn ({
1716 inherit system;
1817 } // args);
@@ -124,22 +123,13 @@ in rec {
124123 # Build the initial ramdisk so Hydra can keep track of its size over time.
125124 initialRamdisk = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.initialRamdisk);
126125
127− netboot = {
128− x86_64-linux = makeNetboot {
129− system = "x86_64-linux";
130− modules = [
131− ./modules/installer/netboot/netboot-minimal.nix
132− versionModule
133− ];
134− };
135− } // (optionalAttrs (elem "aarch64-linux" supportedSystems) {
136− aarch64-linux = makeNetboot {
137− system = "aarch64-linux";
138− modules = [
139− ./modules/installer/netboot/netboot-minimal.nix
140− versionModule
141− ];
142− };});
126+ netboot = forTheseSystems [ "x86_64-linux" "aarch64-linux" ] (system: makeNetboot {
127+ inherit system;
128+ modules = [
129+ ./modules/installer/netboot/netboot-minimal.nix
130+ versionModule
131+ ];
132+ });
143133
144134 iso_minimal = forAllSystems (system: makeIso {
145135 module = ./modules/installer/cd-dvd/installation-cd-minimal.nix;
@@ -147,7 +137,7 @@ in rec {
147137 inherit system;
148138 });
149139
150− iso_graphical = genAttrs [ "x86_64-linux" ] (system: makeIso {
140+ iso_graphical = forTheseSystems [ "x86_64-linux" ] (system: makeIso {
151141 module = ./modules/installer/cd-dvd/installation-cd-graphical-kde.nix;
152142 type = "graphical";
153143 inherit system;
@@ -155,7 +145,7 @@ in rec {
155145
156146 # A variant with a more recent (but possibly less stable) kernel
157147 # that might support more hardware.
158− iso_minimal_new_kernel = genAttrs [ "x86_64-linux" ] (system: makeIso {
148+ iso_minimal_new_kernel = forTheseSystems [ "x86_64-linux" ] (system: makeIso {
159149 module = ./modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix;
160150 type = "minimal-new-kernel";
161151 inherit system;
@@ -163,7 +153,7 @@ in rec {
163153
164154
165155 # A bootable VirtualBox virtual appliance as an OVA file (i.e. packaged OVF).
166− ova = genAttrs [ "x86_64-linux" ] (system:
156+ ova = forTheseSystems [ "x86_64-linux" ] (system:
167157
168158 with import nixpkgs { inherit system; };
169159
pkgs/top-level/release-cross.nix+1−1
@@ -75,7 +75,7 @@ in
7575 f (["buildPackages"] ++ path) { inherit system crossSystem; }
7676 );
7777
78− testEqual = path: systems: forAllSupportedSystems systems (testEqualOne path);
78+ testEqual = path: systems: forTheseSystems systems (testEqualOne path);
7979
8080 mapTestEqual = lib.mapAttrsRecursive testEqual;
8181
pkgs/top-level/release-lib.nix+4−3
@@ -58,7 +58,8 @@ rec {
5858 interested in the result of cross building a package. */
5959 crossMaintainers = [ maintainers.viric ];
6060
61− forAllSupportedSystems = systems: f:
61+ forAllSystems = genAttrs supportedSystems;
62+ forTheseSystems = systems: f:
6263 genAttrs (filter (x: elem x supportedSystems) systems) f;
6364
6465 /* Build a package on the given set of platforms. The function `f'
@@ -66,14 +67,14 @@ rec {
6667 platform as an argument . We return an attribute set containing
6768 a derivation for each supported platform, i.e. ‘{ x86_64-linux =
6869 f pkgs_x86_64_linux; i686-linux = f pkgs_i686_linux; ... }’. */
69− testOn = systems: f: forAllSupportedSystems systems
70+ testOn = systems: f: forTheseSystems systems
7071 (system: hydraJob' (f (pkgsFor system)));
7172
7273
7374 /* Similar to the testOn function, but with an additional
7475 'crossSystem' parameter for allPackages, defining the target
7576 platform for cross builds. */
76− testOnCross = crossSystem: systems: f: forAllSupportedSystems systems
77+ testOnCross = crossSystem: systems: f: forTheseSystems systems
7778 (system: hydraJob' (f (allPackages { inherit system crossSystem; })));
7879
7980