Prepare Genode sources as fixed-output derivations
This may prevent some unecessary rebuilds in the future.
This commit is contained in:
parent
ccdfcd7a5b
commit
3359a5453e
|
@ -18,9 +18,45 @@ let
|
||||||
++ lib.optional isx86_32 "x86_32"
|
++ lib.optional isx86_32 "x86_32"
|
||||||
++ lib.optional isx86_64 "x86_64";
|
++ lib.optional isx86_64 "x86_64";
|
||||||
|
|
||||||
buildRepo = repo:
|
buildRepo = { repo, srcHash }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
|
src = stdenv.mkDerivation {
|
||||||
|
name = "genode-" + repo + "-src";
|
||||||
|
inherit repo;
|
||||||
|
preferLocalBuild = true;
|
||||||
|
|
||||||
|
outputHashMode = "recursive";
|
||||||
|
outputHashAlgo = "sha256";
|
||||||
|
outputHash = srcHash;
|
||||||
|
|
||||||
|
src = fetchgit {
|
||||||
|
url = "https://git.sr.ht/~ehmry/genode";
|
||||||
|
rev = "dc0084cd5bebfdba74323bbe8f0a9dd1e8b7c524";
|
||||||
|
sha256 = "12qwv6xq51dr5lps60c0r9dmxgk2agd8jgh0prafjk0wxq3xs95p";
|
||||||
|
fetchSubmodules = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
phases = [ "unpackPhase" "patchPhase" "installPhase" ];
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
# Disable other repos
|
||||||
|
for R in repos/*; do
|
||||||
|
if [ -d "$R" ] ; then
|
||||||
|
case $R in
|
||||||
|
repos/$repo) ;;
|
||||||
|
repos/base)
|
||||||
|
find $R -name Tupfile -delete ;;
|
||||||
|
*)
|
||||||
|
rm -r $R ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = "cp -r . $out";
|
||||||
|
};
|
||||||
|
|
||||||
tupArch = with stdenv.targetPlatform;
|
tupArch = with stdenv.targetPlatform;
|
||||||
if isAarch32 then "arm" else
|
if isAarch32 then "arm" else
|
||||||
if isAarch64 then "arm64" else
|
if isAarch64 then "arm64" else
|
||||||
|
@ -36,14 +72,8 @@ let
|
||||||
in stdenv.mkDerivation {
|
in stdenv.mkDerivation {
|
||||||
name = "genode-${repo}-${version}";
|
name = "genode-${repo}-${version}";
|
||||||
outputs = [ "out" "dev" ];
|
outputs = [ "out" "dev" ];
|
||||||
inherit repo specs version;
|
|
||||||
|
|
||||||
src = fetchgit {
|
inherit src repo specs version;
|
||||||
url = "https://git.sr.ht/~ehmry/genode";
|
|
||||||
rev = "dc0084cd5bebfdba74323bbe8f0a9dd1e8b7c524";
|
|
||||||
sha256 = "12qwv6xq51dr5lps60c0r9dmxgk2agd8jgh0prafjk0wxq3xs95p";
|
|
||||||
fetchSubmodules = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
setupHook = ./../tool/setup-hooks.sh;
|
setupHook = ./../tool/setup-hooks.sh;
|
||||||
|
|
||||||
|
@ -67,12 +97,6 @@ let
|
||||||
echo CONFIG_NIX_OUTPUTS_OUT=$out >> tup.config
|
echo CONFIG_NIX_OUTPUTS_OUT=$out >> tup.config
|
||||||
echo CONFIG_NIX_OUTPUTS_DEV=$dev >> tup.config
|
echo CONFIG_NIX_OUTPUTS_DEV=$dev >> tup.config
|
||||||
|
|
||||||
# Disable other repos
|
|
||||||
for R in repos/*; do
|
|
||||||
[ "$R" != "repos/$repo" ] && find $R -name Tupfile -delete
|
|
||||||
done
|
|
||||||
find repos/gems -name Tupfile -delete
|
|
||||||
|
|
||||||
# Scan repository and generate script
|
# Scan repository and generate script
|
||||||
tup init
|
tup init
|
||||||
tup generate buildPhase.sh
|
tup generate buildPhase.sh
|
||||||
|
@ -135,11 +159,27 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
in rec {
|
in rec {
|
||||||
base = buildRepo "base";
|
|
||||||
base-linux = (buildRepo "base-linux").overrideAttrs
|
# reset hashes to 0000000000000000000000000000000000000000000000000000
|
||||||
(attrs: { nativeBuildInputs = [ base ]; });
|
# when updating git revision
|
||||||
base-nova = (buildRepo "base-nova").overrideAttrs
|
|
||||||
(attrs: { nativeBuildInputs = [ base ]; });
|
base = buildRepo {
|
||||||
os =
|
repo = "base";
|
||||||
(buildRepo "os").overrideAttrs (attrs: { nativeBuildInputs = [ base ]; });
|
srcHash = "1jiqgflpgivwik3cswz9ni9qr6x01gmd3sj61vx7bzs7yck1s5l6";
|
||||||
|
};
|
||||||
|
|
||||||
|
base-linux = (buildRepo {
|
||||||
|
repo = "base-linux";
|
||||||
|
srcHash = "1dmsq5znbcqy5kjm0v2a5k1mdxl4gbrr1k1g1in1hr0p460cjyrg";
|
||||||
|
}).overrideAttrs (attrs: { nativeBuildInputs = [ base ]; });
|
||||||
|
|
||||||
|
base-nova = (buildRepo {
|
||||||
|
repo = "base-nova";
|
||||||
|
srcHash = "1lp7wnp99mrhccylvs1ys9kvjvyg3m7y16h3bg9zy0qlrkn668ja";
|
||||||
|
}).overrideAttrs (attrs: { nativeBuildInputs = [ base ]; });
|
||||||
|
|
||||||
|
os = (buildRepo {
|
||||||
|
repo = "os";
|
||||||
|
srcHash = "035r8v1xnsz0xlz2f3g4350ay8bwrsj4linzd1dca663i6x7nv9m";
|
||||||
|
}).overrideAttrs (attrs: { nativeBuildInputs = [ base ]; });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue