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 { 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 { nixpkgs.lib // (import ./lib {
inherit system localSystem crossSystem; inherit system localSystem crossSystem;
apps = self.apps.${system}; apps = self.apps.${system};
@ -65,15 +69,24 @@
nixpkgs = nixpkgsFor.${system}; nixpkgs = nixpkgsFor.${system};
})); }));
legacyPackages = forAllSystems legacyPackages =
# The nixpkgs.legacyPackages after overlaying
# and with some additional Genode packages
forAllSystems
({ system, localSystem, crossSystem }: nixpkgsFor.${system}); ({ system, localSystem, crossSystem }: nixpkgsFor.${system});
# pass thru Nixpkgs # 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) nixpkgs.lib.filterAttrs (n: v: v != null)
nixpkgsFor.${system}.genodePackages); nixpkgsFor.${system}.genodePackages);
devShell = forAllLocalSystems (system: devShell =
# Development shell for working with the
# upstream Genode source repositories
forAllLocalSystems (system:
let let
pkgs = nixpkgsFor.${system}; pkgs = nixpkgsFor.${system};
fhs = pkgs.buildFHSUserEnv { fhs = pkgs.buildFHSUserEnv {
@ -108,7 +121,9 @@
shellHook = "exec genode-env"; shellHook = "exec genode-env";
}); });
apps = let apps =
# Utilities accessible via "nix run"
let
apps' = forAllCrossSystems ({ system, localSystem, crossSystem }: apps' = forAllCrossSystems ({ system, localSystem, crossSystem }:
import ./apps { import ./apps {
inherit system; inherit system;
@ -125,9 +140,13 @@
}); });
in apps' // { x86_64-linux = apps'.x86_64-linux-x86_64-genode; }; 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 }: checks' = forAllCrossSystems ({ system, localSystem, crossSystem }:
let let
@ -138,8 +157,6 @@
({ modulesPath, ... }: { ({ modulesPath, ... }: {
imports = [ "${modulesPath}/virtualisation/qemu-vm.nix" ]; imports = [ "${modulesPath}/virtualisation/qemu-vm.nix" ];
boot.loader.grub.extraEntriesBeforeNixOS = true; boot.loader.grub.extraEntriesBeforeNixOS = true;
genode.inputFilter.extraChargen =
"${./nixos-modules/dhall/workman.chargen.dhall}";
virtualisation = { virtualisation = {
cores = 2; cores = 2;
memorySize = 1024; memorySize = 1024;
@ -188,8 +205,11 @@
memorySize = 1024; memorySize = 1024;
useBootLoader = true; useBootLoader = true;
qemu = { qemu = {
options = options = [
[ "-machine q35" "-cpu phenom" "-serial mon:stdio" ]; "-machine q35"
"-cpu phenom"
"-serial mon:stdio"
];
networkingOptions = [ networkingOptions = [
"-net nic,netdev=user.0,model=e1000" "-net nic,netdev=user.0,model=e1000"
"-netdev user,id=user.0\${QEMU_NET_OPTS:+,$QEMU_NET_OPTS}" "-netdev user,id=user.0\${QEMU_NET_OPTS:+,$QEMU_NET_OPTS}"
@ -229,7 +249,10 @@
in nixos.config.system.build.vm; 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 else
throw "unknown Genode arch for platform ${platform.system}"; throw "unknown Genode arch for platform ${platform.system}";
genodeSources = let genodeSources =
# The Genode source repository
let
toolPrefix = if platform.isx86 then toolPrefix = if platform.isx86 then
"genode-x86-" "genode-x86-"
@ -58,7 +60,9 @@ let
stdenv' = stdenv' =
targetPackages.stdenvAdapters.overrideCC targetPackages.stdenv toolchain; targetPackages.stdenvAdapters.overrideCC targetPackages.stdenv toolchain;
preparePort = name: preparePort =
# Prepare a "port" of source code declared in the Genode sources
name:
{ hash ? "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" { hash ? "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
, patches ? [ ], ... }@args: , patches ? [ ], ... }@args:
let let
@ -118,9 +122,10 @@ let
ports = stdenv.lib.mapAttrs preparePort ports = stdenv.lib.mapAttrs preparePort
(import ./ports.nix { inherit buildPackages; }); (import ./ports.nix { inherit buildPackages; });
buildUpstream = { name, targets, portInputs ? [ ], nativeBuildInputs ? [ ] buildUpstream =
, patches ? [ ], enableParallelBuilding ? true, meta ? { }, ... # Build from the Genode sources
}@extraAttrs: { name, targets, portInputs ? [ ], nativeBuildInputs ? [ ], patches ? [ ]
, enableParallelBuilding ? true, meta ? { }, ... }@extraAttrs:
let havePatches = patches != [ ]; let havePatches = patches != [ ];
in stdenv'.mkDerivation (extraAttrs // { in stdenv'.mkDerivation (extraAttrs // {
@ -164,8 +169,10 @@ let
meta = { platforms = stdenv.lib.platforms.genode; } // meta; meta = { platforms = stdenv.lib.platforms.genode; } // meta;
}); });
buildDepot = { name, apiOnly ? false, portInputs ? [ ] buildDepot =
, nativeBuildInputs ? [ ], meta ? { }, ... }@extraAttrs: # Build a Depot target from the Genode sources
{ name, apiOnly ? false, portInputs ? [ ], nativeBuildInputs ? [ ]
, meta ? { }, ... }@extraAttrs:
stdenv'.mkDerivation (extraAttrs // { stdenv'.mkDerivation (extraAttrs // {
pname = name; pname = name;
@ -239,7 +246,9 @@ let
++ lib.optional isx86_64 "x86_64"; ++ 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"; name = "base";
targets = [ "LIB=vfs" ]; targets = [ "LIB=vfs" ];
postInstall = 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 }: { buildPackages }:
with buildPackages; { with buildPackages; {
dde_bsd.hash = "sha256-2ilZs6JkcQAvU/sQYnHunGtGRZDt7qLTpKZxQxSOf2I="; 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 }: { buildPackages, ports }:
with ports; with ports;
let let
@ -58,8 +61,7 @@ in {
stdcxx.portInputs = [ libc stdcxx ]; stdcxx.portInputs = [ libc stdcxx ];
# The following are tests that never exit # The following are tests are patched to exit at completion
# and have no conventions on log output.
"test-log".patches = [ ./test-log.patch ]; "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)