2
0
Fork 0
Browse Source

Prune dead code, improve readibility, update README

20.02
Emery Hemingway 3 years ago
parent
commit
43989b1e0f
  1. 17
      README.md
  2. 2
      dhall-haskell.nix
  3. 67
      dhallPinnedNixpkgs.nix
  4. 13
      flake.nix
  5. 26
      nixos/test.nix
  6. 6
      nixpkgs.nix
  7. 21
      platform.nix

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
cases, the later is probably broken for all cases.
Furthermore, this repository is structured as a Nim flake, with is in itself an
experimental extension of the Nix utility.
Furthermore, this repository is structured as a Nix flake, with is in itself an
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
@ -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
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
[Hydra](https://nixos.org/hydra/).
Bootstrapping the LLVM toolchain on a laptop can take hours, so personally I
farm out the builds. If you interested in binaries please contact me and we can
setup a cache.

2
dhall-haskell.nix

@ -1,2 +0,0 @@
let dhall-haskell = import <dhall-haskell>;
in { linux-dhall = dhall-haskell.dhall; }

67
dhallPinnedNixpkgs.nix

@ -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

@ -34,7 +34,8 @@
inherit system nixpkgs;
depot = thisSystem genode-depot.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 =
self.packages.x86_64-linux-x86_64-genode.base-linux;
@ -51,11 +52,11 @@
x86_64-linux.nixos =
let pkgs' = nixpkgs.legacyPackages.x86_64-linux // { };
in import ./nixos/test.nix {
inherit self;
nixpkgs = nixpkgs.outPath;
genodepkgs = self.packages.x86_64-linux-x86_64-genode;
depot = genode-depot.packages.x86_64-linux-x86_64-genode;
} { system = "x86_64-linux"; };
system = "x86_64-linux";
depot = genode-depot;
genodepkgs = self;
inherit nixpkgs;
};
};
nixosModule = import ./nixos;

26
nixos/test.nix

@ -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 {
name = "genode-base-linux";
@ -8,9 +10,12 @@ import (nixpkgs + "/nixos/tests/make-test.nix") ({ pkgs, ... }:
machine =
{ config, pkgs, lib, ... }:
{
imports = [ "${self.outPath}/nixos" ];
let
flakePackages = flake:
with builtins;
getAttr config.nixpkgs.system (getAttr "packages" flake);
in {
imports = [ "${genodepkgs}/nixos" ];
genode = {
signal-test = {
config = ''
@ -35,9 +40,12 @@ import (nixpkgs + "/nixos/tests/make-test.nix") ({ pkgs, ... }:
</start>
</config>
'';
depot = depot;
pkgs = genodepkgs;
rom = { "test-signal" = "${genodepkgs.os}/bin/test-signal"; };
depot = flakePackages depot;
pkgs = flakePackages genodepkgs;
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 ---'");
'';
})
}) { inherit system; }

6
nixpkgs.nix

@ -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

@ -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…
Cancel
Save