From 82cab72dd41cf3e243a76bdbbe2ba9631e9ffa5a Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Tue, 16 Jan 2018 18:28:21 +0200 Subject: [PATCH 1/3] release-lib: forAllSupportedSystems -> forTheseSystems I'm going to move forAllSystems from nixos/release.nix, and these functions sound too similar while doing different things. --- pkgs/top-level/release-cross.nix | 2 +- pkgs/top-level/release-lib.nix | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/top-level/release-cross.nix b/pkgs/top-level/release-cross.nix index ce6fba9c40f3..f6b2ecfb5dbe 100644 --- a/pkgs/top-level/release-cross.nix +++ b/pkgs/top-level/release-cross.nix @@ -75,7 +75,7 @@ in f (["buildPackages"] ++ path) { inherit system crossSystem; } ); - testEqual = path: systems: forAllSupportedSystems systems (testEqualOne path); + testEqual = path: systems: forTheseSystems systems (testEqualOne path); mapTestEqual = lib.mapAttrsRecursive testEqual; diff --git a/pkgs/top-level/release-lib.nix b/pkgs/top-level/release-lib.nix index fd05be0e1097..a56df53d27ef 100644 --- a/pkgs/top-level/release-lib.nix +++ b/pkgs/top-level/release-lib.nix @@ -58,7 +58,7 @@ rec { interested in the result of cross building a package. */ crossMaintainers = [ maintainers.viric ]; - forAllSupportedSystems = systems: f: + forTheseSystems = systems: f: genAttrs (filter (x: elem x supportedSystems) systems) f; /* Build a package on the given set of platforms. The function `f' @@ -66,14 +66,14 @@ rec { 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 = systems: f: forAllSupportedSystems systems + testOn = systems: f: forTheseSystems systems (system: hydraJob' (f (pkgsFor system))); /* Similar to the testOn function, but with an additional 'crossSystem' parameter for allPackages, defining the target platform for cross builds. */ - testOnCross = crossSystem: systems: f: forAllSupportedSystems systems + testOnCross = crossSystem: systems: f: forTheseSystems systems (system: hydraJob' (f (allPackages { inherit system crossSystem; }))); From b3c50ec1e9a3e2a4f356c4eaed46450b73f52dba Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Tue, 16 Jan 2018 18:29:43 +0200 Subject: [PATCH 2/3] nixos/release.nix: Move forAllSystems to release-lib There's already a similar forTheseSystems in release-lib, so be more consistent. --- nixos/release.nix | 3 +-- pkgs/top-level/release-lib.nix | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/release.nix b/nixos/release.nix index 33916243e97b..9a25b9a1919a 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -3,6 +3,7 @@ , supportedSystems ? [ "x86_64-linux" "aarch64-linux" ] }: +with import ../pkgs/top-level/release-lib.nix { inherit supportedSystems; }; with import ../lib; let @@ -11,8 +12,6 @@ let versionSuffix = (if stableBranch then "." else "pre") + "${toString nixpkgs.revCount}.${nixpkgs.shortRev}"; - forAllSystems = genAttrs supportedSystems; - importTest = fn: args: system: import fn ({ inherit system; } // args); diff --git a/pkgs/top-level/release-lib.nix b/pkgs/top-level/release-lib.nix index a56df53d27ef..87fb00a9682d 100644 --- a/pkgs/top-level/release-lib.nix +++ b/pkgs/top-level/release-lib.nix @@ -58,6 +58,7 @@ rec { interested in the result of cross building a package. */ crossMaintainers = [ maintainers.viric ]; + forAllSystems = genAttrs supportedSystems; forTheseSystems = systems: f: genAttrs (filter (x: elem x supportedSystems) systems) f; From 4ccf308d665fd2cd60c57d2fe17d5c597570e978 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Tue, 16 Jan 2018 18:42:47 +0200 Subject: [PATCH 3/3] nixos/release.nix: Use forTheseSystems from release-lib Currently, even if you pass `supportedSystems = [ "aarch64-linux" ]` you end up with e.g. `nixos.iso_graphical.x86_64-linux` job. Using forTheseSystems from release-lib avoids that. This shouldn't affect the usual x86 trunk-combined jobset. --- nixos/release.nix | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/nixos/release.nix b/nixos/release.nix index 9a25b9a1919a..39c550b62774 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -123,22 +123,13 @@ in rec { # Build the initial ramdisk so Hydra can keep track of its size over time. initialRamdisk = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.initialRamdisk); - netboot = { - x86_64-linux = makeNetboot { - system = "x86_64-linux"; - modules = [ - ./modules/installer/netboot/netboot-minimal.nix - versionModule - ]; - }; - } // (optionalAttrs (elem "aarch64-linux" supportedSystems) { - aarch64-linux = makeNetboot { - system = "aarch64-linux"; - modules = [ - ./modules/installer/netboot/netboot-minimal.nix - versionModule - ]; - };}); + netboot = forTheseSystems [ "x86_64-linux" "aarch64-linux" ] (system: makeNetboot { + inherit system; + modules = [ + ./modules/installer/netboot/netboot-minimal.nix + versionModule + ]; + }); iso_minimal = forAllSystems (system: makeIso { module = ./modules/installer/cd-dvd/installation-cd-minimal.nix; @@ -146,7 +137,7 @@ in rec { inherit system; }); - iso_graphical = genAttrs [ "x86_64-linux" ] (system: makeIso { + iso_graphical = forTheseSystems [ "x86_64-linux" ] (system: makeIso { module = ./modules/installer/cd-dvd/installation-cd-graphical-kde.nix; type = "graphical"; inherit system; @@ -154,7 +145,7 @@ in rec { # A variant with a more recent (but possibly less stable) kernel # that might support more hardware. - iso_minimal_new_kernel = genAttrs [ "x86_64-linux" ] (system: makeIso { + iso_minimal_new_kernel = forTheseSystems [ "x86_64-linux" ] (system: makeIso { module = ./modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix; type = "minimal-new-kernel"; inherit system; @@ -162,7 +153,7 @@ in rec { # A bootable VirtualBox virtual appliance as an OVA file (i.e. packaged OVF). - ova = genAttrs [ "x86_64-linux" ] (system: + ova = forTheseSystems [ "x86_64-linux" ] (system: with import nixpkgs { inherit system; };