2
0
Fork 0

Convert flake to a attrset of systems

This commit is contained in:
Emery Hemingway 2019-11-05 17:38:47 +01:00
parent 7eda0b9f55
commit 4aba5a4e85
10 changed files with 82 additions and 76 deletions

View File

@ -1,7 +1,7 @@
{
edition = 201909;
description = "Genode package overlay";
description = "Genode packages";
inputs = {
nixpkgs.uri = "git+https://gitea.c3d2.de/ehmry/nixpkgs.git";
@ -10,28 +10,24 @@
};
outputs = { self, nixpkgs, dhall-haskell }:
let fullPkgs = import ./packages.nix { nixpkgs = import nixpkgs; };
let
nixpkgs' = import nixpkgs;
systems = [ "x86_64-genode" ];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
in {
packages = with fullPkgs; {
inherit stdenv nova genode-os genode-base genode-base-nova
genode-base-linux solo5;
};
packages = forAllSystems (system:
import ./packages.nix {
inherit system;
nixpkgs = nixpkgs';
});
defaultPackage = self.packages.genode-os;
hydraJobs = {
build.x86_64 = {
inherit (self.packages)
nova stdenv solo5 genode-base-linux genode-base-nova genode-os;
};
tests = import ./tests {
checks = forAllSystems (system:
import ./tests {
inherit nixpkgs dhall-haskell;
genodepkgs = fullPkgs;
};
};
checks = { inherit (self.hydraJobs.tests.x86_64.nova) pci; };
genodepkgs = builtins.getAttr system self.packages;
});
};
}

View File

@ -2,36 +2,35 @@
#
# SPDX-License-Identifier: LicenseRef-Hippocratic-1.1
{ system ? "x86_64-genode", nixpkgs ? import <nixpkgs>, extraOverlays ? [ ] }:
let
nativeOverlay = self: super:
# Overlay of locally defined packages
with self;
let
toolchainOverlay = import ./toolchain-overlay;
# Overlay of toolchain patches
super = nixpkgs {
# Evaluate an overlayed Nixpkgs for a Genode target
localSystem = "x86_64-linux";
crossSystem = "x86_64-genode";
overlays = [ toolchainOverlay ] ++ extraOverlays;
};
inherit (super) callPackage;
genode = (callPackage ./upstream { } // {
libc = callPackage ./pkgs/libc { };
nic_bus = callPackage ./pkgs/nic_bus { };
});
dhallPackages = super.dhallPackages // (callPackage ./dhall { });
in {
in rec {
inherit (super) stdenv;
genode-base = genode.base;
genode-base-linux = genode.base-linux;
genode-base-nova = genode.base-nova;
genode-os = genode.os;
depot = callPackage ./depot { };
dhallGenode = dhallPackages.genode;
dhallPrelude = dhallPackages.prelude;
nova = callPackage ./NOVA { };
solo5 = callPackage ./pkgs/solo5 { };
};
toolchainOverlay = import ./toolchain-overlay;
# Overlay of toolchain patches
in { nixpkgs ? import <nixpkgs>, extraOverlays ? [ ] }:
nixpkgs {
# Evaluate an overlayed Nixpkgs for a Genode target
localSystem = "x86_64-linux";
crossSystem = "x86_64-genode";
overlays = [ toolchainOverlay nativeOverlay ] ++ extraOverlays;
solo5 = callPackage ./pkgs/solo5 { inherit genode-base genode-os; };
}

View File

@ -8,7 +8,7 @@ let
libc = call ./libc.nix { };
log = call ./log.nix { };
signal = call ./signal.nix { };
solo5 = call ./solo5 { };
# solo5 = call ./solo5 { };
};
in { genodepkgs, nixpkgs, dhall-haskell }:
@ -18,6 +18,7 @@ let
system = "x86_64-linux";
overlays = [ (self: super: { inherit (dhall-haskell.packages) dhall; }) ];
};
depot = hostPkgs.callPackage ../depot { };
testPkgs = genodepkgs;
lib = hostPkgs.lib // {
@ -50,11 +51,19 @@ let
'';
};
in {
x86_64 = {
linux = tests
(import ./driver-linux.nix { inherit testPkgs hostPkgs lib; }).callTest;
linux = tests (import ./driver-linux.nix {
inherit testPkgs hostPkgs lib depot;
}).callTest;
nova = (call: ((tests call) // { pci = call ./pci.nix { }; }))
(import ./driver-nova.nix { inherit testPkgs hostPkgs lib; }).callTest;
};
}
(import ./driver-nova.nix {
inherit testPkgs hostPkgs lib depot;
}).callTest;
testsToList = tests:
map (test: {
inherit (test) name;
value = test;
}) (builtins.attrValues tests);
in with builtins; listToAttrs (concatLists (map (testsToList) [ linux nova ]))

View File

@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: LicenseRef-Hippocratic-1.1
{ testPkgs, hostPkgs, lib }:
{ testPkgs, hostPkgs, lib, depot }:
let
testDriver = with hostPkgs;
@ -23,7 +23,7 @@ let
runTests = driver:
hostPkgs.stdenv.mkDerivation {
name = "test-run-${driver.testName}";
name = "linux-"+driver.testName;
preferLocalBuild = true;
buildCommand = ''
@ -42,10 +42,10 @@ let
bootModules' = {
inherit testConfig;
config = ./driver-config.xml;
core = "${genode.base-linux}/bin/core-linux";
init = "${genode.os}/bin/init";
core = "${genode-base-linux}/bin/core-linux";
init = "${genode-os}/bin/init";
"ld.lib.so" = "${depot.base-linux}/lib/ld.lib.so";
timer = "${genode.base-linux}/bin/linux_timer_drv";
timer = "${genode-base-linux}/bin/linux_timer_drv";
} // bootModules;
baseSetup = with builtins;
@ -92,5 +92,6 @@ in {
isNova = false;
};
pkgs = testPkgs;
inherit depot;
} // args));
}

View File

@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: LicenseRef-Hippocratic-1.1
{ testPkgs, hostPkgs, lib }:
{ testPkgs, hostPkgs, lib, depot }:
let
testDriver = with hostPkgs;
@ -23,7 +23,7 @@ let
runTests = driver:
hostPkgs.stdenv.mkDerivation {
name = "test-run-${driver.testName}";
name = "nova-"+driver.testName;
preferLocalBuild = true;
buildCommand = ''
@ -147,5 +147,6 @@ in {
isNova = true;
};
pkgs = testPkgs;
inherit depot;
} // args));
}

View File

@ -1,4 +1,4 @@
{ testEnv, pkgs }:
{ testEnv, pkgs, ... }:
with pkgs;
testEnv.mkTest {
@ -8,11 +8,11 @@ testEnv.mkTest {
testConfig = ./fs_report.xml;
bootModules = {
fs_report = "${genode.os}/bin/fs_report";
fs_rom = "${genode.os}/bin/fs_rom";
ram_fs = "${genode.os}/bin/ram_fs";
test-fs_report = "${genode.os}/bin/test-fs_report";
"vfs.lib.so" = "${genode.os}/lib/vfs.lib.so";
fs_report = "${genode-os}/bin/fs_report";
fs_rom = "${genode-os}/bin/fs_rom";
ram_fs = "${genode-os}/bin/ram_fs";
test-fs_report = "${genode-os}/bin/test-fs_report";
"vfs.lib.so" = "${genode-os}/lib/vfs.lib.so";
};
testScript = ''

View File

@ -1,4 +1,4 @@
{ testEnv, pkgs }:
{ testEnv, pkgs, depot }:
with pkgs;
testEnv.mkTest rec {
@ -12,7 +12,7 @@ testEnv.mkTest rec {
"libm.lib.so" = "${depot.libc}/lib/libm.lib.so";
"posix.lib.so" = "${depot.posix}/lib/posix.lib.so";
"test-libc" = "${depot.test-libc}/bin/test-libc";
"vfs.lib.so" = "${genode.os}/lib/vfs.lib.so";
"vfs.lib.so" = "${genode-os}/lib/vfs.lib.so";
};
qemuMem = 384;

View File

@ -1,4 +1,4 @@
{ testEnv, pkgs }:
{ testEnv, pkgs, ... }:
with pkgs;
testEnv.mkTest rec {
@ -7,7 +7,7 @@ testEnv.mkTest rec {
testConfig = testEnv.lib.renderDhallInit ./log.dhall "{=}";
bootModules.test-log = "${genode.base}/bin/test-log";
bootModules.test-log = "${genode-base}/bin/test-log";
testScript = "run_genode_until {Test done.} 10";
}

View File

@ -1,4 +1,4 @@
{ testEnv, pkgs }:
{ testEnv, pkgs, ... }:
with pkgs;
testEnv.mkTest {

View File

@ -1,4 +1,4 @@
{ testEnv, pkgs }:
{ testEnv, pkgs, ... }:
with pkgs;
testEnv.mkTest rec {
@ -7,7 +7,7 @@ testEnv.mkTest rec {
testConfig = testEnv.lib.renderDhallInit ./signal.dhall "{=}";
bootModules.test-signal = "${genode.os}/bin/test-signal";
bootModules.test-signal = "${genode-os}/bin/test-signal";
testScript = "run_genode_until {--- Signalling test finished ---} 120";
}