Use lib.cartesianProducOfSets where lib.crossLists was used

This commit is contained in:
Jacek Galowicz 2021-01-28 23:03:02 +01:00
parent 123045a570
commit 001ba3934e
3 changed files with 14 additions and 9 deletions

View File

@ -444,8 +444,8 @@ in
in in
# We will generate every possible pair of WM and DM. # We will generate every possible pair of WM and DM.
concatLists ( concatLists (
crossLists builtins.map
(dm: wm: let ({dm, wm}: let
sessionName = "${dm.name}${optionalString (wm.name != "none") ("+" + wm.name)}"; sessionName = "${dm.name}${optionalString (wm.name != "none") ("+" + wm.name)}";
script = xsession dm wm; script = xsession dm wm;
desktopNames = if dm ? desktopNames desktopNames = if dm ? desktopNames
@ -472,7 +472,7 @@ in
providedSessions = [ sessionName ]; providedSessions = [ sessionName ];
}) })
) )
[dms wms] (cartesianProductOfSets { dm = dms; wm = wms; })
); );
# Make xsessions and wayland sessions available in XDG_DATA_DIRS # Make xsessions and wayland sessions available in XDG_DATA_DIRS

View File

@ -5,7 +5,11 @@
let let
inherit (import ../lib/testing-python.nix { inherit system pkgs; }) makeTest; inherit (import ../lib/testing-python.nix { inherit system pkgs; }) makeTest;
in pkgs.lib.listToAttrs (pkgs.lib.crossLists (predictable: withNetworkd: { testCombinations = pkgs.lib.cartesianProductOfSets {
predictable = [true false];
withNetworkd = [true false];
};
in pkgs.lib.listToAttrs (builtins.map ({ predictable, withNetworkd }: {
name = pkgs.lib.optionalString (!predictable) "un" + "predictable" name = pkgs.lib.optionalString (!predictable) "un" + "predictable"
+ pkgs.lib.optionalString withNetworkd "Networkd"; + pkgs.lib.optionalString withNetworkd "Networkd";
value = makeTest { value = makeTest {
@ -30,4 +34,4 @@ in pkgs.lib.listToAttrs (pkgs.lib.crossLists (predictable: withNetworkd: {
machine.${if predictable then "fail" else "succeed"}("ip link show eth0") machine.${if predictable then "fail" else "succeed"}("ip link show eth0")
''; '';
}; };
}) [[true false] [true false]]) }) testCombinations)

View File

@ -50,10 +50,11 @@ in stdenv.mkDerivation {
homepage = "https://github.com/solo5/solo5"; homepage = "https://github.com/solo5/solo5";
license = licenses.isc; license = licenses.isc;
maintainers = [ maintainers.ehmry ]; maintainers = [ maintainers.ehmry ];
platforms = lib.crossLists (arch: os: "${arch}-${os}") [ platforms = builtins.map ({arch, os}: "${arch}-${os}")
[ "aarch64" "x86_64" ] (cartesianProductOfSets {
[ "freebsd" "genode" "linux" "openbsd" ] arch = [ "aarch64" "x86_64" ];
]; os = [ "freebsd" "genode" "linux" "openbsd" ];
});
}; };
} }