2
0
Fork 0

packages/genodelabs: support for building ports from world repo

This commit is contained in:
Ehmry - 2020-12-02 18:20:35 +01:00
parent 05f4fdcbc7
commit bb08952553
2 changed files with 19 additions and 8 deletions

View File

@ -51,4 +51,11 @@ in upstream // {
stdcxx = callPackage ./stdcxx { };
worldSources = buildPackages.fetchFromGitHub {
owner = "genodelabs";
repo = "genode-world";
rev = "521f9fb5a66b18441f53a96e3993a84b772f27e5";
sha256 = "0dy906ffbw6khkwd05vhppcw2mr4ma0h3b6n52a71cfail87jfnw";
};
}

View File

@ -57,14 +57,14 @@ let
# Prepare a "port" of source code declared in the Genode sources
name:
{ hash ? "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
, patches ? [ ], ... }@args:
, patches ? [ ], extraRepos ? [ ], ... }@args:
let
havePatches = patches != [ ];
version = portVersions.${name};
dontUnpack = patches == [ ] && extraRepos == [ ];
version = portVersions.${name} or args.version;
in with buildPackages.buildPackages;
stdenvNoCC.mkDerivation (args // {
name = name + "-port-" + version;
inherit version patches;
inherit version patches dontUnpack extraRepos;
preferLocalBuild = true;
outputHashMode = "recursive";
outputHash = hash;
@ -76,8 +76,7 @@ let
impureEnvVars = lib.fetchers.proxyImpureEnvVars
++ [ "GIT_PROXY_COMMAND" "SOCKS_SERVER" ];
src = if havePatches then genodeSources else null;
dontUnpack = !havePatches;
src = if dontUnpack then null else genodeSources;
dontConfigure = true;
@ -90,7 +89,10 @@ let
''
runHook preBuild
export CONTRIB_DIR=$NIX_BUILD_TOP/contrib
export GENODE_DIR=${if havePatches then "$(pwd)" else genodeSources}
export GENODE_DIR=${if dontUnpack then genodeSources else "$(pwd)"}
for repo in $extraRepos; do
ln -s $repo $GENODE_DIR/repos/
done
mkdir $CONTRIB_DIR
$GENODE_DIR/tool/ports/prepare_port ${name} CHECK_HASH=no
runHook postBuild
@ -116,7 +118,9 @@ let
});
ports = lib.mapAttrs preparePort (import ./ports.nix {
pkgs = flake.inputs.nixpkgs.legacyPackages.x86_64-linux;
pkgs = flake.inputs.nixpkgs.legacyPackages.x86_64-linux // {
inherit (pkgs) genodePackages;
};
});
# The "ports" mechanism is hardly deterministic, so prepare with
# a pinned nixpkgs revision for a pinned platform.