86 lines
3.0 KiB
Nix
86 lines
3.0 KiB
Nix
{
|
|
description = "Cache of pre-built Genode binaries";
|
|
|
|
edition = 201909;
|
|
|
|
inputs.dhall-haskell.uri =
|
|
"git+https://github.com/dhall-lang/dhall-haskell?ref=flake";
|
|
|
|
outputs = { self, nixpkgs, dhall-haskell }:
|
|
let
|
|
localSystem = "x86_64-linux";
|
|
localPackages = nixpkgs.legacyPackages.${localSystem};
|
|
|
|
unpack = baseUrl:
|
|
{ name, value }: {
|
|
inherit name;
|
|
value = localPackages.stdenvNoCC.mkDerivation {
|
|
pname = name;
|
|
inherit (value) version;
|
|
outputs = [ "out" "manifest" ];
|
|
preferLocalBuild = true;
|
|
src = localPackages.fetchurl {
|
|
url = "${baseUrl}${name}/${value.version}.tar.xz";
|
|
inherit (value) sha256;
|
|
};
|
|
dontConfigure = true;
|
|
dontBuild = true;
|
|
buildInputs = [ dhall-haskell.packages.${localSystem}.dhall ];
|
|
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
|
|
|
|
local drv=$out
|
|
echo '{' >> manifest.tmp
|
|
if [ -d $drv/bin ]; then
|
|
echo ', bin = {' >> manifest.tmp
|
|
find $drv/bin/ -type f -printf ', %f = { mapKey = "%f", mapValue = "%p" }\n' >> manifest.tmp
|
|
echo '}' >> manifest.tmp
|
|
fi
|
|
if [ -d $drv/lib ]; then
|
|
echo ', lib = {' >> manifest.tmp
|
|
find $drv/lib/ -type f -name '*.lib.so' -printf '%f "%p"\n' \
|
|
| awk '{print ", "gensub(/.lib.so/, "", 1, $1)" = { mapKey = \""$1"\", mapValue = "$2" }" }'>> manifest.tmp
|
|
echo '}' >> manifest.tmp
|
|
fi
|
|
if [ -d $drv/tar ]; then
|
|
echo ', tar = {' >> manifest.tmp
|
|
find $drv/tar/ -type f -name '*.tar' -printf '%f "%p"\n' \
|
|
| awk '{print ""gensub(/.tar/, "", 1, $1)" = { mapKey = \""$1"\", mapValue = "$2" }" }'>> manifest.tmp
|
|
echo '}' >> manifest.tmp
|
|
fi
|
|
echo '}' >> manifest.tmp
|
|
dhall < manifest.tmp > $manifest
|
|
'';
|
|
meta = {
|
|
license = [ "LicenseRef-Genode" ];
|
|
downloadPage = "${baseUrl}${name}/";
|
|
};
|
|
};
|
|
};
|
|
|
|
expand = baseUrl: listing:
|
|
builtins.listToAttrs (map (unpack baseUrl) listing);
|
|
|
|
nfeske = expand "http://depot.genode.org/nfeske/bin/x86_64/"
|
|
(import ./nfeske-list.nix);
|
|
|
|
genodelabs = expand "http://depot.genode.org/genodelabs/bin/x86_64/"
|
|
(import ./genodelabs-list.nix);
|
|
|
|
pkgs = nfeske // genodelabs;
|
|
in {
|
|
packages = {
|
|
x86_64-linux-x86_64-genode = pkgs;
|
|
x86_64-linux = pkgs;
|
|
};
|
|
checks = self.packages;
|
|
};
|
|
}
|