Replace lib.crossLists with lib.cartesianProductOfSets

This commit is contained in:
Ehmry - 2021-01-30 11:16:14 +01:00
parent f12d27872a
commit 6f9f1b7069
3 changed files with 56 additions and 54 deletions

View File

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1611784459,
"narHash": "sha256-f5ZAW9dK/m2W2F+Gsb9nVuGTcVbnhkUezfaqWYaXAF8=",
"lastModified": 1611948132,
"narHash": "sha256-mH7hD1ps1FcRaVdP36jZWZFHdESVPY5rdTNJR16z7D4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5547b2f67042994ec0155cef24296681dc7fba5a",
"rev": "aa48e205a2e0516ff4b96c79eeb666aaaccd418c",
"type": "github"
},
"original": {

View File

@ -1,25 +1,27 @@
{
description = "Genode packages";
outputs = { self, nixpkgs }:
let
localSystems = [ "x86_64-linux" ];
crossSystems = [ "aarch64-genode" "x86_64-genode" ];
systems = {
localSystem = [ "x86_64-linux" ];
crossSystem = [ "aarch64-genode" "x86_64-genode" ];
};
systemSpace = nixpkgs.lib.cartesianProductOfSets systems;
forAllLocalSystems = f:
nixpkgs.lib.genAttrs localSystems (system: f system);
nixpkgs.lib.genAttrs systems.localSystem (system: f system);
forAllCrossSystems = f:
with builtins;
let
f' = localSystem: crossSystem:
f' = { localSystem, crossSystem }:
let system = localSystem + "-" + crossSystem;
in {
name = system;
value = f { inherit system localSystem crossSystem; };
};
list = nixpkgs.lib.lists.crossLists f' [ localSystems crossSystems ];
list = map f' systemSpace;
attrSet = listToAttrs list;
in attrSet;

View File

@ -7,7 +7,9 @@ let
testingPython = import ./lib/testing-python.nix;
testSpecs = map (p: import p) [
testSpace = lib.cartesianProductOfSets {
test = map (p: import p) [
./ahci.nix
./bash.nix
./hello.nix
@ -16,7 +18,8 @@ let
./x86.nix
];
cores = [
core = builtins.filter (core:
builtins.any (x: x == pkgs.stdenv.hostPlatform.system) core.platforms) [
/* {
prefix = "hw-pc-";
testingPython = testingPython {
@ -48,18 +51,15 @@ let
}
];
cores' = builtins.filter (core:
builtins.any (x: x == pkgs.stdenv.hostPlatform.system) core.platforms)
cores;
};
testList = let
f = core: test:
f = { core, test }:
if (test.constraints or (_: true)) core.specs then {
name = core.prefix + test.name;
value = core.testingPython.makeTest test;
} else
null;
in lib.lists.crossLists f [ cores' testSpecs ];
in map f testSpace;
in builtins.listToAttrs (builtins.filter (_: _ != null) testList)