Replace lib.crossLists with lib.cartesianProductOfSets
This commit is contained in:
parent
f12d27872a
commit
6f9f1b7069
|
@ -2,11 +2,11 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1611784459,
|
"lastModified": 1611948132,
|
||||||
"narHash": "sha256-f5ZAW9dK/m2W2F+Gsb9nVuGTcVbnhkUezfaqWYaXAF8=",
|
"narHash": "sha256-mH7hD1ps1FcRaVdP36jZWZFHdESVPY5rdTNJR16z7D4=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "5547b2f67042994ec0155cef24296681dc7fba5a",
|
"rev": "aa48e205a2e0516ff4b96c79eeb666aaaccd418c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
14
flake.nix
14
flake.nix
|
@ -1,25 +1,27 @@
|
||||||
{
|
{
|
||||||
description = "Genode packages";
|
description = "Genode packages";
|
||||||
|
|
||||||
|
|
||||||
outputs = { self, nixpkgs }:
|
outputs = { self, nixpkgs }:
|
||||||
let
|
let
|
||||||
localSystems = [ "x86_64-linux" ];
|
systems = {
|
||||||
crossSystems = [ "aarch64-genode" "x86_64-genode" ];
|
localSystem = [ "x86_64-linux" ];
|
||||||
|
crossSystem = [ "aarch64-genode" "x86_64-genode" ];
|
||||||
|
};
|
||||||
|
systemSpace = nixpkgs.lib.cartesianProductOfSets systems;
|
||||||
|
|
||||||
forAllLocalSystems = f:
|
forAllLocalSystems = f:
|
||||||
nixpkgs.lib.genAttrs localSystems (system: f system);
|
nixpkgs.lib.genAttrs systems.localSystem (system: f system);
|
||||||
|
|
||||||
forAllCrossSystems = f:
|
forAllCrossSystems = f:
|
||||||
with builtins;
|
with builtins;
|
||||||
let
|
let
|
||||||
f' = localSystem: crossSystem:
|
f' = { localSystem, crossSystem }:
|
||||||
let system = localSystem + "-" + crossSystem;
|
let system = localSystem + "-" + crossSystem;
|
||||||
in {
|
in {
|
||||||
name = system;
|
name = system;
|
||||||
value = f { inherit system localSystem crossSystem; };
|
value = f { inherit system localSystem crossSystem; };
|
||||||
};
|
};
|
||||||
list = nixpkgs.lib.lists.crossLists f' [ localSystems crossSystems ];
|
list = map f' systemSpace;
|
||||||
attrSet = listToAttrs list;
|
attrSet = listToAttrs list;
|
||||||
in attrSet;
|
in attrSet;
|
||||||
|
|
||||||
|
|
|
@ -7,59 +7,59 @@ let
|
||||||
|
|
||||||
testingPython = import ./lib/testing-python.nix;
|
testingPython = import ./lib/testing-python.nix;
|
||||||
|
|
||||||
testSpecs = map (p: import p) [
|
testSpace = lib.cartesianProductOfSets {
|
||||||
./ahci.nix
|
|
||||||
./bash.nix
|
|
||||||
./hello.nix
|
|
||||||
./log.nix
|
|
||||||
./vmm_x86.nix
|
|
||||||
./x86.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
cores = [
|
test = map (p: import p) [
|
||||||
/* {
|
./ahci.nix
|
||||||
prefix = "hw-pc-";
|
./bash.nix
|
||||||
testingPython = testingPython {
|
./hello.nix
|
||||||
inherit flake system localSystem crossSystem pkgs;
|
./log.nix
|
||||||
extraConfigurations = [ ../nixos-modules/base-hw-pc.nix ];
|
./vmm_x86.nix
|
||||||
};
|
./x86.nix
|
||||||
specs = [ "x86" "hw" ];
|
];
|
||||||
platforms = [ "x86_64-genode" ];
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/* {
|
|
||||||
prefix = "hw-virt_qemu-";
|
|
||||||
testingPython = testingPython {
|
|
||||||
inherit flake system localSystem crossSystem pkgs;
|
|
||||||
extraConfigurations = [ ../nixos-modules/base-hw-virt_qemu.nix ];
|
|
||||||
};
|
|
||||||
specs = [ "aarch64" "hw" ];
|
|
||||||
platforms = [ "aarch64-genode" ];
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
prefix = "nova-";
|
|
||||||
testingPython = testingPython {
|
|
||||||
inherit flake system localSystem crossSystem pkgs;
|
|
||||||
extraConfigurations = [ ../nixos-modules/nova.nix ];
|
|
||||||
};
|
|
||||||
specs = [ "x86" "nova" ];
|
|
||||||
platforms = [ "x86_64-genode" ];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
cores' = builtins.filter (core:
|
core = builtins.filter (core:
|
||||||
builtins.any (x: x == pkgs.stdenv.hostPlatform.system) core.platforms)
|
builtins.any (x: x == pkgs.stdenv.hostPlatform.system) core.platforms) [
|
||||||
cores;
|
/* {
|
||||||
|
prefix = "hw-pc-";
|
||||||
|
testingPython = testingPython {
|
||||||
|
inherit flake system localSystem crossSystem pkgs;
|
||||||
|
extraConfigurations = [ ../nixos-modules/base-hw-pc.nix ];
|
||||||
|
};
|
||||||
|
specs = [ "x86" "hw" ];
|
||||||
|
platforms = [ "x86_64-genode" ];
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
/* {
|
||||||
|
prefix = "hw-virt_qemu-";
|
||||||
|
testingPython = testingPython {
|
||||||
|
inherit flake system localSystem crossSystem pkgs;
|
||||||
|
extraConfigurations = [ ../nixos-modules/base-hw-virt_qemu.nix ];
|
||||||
|
};
|
||||||
|
specs = [ "aarch64" "hw" ];
|
||||||
|
platforms = [ "aarch64-genode" ];
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
prefix = "nova-";
|
||||||
|
testingPython = testingPython {
|
||||||
|
inherit flake system localSystem crossSystem pkgs;
|
||||||
|
extraConfigurations = [ ../nixos-modules/nova.nix ];
|
||||||
|
};
|
||||||
|
specs = [ "x86" "nova" ];
|
||||||
|
platforms = [ "x86_64-genode" ];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
testList = let
|
testList = let
|
||||||
f = core: test:
|
f = { core, test }:
|
||||||
if (test.constraints or (_: true)) core.specs then {
|
if (test.constraints or (_: true)) core.specs then {
|
||||||
name = core.prefix + test.name;
|
name = core.prefix + test.name;
|
||||||
value = core.testingPython.makeTest test;
|
value = core.testingPython.makeTest test;
|
||||||
} else
|
} else
|
||||||
null;
|
null;
|
||||||
|
in map f testSpace;
|
||||||
in lib.lists.crossLists f [ cores' testSpecs ];
|
|
||||||
|
|
||||||
in builtins.listToAttrs (builtins.filter (_: _ != null) testList)
|
in builtins.listToAttrs (builtins.filter (_: _ != null) testList)
|
||||||
|
|
Loading…
Reference in New Issue