Prune dead code, improve readibility, update README
This commit is contained in:
parent
4df8ba5a63
commit
43989b1e0f
17
README.md
17
README.md
|
@ -4,8 +4,12 @@ This repo contains Nix expressions for building Genode with Nixpkgs and building
|
||||||
Nixpkgs for Genode. At the moment the former is experimental and broken in many
|
Nixpkgs for Genode. At the moment the former is experimental and broken in many
|
||||||
cases, the later is probably broken for all cases.
|
cases, the later is probably broken for all cases.
|
||||||
|
|
||||||
Furthermore, this repository is structured as a Nim flake, with is in itself an
|
Furthermore, this repository is structured as a Nix flake, with is in itself an
|
||||||
experimental extension of the Nix utility.
|
experimental extension of the Nix utility. The flakes capable `nix` frontend is
|
||||||
|
available from Nixpkgs as `nixFlakes`. It is possible to bootstrap to flakes by
|
||||||
|
installing Nix on a standard Linux distro, followed by `nix-env -i nixFlakes`.
|
||||||
|
Flakes are available from NixOS using the following expression:
|
||||||
|
`{ pkgs, ... }: { nix.package = pkgs.nixFlakes; }`
|
||||||
|
|
||||||
## Toolchain
|
## Toolchain
|
||||||
|
|
||||||
|
@ -13,7 +17,10 @@ The LLVM cross-compiler may useful already, Clang apparently builds trivial
|
||||||
Genode componenents without serious problems. Bootstrapping GCC is not practical
|
Genode componenents without serious problems. Bootstrapping GCC is not practical
|
||||||
due to the recursive autotools build system.
|
due to the recursive autotools build system.
|
||||||
|
|
||||||
To compiler environment for x86_64 may be accessed by invoking `nix devShell`.
|
The compiler environment for x86_64 should be accessible from the `stdenv` at
|
||||||
|
the path `.#packages.x86_64-linux-x86_64-genode.stdenv`. There is currently no
|
||||||
|
recommendations for integrating the compiler within external build systems.
|
||||||
|
|
||||||
Bootstrapping the environment on a laptop can take hours. Get yourself a
|
Bootstrapping the LLVM toolchain on a laptop can take hours, so personally I
|
||||||
[Hydra](https://nixos.org/hydra/).
|
farm out the builds. If you interested in binaries please contact me and we can
|
||||||
|
setup a cache.
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
let dhall-haskell = import <dhall-haskell>;
|
|
||||||
in { linux-dhall = dhall-haskell.dhall; }
|
|
|
@ -1,67 +0,0 @@
|
||||||
let
|
|
||||||
fetchNixpkgs =
|
|
||||||
{ rev # The Git revision of nixpkgs to fetch
|
|
||||||
, owner ? "NixOS" # Owner of the Github repository
|
|
||||||
, sha256 # The SHA256 hash of the unpacked archive
|
|
||||||
, system ? builtins.currentSystem # This is overridable if necessary
|
|
||||||
}:
|
|
||||||
|
|
||||||
if (0 <= builtins.compareVersions builtins.nixVersion "1.12")
|
|
||||||
|
|
||||||
# In Nix 1.12, we can just give a `sha256` to `builtins.fetchTarball`.
|
|
||||||
then
|
|
||||||
(builtins.fetchTarball {
|
|
||||||
url = "https://github.com/${owner}/nixpkgs/archive/${rev}.tar.gz";
|
|
||||||
inherit sha256;
|
|
||||||
})
|
|
||||||
|
|
||||||
# This hack should at least work for Nix 1.11
|
|
||||||
else
|
|
||||||
((rec {
|
|
||||||
tarball = import <nix/fetchurl.nix> {
|
|
||||||
url = "https://github.com/${owner}/nixpkgs/archive/${rev}.tar.gz";
|
|
||||||
sha256 = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
builtin-paths = import <nix/config.nix>;
|
|
||||||
|
|
||||||
script = builtins.toFile "nixpkgs-unpacker" ''
|
|
||||||
"$coreutils/mkdir" "$out"
|
|
||||||
cd "$out"
|
|
||||||
"$gzip" --decompress < "$tarball" | "$tar" -x --strip-components=1
|
|
||||||
'';
|
|
||||||
|
|
||||||
nixpkgs = builtins.derivation ({
|
|
||||||
name = "nixpkgs-${builtins.substring 0 6 rev}";
|
|
||||||
|
|
||||||
builder = builtins.storePath builtin-paths.shell;
|
|
||||||
|
|
||||||
args = [ script ];
|
|
||||||
|
|
||||||
inherit tarball system;
|
|
||||||
|
|
||||||
tar = builtins.storePath builtin-paths.tar;
|
|
||||||
gzip = builtins.storePath builtin-paths.gzip;
|
|
||||||
coreutils = builtins.storePath builtin-paths.coreutils;
|
|
||||||
} // (if null == sha256 then
|
|
||||||
{ }
|
|
||||||
else {
|
|
||||||
outputHashMode = "recursive";
|
|
||||||
outputHashAlgo = "sha256";
|
|
||||||
outputHash = sha256;
|
|
||||||
}));
|
|
||||||
}).nixpkgs);
|
|
||||||
in {
|
|
||||||
|
|
||||||
nixpkgs = fetchNixpkgs {
|
|
||||||
rev = "1d4de0d552ae9aa66a5b8dee5fb0650a4372d148";
|
|
||||||
sha256 = "0xpqc1fhkvvv5dv1zmas2j1q27mi7j7dgyjcdh82mlgl1q63i660";
|
|
||||||
};
|
|
||||||
|
|
||||||
nixpkgsStaticLinux = fetchNixpkgs {
|
|
||||||
owner = "nh2";
|
|
||||||
rev = "925aac04f4ca58aceb83beef18cb7dae0715421b";
|
|
||||||
sha256 = "1zr8lscjl2a5cz61f0ibyx55a94v8yyp6sjzjl2gkqjrjbg99abx";
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
13
flake.nix
13
flake.nix
|
@ -34,7 +34,8 @@
|
||||||
inherit system nixpkgs;
|
inherit system nixpkgs;
|
||||||
depot = thisSystem genode-depot.packages;
|
depot = thisSystem genode-depot.packages;
|
||||||
genode = thisSystem genode.packages;
|
genode = thisSystem genode.packages;
|
||||||
} // thisSystem genode.packages);
|
} // thisSystem genode.packages) //
|
||||||
|
{ x86_64-linux = self.packages.x86_64-linux-x86_64-genode; };
|
||||||
|
|
||||||
defaultPackage.x86_64-linux =
|
defaultPackage.x86_64-linux =
|
||||||
self.packages.x86_64-linux-x86_64-genode.base-linux;
|
self.packages.x86_64-linux-x86_64-genode.base-linux;
|
||||||
|
@ -51,11 +52,11 @@
|
||||||
x86_64-linux.nixos =
|
x86_64-linux.nixos =
|
||||||
let pkgs' = nixpkgs.legacyPackages.x86_64-linux // { };
|
let pkgs' = nixpkgs.legacyPackages.x86_64-linux // { };
|
||||||
in import ./nixos/test.nix {
|
in import ./nixos/test.nix {
|
||||||
inherit self;
|
system = "x86_64-linux";
|
||||||
nixpkgs = nixpkgs.outPath;
|
depot = genode-depot;
|
||||||
genodepkgs = self.packages.x86_64-linux-x86_64-genode;
|
genodepkgs = self;
|
||||||
depot = genode-depot.packages.x86_64-linux-x86_64-genode;
|
inherit nixpkgs;
|
||||||
} { system = "x86_64-linux"; };
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nixosModule = import ./nixos;
|
nixosModule = import ./nixos;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
{ self, nixpkgs, genodepkgs, depot }:
|
{ system, depot, genodepkgs, nixpkgs, }:
|
||||||
|
|
||||||
import (nixpkgs + "/nixos/tests/make-test.nix") ({ pkgs, ... }:
|
import "${nixpkgs}/nixos/tests/make-test.nix" (
|
||||||
|
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
name = "genode-base-linux";
|
name = "genode-base-linux";
|
||||||
|
@ -8,9 +10,12 @@ import (nixpkgs + "/nixos/tests/make-test.nix") ({ pkgs, ... }:
|
||||||
machine =
|
machine =
|
||||||
|
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
let
|
||||||
{
|
flakePackages = flake:
|
||||||
imports = [ "${self.outPath}/nixos" ];
|
with builtins;
|
||||||
|
getAttr config.nixpkgs.system (getAttr "packages" flake);
|
||||||
|
in {
|
||||||
|
imports = [ "${genodepkgs}/nixos" ];
|
||||||
genode = {
|
genode = {
|
||||||
signal-test = {
|
signal-test = {
|
||||||
config = ''
|
config = ''
|
||||||
|
@ -35,9 +40,12 @@ import (nixpkgs + "/nixos/tests/make-test.nix") ({ pkgs, ... }:
|
||||||
</start>
|
</start>
|
||||||
</config>
|
</config>
|
||||||
'';
|
'';
|
||||||
depot = depot;
|
depot = flakePackages depot;
|
||||||
pkgs = genodepkgs;
|
pkgs = flakePackages genodepkgs;
|
||||||
rom = { "test-signal" = "${genodepkgs.os}/bin/test-signal"; };
|
rom = {
|
||||||
|
"test-signal" =
|
||||||
|
"${config.genode.signal-test.pkgs.os}/bin/test-signal";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -46,4 +54,4 @@ import (nixpkgs + "/nixos/tests/make-test.nix") ({ pkgs, ... }:
|
||||||
$machine->waitUntilSucceeds("journalctl -u signal-test | grep -q -i -- '--- Signalling test finished ---'");
|
$machine->waitUntilSucceeds("journalctl -u signal-test | grep -q -i -- '--- Signalling test finished ---'");
|
||||||
'';
|
'';
|
||||||
|
|
||||||
})
|
}) { inherit system; }
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
# A branch of Nixpkgs with a custom "crossSystem" mechanism
|
|
||||||
builtins.fetchGit {
|
|
||||||
url = "https://github.com/ehmry/nixpkgs.git";
|
|
||||||
ref = "hybrid-19.09";
|
|
||||||
rev = "2b64c2dc19f16b9d126f6c48deecf084ae0b27fc";
|
|
||||||
}
|
|
21
platform.nix
21
platform.nix
|
@ -1,21 +0,0 @@
|
||||||
# SPDX-FileCopyrightText: Emery Hemingway
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: LicenseRef-Hippocratic-1.1
|
|
||||||
|
|
||||||
{ platform, execFormats, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
f = { isGenode ? false, ... }:
|
|
||||||
if isGenode then {
|
|
||||||
uname.system = "Genode";
|
|
||||||
useLLVM = true;
|
|
||||||
kernel = {
|
|
||||||
name = "genode";
|
|
||||||
execFormat = execFormats.elf;
|
|
||||||
families = { };
|
|
||||||
};
|
|
||||||
abi = "elf";
|
|
||||||
libc = "genodelibc";
|
|
||||||
extensions = { executable = ""; sharedLibrary = ".lib.so"; };
|
|
||||||
} else { };
|
|
||||||
in f platform
|
|
Loading…
Reference in New Issue