genode-depot/flake.nix

81 lines
2.7 KiB
Nix
Raw Normal View History

2019-11-10 14:58:22 +01:00
{
description = "Cache of pre-built Genode binaries";
edition = 201909;
2020-01-24 17:19:01 +01:00
outputs = { self, nixpkgs }:
2019-11-10 14:58:22 +01:00
let
2020-01-15 19:06:25 +01:00
localSystem = "x86_64-linux";
localPackages = nixpkgs.legacyPackages.${localSystem};
2019-11-10 14:58:22 +01:00
unpack = baseUrl:
{ name, value }: {
inherit name;
2020-01-15 19:06:25 +01:00
value = localPackages.stdenvNoCC.mkDerivation {
2019-11-10 14:58:22 +01:00
pname = name;
inherit (value) version;
2020-01-15 19:06:25 +01:00
outputs = [ "out" "manifest" ];
2019-11-10 14:58:22 +01:00
preferLocalBuild = true;
2020-01-15 19:06:25 +01:00
src = localPackages.fetchurl {
2019-11-10 14:58:22 +01:00
url = "${baseUrl}${name}/${value.version}.tar.xz";
inherit (value) sha256;
};
dontConfigure = true;
dontBuild = true;
installPhase = ''
find . -type f | while read FILE; do
case $FILE in
*.a | *.o) install -Dm444 -t $out/lib $FILE;;
*.so) install -Dm555 -t $out/lib $FILE;;
*.tar) install -Dm444 -t $out/tar $FILE;;
*) install -Dm555 -t $out/bin $FILE;;
esac
done
2020-01-15 19:06:25 +01:00
local drv=$out
2020-01-24 17:19:01 +01:00
echo -n '{' >> $manifest
2020-01-15 19:06:25 +01:00
if [ -d $drv/bin ]; then
2020-01-24 17:19:01 +01:00
echo -n ',bin={' >> $manifest
find $drv/bin/ -type f -printf ',%f={mapKey="%f",mapValue="%p"}\n' >> $manifest
echo -n '}' >> $manifest
2020-01-15 19:06:25 +01:00
fi
if [ -d $drv/lib ]; then
2020-01-24 17:19:01 +01:00
echo -n ',lib={' >> $manifest
2020-01-15 19:06:25 +01:00
find $drv/lib/ -type f -name '*.lib.so' -printf '%f "%p"\n' \
2020-01-24 17:19:01 +01:00
| awk '{print ","gensub(/.lib.so/, "", 1, $1)"={mapKey=\""$1"\",mapValue="$2" }"}'>> $manifest
echo -n '}' >> $manifest
2020-01-15 19:06:25 +01:00
fi
if [ -d $drv/tar ]; then
2020-01-24 17:19:01 +01:00
echo -n ',tar={' >> $manifest
2020-01-15 19:06:25 +01:00
find $drv/tar/ -type f -name '*.tar' -printf '%f "%p"\n' \
2020-01-24 17:19:01 +01:00
| awk '{print ""gensub(/.tar/, "", 1, $1)"={mapKey=\""$1"\",mapValue="$2"}"}'>> $manifest
echo -n '}' >> $manifest
2020-01-15 19:06:25 +01:00
fi
2020-01-24 17:19:01 +01:00
echo '}' >> $manifest
2019-11-10 14:58:22 +01:00
'';
meta = {
license = [ "LicenseRef-Genode" ];
downloadPage = "${baseUrl}${name}/";
};
};
};
expand = baseUrl: listing:
builtins.listToAttrs (map (unpack baseUrl) listing);
2019-12-14 10:49:20 +01:00
nfeske = expand "http://depot.genode.org/nfeske/bin/x86_64/"
(import ./nfeske-list.nix);
genodelabs = expand "http://depot.genode.org/genodelabs/bin/x86_64/"
2019-11-10 14:58:22 +01:00
(import ./genodelabs-list.nix);
2019-12-02 17:55:04 +01:00
2019-12-14 10:49:20 +01:00
pkgs = nfeske // genodelabs;
2019-12-02 17:55:04 +01:00
in {
packages = {
x86_64-linux-x86_64-genode = pkgs;
x86_64-linux = pkgs;
};
checks = self.packages;
2019-11-28 15:23:55 +01:00
};
2019-11-10 14:58:22 +01:00
}