diff --git a/flake.nix b/flake.nix index bd27d8d..d733b4d 100644 --- a/flake.nix +++ b/flake.nix @@ -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; + }); }; } - diff --git a/packages.nix b/packages.nix index 826a8de..3d08bd2 100644 --- a/packages.nix +++ b/packages.nix @@ -2,36 +2,35 @@ # # SPDX-License-Identifier: LicenseRef-Hippocratic-1.1 -let - nativeOverlay = self: super: - # Overlay of locally defined packages - with self; - let - genode = (callPackage ./upstream { } // { - libc = callPackage ./pkgs/libc { }; - nic_bus = callPackage ./pkgs/nic_bus { }; - }); - dhallPackages = super.dhallPackages // (callPackage ./dhall { }); - in { - 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 { }; - }; +{ system ? "x86_64-genode", nixpkgs ? import , extraOverlays ? [ ] }: +let toolchainOverlay = import ./toolchain-overlay; # Overlay of toolchain patches -in { nixpkgs ? import , extraOverlays ? [ ] }: + super = nixpkgs { + # Evaluate an overlayed Nixpkgs for a Genode target + localSystem = "x86_64-linux"; + crossSystem = "x86_64-genode"; + overlays = [ toolchainOverlay ] ++ extraOverlays; + }; -nixpkgs { - # Evaluate an overlayed Nixpkgs for a Genode target - localSystem = "x86_64-linux"; - crossSystem = "x86_64-genode"; - overlays = [ toolchainOverlay nativeOverlay ] ++ extraOverlays; + inherit (super) callPackage; + + genode = (callPackage ./upstream { } // { + libc = callPackage ./pkgs/libc { }; + nic_bus = callPackage ./pkgs/nic_bus { }; + }); + dhallPackages = super.dhallPackages // (callPackage ./dhall { }); +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; + + dhallGenode = dhallPackages.genode; + dhallPrelude = dhallPackages.prelude; + nova = callPackage ./NOVA { }; + solo5 = callPackage ./pkgs/solo5 { inherit genode-base genode-os; }; } diff --git a/tests/default.nix b/tests/default.nix index 8439fde..effac0a 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -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; - nova = (call: ((tests call) // { pci = call ./pci.nix { }; })) - (import ./driver-nova.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 depot; + }).callTest; + + testsToList = tests: + map (test: { + inherit (test) name; + value = test; + }) (builtins.attrValues tests); + +in with builtins; listToAttrs (concatLists (map (testsToList) [ linux nova ])) diff --git a/tests/driver-linux.nix b/tests/driver-linux.nix index fb1a742..8bfaa9c 100644 --- a/tests/driver-linux.nix +++ b/tests/driver-linux.nix @@ -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)); } diff --git a/tests/driver-nova.nix b/tests/driver-nova.nix index 76d6b66..963aaaa 100644 --- a/tests/driver-nova.nix +++ b/tests/driver-nova.nix @@ -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)); } diff --git a/tests/fs_report.nix b/tests/fs_report.nix index d3ccc8d..b4f6a5b 100644 --- a/tests/fs_report.nix +++ b/tests/fs_report.nix @@ -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 = '' diff --git a/tests/libc.nix b/tests/libc.nix index 2a3afb3..d7a6f2c 100644 --- a/tests/libc.nix +++ b/tests/libc.nix @@ -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; diff --git a/tests/log.nix b/tests/log.nix index 486b2f6..ead29cc 100644 --- a/tests/log.nix +++ b/tests/log.nix @@ -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"; } diff --git a/tests/pci.nix b/tests/pci.nix index 2e200ab..5bf7bb9 100644 --- a/tests/pci.nix +++ b/tests/pci.nix @@ -1,4 +1,4 @@ -{ testEnv, pkgs }: +{ testEnv, pkgs, ... }: with pkgs; testEnv.mkTest { diff --git a/tests/signal.nix b/tests/signal.nix index 5c99b57..259126c 100644 --- a/tests/signal.nix +++ b/tests/signal.nix @@ -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"; }