genode-depot/flake.nix

86 lines
3.0 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-15 19:06:25 +01:00
inputs.dhall-haskell.uri =
"git+https://github.com/dhall-lang/dhall-haskell?ref=flake";
outputs = { self, nixpkgs, dhall-haskell }:
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;
2020-01-15 19:06:25 +01:00
buildInputs = [ dhall-haskell.packages.${localSystem}.dhall ];
2019-11-10 14:58:22 +01:00
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
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
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
}