genode-depot/flake.nix

61 lines
1.8 KiB
Nix

{
description = "Cache of pre-built Genode binaries";
edition = 201909;
outputs = { self, nixpkgs }:
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;
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 -n '[' >> $manifest
find $out/ -type f -printf ',{mapKey= "%f",mapValue="%p"}' >> $manifest
echo -n ']' >> $manifest
'';
meta = {
license = [ "LicenseRef-Genode" ];
downloadPage = "${baseUrl}${name}/";
};
};
};
expand = baseUrl: listing:
builtins.listToAttrs (map (unpack baseUrl) listing);
pkgs = expand "http://depot.genode.org/genodelabs/bin/x86_64/"
(import ./genodelabs-list.nix);
in {
packages = {
x86_64-linux-x86_64-genode = pkgs;
x86_64-linux = pkgs;
};
checks = self.packages;
};
}