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:
Ehmry - 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 let
nixpkgs' = nixpkgs { pkgOverlay = self: super:
config.allowUnsupportedSystem = true; # Overlay of locally defined packages
crossSystem = { {
isx86_64 = true; genode = super.callPackage ./upstream { };
isGenode = true; dhall = super.callPackage ./dhall { };
imports = [ ./platform.nix ];
}; };
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 { in { nixpkgs ? import nixpkgs' }:
nixpkgs = nixpkgs';
dhall = import ./dhall { inherit nixpkgs; };
upstream = import ./upstream { inherit 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 { rec {
prelude = prelude_9_0_0; prelude = prelude_9_0_0;
prelude_9_0_0 = nixpkgs.callPackage ./prelude-9.0.0.nix {}; prelude_9_0_0 = callPackage ./prelude-9.0.0.nix { };
genode = nixpkgs.callPackage ./genode.nix {}; genode = callPackage ./genode.nix { };
} }

View File

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