diff options
author | Silvan Mosberger <contact@infinisil.com> | 2021-01-29 20:22:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-29 20:22:12 +0100 |
commit | aa48e205a2e0516ff4b96c79eeb666aaaccd418c (patch) | |
tree | 4e8f6542985139c8e498057dcbdbfd6fea0c3648 /nixos | |
parent | 417b19df406ae6106d80a6c551787cd13d0299dd (diff) | |
parent | 577d58a8e01aead5eb237d39a6d7df1fb7aa00c4 (diff) |
Merge pull request #110787 from tfc/cartesian-product
lib/attrsets: add cartesianProductOfSets function
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/x11/display-managers/default.nix | 6 | ||||
-rw-r--r-- | nixos/tests/predictable-interface-names.nix | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix index 6945a241f92f..9fdbe753dad5 100644 --- a/nixos/modules/services/x11/display-managers/default.nix +++ b/nixos/modules/services/x11/display-managers/default.nix @@ -444,8 +444,8 @@ in in # We will generate every possible pair of WM and DM. concatLists ( - crossLists - (dm: wm: let + builtins.map + ({dm, wm}: let sessionName = "${dm.name}${optionalString (wm.name != "none") ("+" + wm.name)}"; script = xsession dm wm; desktopNames = if dm ? desktopNames @@ -472,7 +472,7 @@ in providedSessions = [ sessionName ]; }) ) - [dms wms] + (cartesianProductOfSets { dm = dms; wm = wms; }) ); # Make xsessions and wayland sessions available in XDG_DATA_DIRS diff --git a/nixos/tests/predictable-interface-names.nix b/nixos/tests/predictable-interface-names.nix index bab091d57acf..c0b472638a14 100644 --- a/nixos/tests/predictable-interface-names.nix +++ b/nixos/tests/predictable-interface-names.nix @@ -5,7 +5,11 @@ let 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" + pkgs.lib.optionalString withNetworkd "Networkd"; 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") ''; }; -}) [[true false] [true false]]) +}) testCombinations) |