Nix flake of prebuilt Genode binaries
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

flake.nix 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. {
  2. description = "Cache of pre-built Genode binaries";
  3. edition = 201909;
  4. outputs = { self, nixpkgs }:
  5. let
  6. localSystem = "x86_64-linux";
  7. localPackages = nixpkgs.legacyPackages.${localSystem};
  8. unpack = baseUrl:
  9. { name, value }: {
  10. inherit name;
  11. value = localPackages.stdenvNoCC.mkDerivation {
  12. pname = name;
  13. inherit (value) version;
  14. outputs = [ "out" "manifest" ];
  15. preferLocalBuild = true;
  16. src = localPackages.fetchurl {
  17. url = "${baseUrl}${name}/${value.version}.tar.xz";
  18. inherit (value) sha256;
  19. };
  20. dontConfigure = true;
  21. dontBuild = true;
  22. installPhase = ''
  23. find . -type f | while read FILE; do
  24. case $FILE in
  25. *.a | *.o) install -Dm444 -t $out/lib $FILE;;
  26. *.so) install -Dm555 -t $out/lib $FILE;;
  27. *.tar) install -Dm444 -t $out/tar $FILE;;
  28. *) install -Dm555 -t $out/bin $FILE;;
  29. esac
  30. done
  31. local drv=$out
  32. echo -n '{' >> $manifest
  33. if [ -d $drv/bin ]; then
  34. echo -n ',bin={' >> $manifest
  35. find $drv/bin/ -type f -printf ',%f={mapKey="%f",mapValue="%p"}\n' >> $manifest
  36. echo -n '}' >> $manifest
  37. fi
  38. if [ -d $drv/lib ]; then
  39. echo -n ',lib={' >> $manifest
  40. find $drv/lib/ -type f -name '*.lib.so' -printf '%f "%p"\n' \
  41. | awk '{print ","gensub(/.lib.so/, "", 1, $1)"={mapKey=\""$1"\",mapValue="$2" }"}'>> $manifest
  42. echo -n '}' >> $manifest
  43. fi
  44. if [ -d $drv/tar ]; then
  45. echo -n ',tar={' >> $manifest
  46. find $drv/tar/ -type f -name '*.tar' -printf '%f "%p"\n' \
  47. | awk '{print ""gensub(/.tar/, "", 1, $1)"={mapKey=\""$1"\",mapValue="$2"}"}'>> $manifest
  48. echo -n '}' >> $manifest
  49. fi
  50. echo '}' >> $manifest
  51. '';
  52. meta = {
  53. license = [ "LicenseRef-Genode" ];
  54. downloadPage = "${baseUrl}${name}/";
  55. };
  56. };
  57. };
  58. expand = baseUrl: listing:
  59. builtins.listToAttrs (map (unpack baseUrl) listing);
  60. nfeske = expand "http://depot.genode.org/nfeske/bin/x86_64/"
  61. (import ./nfeske-list.nix);
  62. genodelabs = expand "http://depot.genode.org/genodelabs/bin/x86_64/"
  63. (import ./genodelabs-list.nix);
  64. pkgs = nfeske // genodelabs;
  65. in {
  66. packages = {
  67. x86_64-linux-x86_64-genode = pkgs;
  68. x86_64-linux = pkgs;
  69. };
  70. checks = self.packages;
  71. };
  72. }