lol

Merge pull request #33749 from dezgeg/release-refactor-1

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

authored by

John Ericson and committed by
GitHub
4dff3ee9 b55d4c05

+16 -25
+11 -21
nixos/release.nix
··· 3 3 , supportedSystems ? [ "x86_64-linux" "aarch64-linux" ] 4 4 }: 5 5 6 + with import ../pkgs/top-level/release-lib.nix { inherit supportedSystems; }; 6 7 with import ../lib; 7 8 8 9 let ··· 10 11 version = fileContents ../.version; 11 12 versionSuffix = 12 13 (if stableBranch then "." else "pre") + "${toString nixpkgs.revCount}.${nixpkgs.shortRev}"; 13 - 14 - forAllSystems = genAttrs supportedSystems; 15 14 16 15 importTest = fn: args: system: import fn ({ 17 16 inherit system; ··· 124 123 # Build the initial ramdisk so Hydra can keep track of its size over time. 125 124 initialRamdisk = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.initialRamdisk); 126 125 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 + }); 143 133 144 134 iso_minimal = forAllSystems (system: makeIso { 145 135 module = ./modules/installer/cd-dvd/installation-cd-minimal.nix; ··· 147 137 inherit system; 148 138 }); 149 139 150 - iso_graphical = genAttrs [ "x86_64-linux" ] (system: makeIso { 140 + iso_graphical = forTheseSystems [ "x86_64-linux" ] (system: makeIso { 151 141 module = ./modules/installer/cd-dvd/installation-cd-graphical-kde.nix; 152 142 type = "graphical"; 153 143 inherit system; ··· 155 145 156 146 # A variant with a more recent (but possibly less stable) kernel 157 147 # 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 { 159 149 module = ./modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix; 160 150 type = "minimal-new-kernel"; 161 151 inherit system; ··· 163 153 164 154 165 155 # 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: 167 157 168 158 with import nixpkgs { inherit system; }; 169 159
+1 -1
pkgs/top-level/release-cross.nix
··· 75 75 f (["buildPackages"] ++ path) { inherit system crossSystem; } 76 76 ); 77 77 78 - testEqual = path: systems: forAllSupportedSystems systems (testEqualOne path); 78 + testEqual = path: systems: forTheseSystems systems (testEqualOne path); 79 79 80 80 mapTestEqual = lib.mapAttrsRecursive testEqual; 81 81
+4 -3
pkgs/top-level/release-lib.nix
··· 58 58 interested in the result of cross building a package. */ 59 59 crossMaintainers = [ maintainers.viric ]; 60 60 61 - forAllSupportedSystems = systems: f: 61 + forAllSystems = genAttrs supportedSystems; 62 + forTheseSystems = systems: f: 62 63 genAttrs (filter (x: elem x supportedSystems) systems) f; 63 64 64 65 /* Build a package on the given set of platforms. The function `f' ··· 66 67 platform as an argument . We return an attribute set containing 67 68 a derivation for each supported platform, i.e. ‘{ x86_64-linux = 68 69 f pkgs_x86_64_linux; i686-linux = f pkgs_i686_linux; ... }’. */ 69 - testOn = systems: f: forAllSupportedSystems systems 70 + testOn = systems: f: forTheseSystems systems 70 71 (system: hydraJob' (f (pkgsFor system))); 71 72 72 73 73 74 /* Similar to the testOn function, but with an additional 74 75 'crossSystem' parameter for allPackages, defining the target 75 76 platform for cross builds. */ 76 - testOnCross = crossSystem: systems: f: forAllSupportedSystems systems 77 + testOnCross = crossSystem: systems: f: forTheseSystems systems 77 78 (system: hydraJob' (f (allPackages { inherit system crossSystem; }))); 78 79 79 80