2
0
Fork 0

Refactor for clarity

Mode around for the sake of clarity, pin Nixpkgs with fetchGit for
convenience.
This commit is contained in:
Emery Hemingway 2019-09-24 00:59:53 +02:00
parent db934b29d9
commit 734f38fabb
33 changed files with 55 additions and 42 deletions

View File

@ -1,23 +1,30 @@
{ nixpkgs ? import <nixpkgs> }:
with builtins;
let
nixpkgs' = nixpkgs {
config.allowUnsupportedSystem = true;
crossSystem = {
isx86_64 = true;
isGenode = true;
imports = [ ./platform.nix ];
pkgOverlay = self: super:
# Overlay of locally defined packages
{
genode = super.callPackage ./upstream { };
dhall = super.callPackage ./dhall { };
};
overlays = [ (import ./overlay) ];
toolchainOverlay = import ./toolchain-overlay;
# Overlay of toolchain patches
nixpkgs' = builtins.fetchGit {
# A branch of Nixpkgs with a custom "crossSystem" mechanism
url = "https://github.com/ehmry/nixpkgs.git";
ref = "hybrid";
rev = "e4d734ace275cae70a776771d034c051956c9cab";
};
in rec {
nixpkgs = nixpkgs';
dhall = import ./dhall { inherit nixpkgs; };
upstream = import ./upstream { inherit nixpkgs; };
in { nixpkgs ? import nixpkgs' }:
nixpkgs {
# Evaluate an overlayed Nixpkgs for a Genode target
config.allowUnsupportedSystem = true;
crossSystem = {
isx86_64 = true;
isGenode = true;
imports = [ ./platform.nix ];
};
overlays = [ toolchainOverlay pkgOverlay ];
}

View File

@ -1,8 +1,7 @@
{ nixpkgs }:
{ callPackage }:
rec {
prelude = prelude_9_0_0;
prelude_9_0_0 = nixpkgs.callPackage ./prelude-9.0.0.nix {};
genode = nixpkgs.callPackage ./genode.nix {};
prelude_9_0_0 = callPackage ./prelude-9.0.0.nix { };
genode = callPackage ./genode.nix { };
}

View File

@ -1,30 +1,34 @@
{ nixpkgs }:
{ stdenv, buildPackages, fetchgit, llvmPackages }:
let
inherit (nixpkgs.stdenv) lib targetPlatform;
specs = with targetPlatform;
[ ] ++ lib.optional is32bit "32bit" ++ lib.optional is64bit "64bit"
++ lib.optional isAarch32 "arm" ++ lib.optional isAarch64 "arm_64"
++ lib.optional isRiscV "riscv" ++ lib.optional isx86 "x86"
++ lib.optional isx86_32 "x86_32" ++ lib.optional isx86_64 "x86_64";
inherit (stdenv) lib targetPlatform;
specs = with targetPlatform; []
++ lib.optional is32bit "32bit"
++ lib.optional is64bit "64bit"
++ lib.optional isAarch32 "arm"
++ lib.optional isAarch64 "arm_64"
++ lib.optional isRiscV "riscv"
++ lib.optional isx86 "x86"
++ lib.optional isx86_32 "x86_32"
++ lib.optional isx86_64 "x86_64";
version = "19.07";
buildRepo = repo: nativeBuildInputs:
buildRepo = repo:
nixpkgs.stdenv.mkDerivation {
stdenv.mkDerivation {
name = "genode-${repo}-${version}";
outputs = [ "out" "dev" ];
inherit repo nativeBuildInputs specs version;
inherit repo specs version;
LIBCXX = nixpkgs.llvmPackages.libcxx;
LIBCXXABI = nixpkgs.llvmPackages.libcxxabi;
LIBUNWIND = nixpkgs.llvmPackages.libunwind;
HOST_LIBC = nixpkgs.buildPackages.glibc.dev;
HOST_LIBC = buildPackages.glibc.dev;
LIBCXX = llvmPackages.libcxx;
LIBCXXABI = llvmPackages.libcxxabi;
LIBUNWIND = llvmPackages.libunwind;
LIBUNWIND_BAREMETAL =
nixpkgs.llvmPackages.libunwind.override { isBaremetal = true; };
llvmPackages.libunwind.override { isBaremetal = true; };
src = nixpkgs.fetchgit {
src = fetchgit {
url = "https://git.sr.ht/~ehmry/genode";
rev = "d28abff776f94dc876662eb7dcdf5a6e81d26cc8";
sha256 = "1ibw27s352c2si22y209q17api8gaqv7qsh70vh4wk9bfv1kgchx";
@ -33,7 +37,7 @@ let
setupHook = ./../tool/setup-hooks.sh;
depsBuildBuild = with nixpkgs.buildPackages; [ llvm pkgconfig tup ];
depsBuildBuild = with buildPackages; [ llvm pkgconfig tup ];
configurePhase = ''
# Configure Tup
@ -94,8 +98,11 @@ let
};
in rec {
base = buildRepo "base" [ ];
base-linux = buildRepo "base-linux" [ base ];
base-nova = buildRepo "base-nova" [ base ];
os = buildRepo "os" [ base ];
base = buildRepo "base";
base-linux = (buildRepo "base-linux").overrideAttrs
(attrs: { nativeBuildInputs = [ base ]; });
base-nova = (buildRepo "base-nova").overrideAttrs
(attrs: { nativeBuildInputs = [ base ]; });
os =
(buildRepo "os").overrideAttrs (attrs: { nativeBuildInputs = [ base ]; });
}