2
0
Fork 0

Documentation and cleanup

This commit is contained in:
Ehmry - 2020-08-02 16:46:34 +02:00
parent f54b0c7d51
commit 4f74ff9452
7 changed files with 244 additions and 249 deletions

View File

@ -55,9 +55,13 @@
in rec {
overlay = import ./overlay;
overlay =
# Overlay of fixes applied to Nixpkgs
import ./overlay;
lib = forAllCrossSystems ({ system, localSystem, crossSystem }:
lib =
# Local utilities merged with the Nixpkgs lib
forAllCrossSystems ({ system, localSystem, crossSystem }:
nixpkgs.lib // (import ./lib {
inherit system localSystem crossSystem;
apps = self.apps.${system};
@ -65,15 +69,24 @@
nixpkgs = nixpkgsFor.${system};
}));
legacyPackages = forAllSystems
legacyPackages =
# The nixpkgs.legacyPackages after overlaying
# and with some additional Genode packages
forAllSystems
({ system, localSystem, crossSystem }: nixpkgsFor.${system});
# pass thru Nixpkgs
packages = forAllCrossSystems ({ system, localSystem, crossSystem }:
packages =
# Genode native packages, not packages in the traditional
# sense in that these cannot be installed within a profile
forAllCrossSystems ({ system, localSystem, crossSystem }:
nixpkgs.lib.filterAttrs (n: v: v != null)
nixpkgsFor.${system}.genodePackages);
devShell = forAllLocalSystems (system:
devShell =
# Development shell for working with the
# upstream Genode source repositories
forAllLocalSystems (system:
let
pkgs = nixpkgsFor.${system};
fhs = pkgs.buildFHSUserEnv {
@ -108,7 +121,9 @@
shellHook = "exec genode-env";
});
apps = let
apps =
# Utilities accessible via "nix run"
let
apps' = forAllCrossSystems ({ system, localSystem, crossSystem }:
import ./apps {
inherit system;
@ -125,9 +140,13 @@
});
in apps' // { x86_64-linux = apps'.x86_64-linux-x86_64-genode; };
nixosModules = import ./nixos-modules { inherit self; };
nixosModules =
# Modules for composing Genode and NixOS
import ./nixos-modules { inherit self; };
checks = let
checks =
# Checks for continous testing
let
checks' = forAllCrossSystems ({ system, localSystem, crossSystem }:
let
@ -138,8 +157,6 @@
({ modulesPath, ... }: {
imports = [ "${modulesPath}/virtualisation/qemu-vm.nix" ];
boot.loader.grub.extraEntriesBeforeNixOS = true;
genode.inputFilter.extraChargen =
"${./nixos-modules/dhall/workman.chargen.dhall}";
virtualisation = {
cores = 2;
memorySize = 1024;
@ -188,8 +205,11 @@
memorySize = 1024;
useBootLoader = true;
qemu = {
options =
[ "-machine q35" "-cpu phenom" "-serial mon:stdio" ];
options = [
"-machine q35"
"-cpu phenom"
"-serial mon:stdio"
];
networkingOptions = [
"-net nic,netdev=user.0,model=e1000"
"-netdev user,id=user.0\${QEMU_NET_OPTS:+,$QEMU_NET_OPTS}"
@ -229,7 +249,10 @@
in nixos.config.system.build.vm;
});
in { x86_64-linux = checks'.x86_64-linux-x86_64-genode; };
in {
aarch64-linux = checks'.aarch64-linux-aarch64-genode;
x86_64-linux = checks'.x86_64-linux-x86_64-genode;
};
};
}

View File

@ -16,7 +16,9 @@ let
else
throw "unknown Genode arch for platform ${platform.system}";
genodeSources = let
genodeSources =
# The Genode source repository
let
toolPrefix = if platform.isx86 then
"genode-x86-"
@ -58,7 +60,9 @@ let
stdenv' =
targetPackages.stdenvAdapters.overrideCC targetPackages.stdenv toolchain;
preparePort = name:
preparePort =
# Prepare a "port" of source code declared in the Genode sources
name:
{ hash ? "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
, patches ? [ ], ... }@args:
let
@ -118,9 +122,10 @@ let
ports = stdenv.lib.mapAttrs preparePort
(import ./ports.nix { inherit buildPackages; });
buildUpstream = { name, targets, portInputs ? [ ], nativeBuildInputs ? [ ]
, patches ? [ ], enableParallelBuilding ? true, meta ? { }, ...
}@extraAttrs:
buildUpstream =
# Build from the Genode sources
{ name, targets, portInputs ? [ ], nativeBuildInputs ? [ ], patches ? [ ]
, enableParallelBuilding ? true, meta ? { }, ... }@extraAttrs:
let havePatches = patches != [ ];
in stdenv'.mkDerivation (extraAttrs // {
@ -164,8 +169,10 @@ let
meta = { platforms = stdenv.lib.platforms.genode; } // meta;
});
buildDepot = { name, apiOnly ? false, portInputs ? [ ]
, nativeBuildInputs ? [ ], meta ? { }, ... }@extraAttrs:
buildDepot =
# Build a Depot target from the Genode sources
{ name, apiOnly ? false, portInputs ? [ ], nativeBuildInputs ? [ ]
, meta ? { }, ... }@extraAttrs:
stdenv'.mkDerivation (extraAttrs // {
pname = name;
@ -239,7 +246,9 @@ let
++ lib.optional isx86_64 "x86_64";
genodeBase = buildUpstream {
genodeBase =
# A package containing the Genode C++ headers, a stub ld.lib.so and libvfs.lib.so
buildUpstream {
name = "base";
targets = [ "LIB=vfs" ];
postInstall =

View File

@ -1,3 +1,6 @@
# This file specifies the output hashes of "Ports".
# Ports not listed here can still be prepared, but will result in a hash mismatch.
{ buildPackages }:
with buildPackages; {
dde_bsd.hash = "sha256-2ilZs6JkcQAvU/sQYnHunGtGRZDt7qLTpKZxQxSOf2I=";

View File

@ -1,3 +1,6 @@
# This file contains overrides necesarry to build some Make and Depot targets.
# Many targets can be built with the default attributes, and are not listed here.
{ buildPackages, ports }:
with ports;
let
@ -58,8 +61,7 @@ in {
stdcxx.portInputs = [ libc stdcxx ];
# The following are tests that never exit
# and have no conventions on log output.
# The following are tests are patched to exit at completion
"test-log".patches = [ ./test-log.patch ];

View File

@ -1,5 +0,0 @@
#!/usr/bin/env expect
eval $env(baseSetup)
eval $env(testScript)

View File

@ -1,5 +0,0 @@
#!/usr/bin/env expect
eval $env(baseSetup)
eval $env(testScript)

View File

@ -1,32 +0,0 @@
#! /usr/bin/env expect
##
# Wait for a specific output of a already running spawned process
#
proc wait_for_output { wait_for_re timeout_value running_spawn_id } {
global output
if {$wait_for_re == "forever"} {
set timeout -1
interact {
\003 {
send_user "Expect: 'interact' received 'strg+c' and was cancelled\n";
exit
}
-i $running_spawn_id
}
} else {
set timeout $timeout_value
}
expect {
-i $running_spawn_id -re $wait_for_re { }
eof { puts stderr "Error: Spawned process died unexpectedly"; exit -1 }
timeout { puts stderr "Error: Test execution timed out"; exit -1 }
}
set output $expect_out(buffer)
}
eval $env(baseSetup)
eval $env(testScript)