Genode Packages collection https://git.sr.ht/~ehmry/genodepkgs/
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.

default.nix 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. { flake }:
  2. final: prev:
  3. with prev;
  4. let
  5. # Helper functions to override package dependant
  6. # on whether the host or target system is Genode.
  7. overrideHost = attrs: drv:
  8. if hostPlatform.isGenode then drv.override attrs else drv;
  9. overrideTarget = attrs: drv:
  10. if targetPlatform.isGenode then drv.override attrs else drv;
  11. overrideAttrsHost = f: drv:
  12. if hostPlatform.isGenode then drv.overrideAttrs f else drv;
  13. overrideAttrsTarget = f: drv:
  14. if targetPlatform.isGenode then drv.overrideAttrs f else drv;
  15. addPatches' = patches: attrs: { patches = attrs.patches or [ ] ++ patches; };
  16. addPatchesHost = ps: overrideAttrsHost (addPatches' ps);
  17. addPatchesTarget = ps: overrideAttrsTarget (addPatches' ps);
  18. autoreconfHost = overrideAttrsHost
  19. (attrs: { nativeBuildInputs = [ final.autoreconfHook ]; });
  20. in {
  21. bash = overrideAttrsTarget (attrs: {
  22. configureFlags = attrs.configureFlags
  23. ++ [ "--without-bash-malloc" ]; # no sbrk please
  24. postPatch = "sed '/check_dev_tty/d' shell.c";
  25. }) bash;
  26. binutils-unwrapped = overrideAttrsTarget (attrs: {
  27. patches = attrs.patches ++ [ ./binutils/support-genode.patch ];
  28. nativeBuildInputs = [ final.updateAutotoolsGnuConfigScriptsHook ];
  29. }) binutils-unwrapped;
  30. cmake = overrideAttrsTarget (attrs: {
  31. postInstall = with stdenv; ''
  32. local MODULE="$out/share/cmake-${
  33. lib.versions.majorMinor attrs.version
  34. }/Modules/Platform/Genode.cmake"
  35. if [ -e "$MODULE" ]; then
  36. echo "Upstream provides $MODULE!"
  37. exit 1
  38. fi
  39. cp ${./cmake/Genode.cmake} $MODULE
  40. '';
  41. }) cmake;
  42. coreutils = overrideHost {
  43. gmp = null;
  44. libiconv = null;
  45. } (overrideAttrsHost (attrs: {
  46. configureFlags = [
  47. "--disable-acl"
  48. "--disable-largefile"
  49. "--disable-xattr"
  50. "--disable-libcap"
  51. "--disable-nls"
  52. ];
  53. LDFLAGS = [ "-Wl,--no-as-needed" ];
  54. # keep libposix NEEDED
  55. }) coreutils);
  56. gdb = addPatchesTarget [ ./gdb/genode.patch ] gdb;
  57. genodeLibcCross = callPackage ./libc { };
  58. genodePackages = import ../packages {
  59. inherit flake;
  60. pkgs = final;
  61. };
  62. libconfig =
  63. overrideAttrsHost (attrs: { configureFlags = [ "--disable-examples" ]; })
  64. libconfig;
  65. libcCrossChooser = name:
  66. if stdenv.targetPlatform.isGenode then
  67. targetPackages.genodeLibcCross
  68. else
  69. prev.libcCrossChooser name;
  70. libsodium = overrideAttrsHost (attrs: {
  71. patches = (attrs.patches or [ ]) ++ [ ./libsodium/genode.patch ];
  72. }) libsodium;
  73. libkrb5 = autoreconfHost libkrb5;
  74. libtool = overrideAttrsTarget (attrs: {
  75. nativeBuildInputs = with final;
  76. attrs.nativeBuildInputs ++ [ autoconf automake115x ];
  77. patches = ./libtool/genode.patch;
  78. }) libtool;
  79. libtoxcore = overrideHost {
  80. libopus = null;
  81. libvpx = null;
  82. } libtoxcore;
  83. llvmPackages_11 = callPackage ./llvm-11 ({
  84. inherit (stdenvAdapters) overrideCC;
  85. buildLlvmTools = buildPackages.llvmPackages_11.tools;
  86. targetLlvmLibraries = targetPackages.llvmPackages_11.libraries;
  87. inherit (final.genodePackages.genodeSources) genodeBase;
  88. } // stdenv.lib.optionalAttrs
  89. (stdenv.hostPlatform.isi686 && buildPackages.stdenv.cc.isGNU) {
  90. stdenv = gcc7Stdenv;
  91. });
  92. ncurses = addPatchesHost [ ./ncurses/genode.patch ] ncurses;
  93. openssl =
  94. overrideHost { static = true; } # shared library comes out stupid big
  95. (overrideAttrsHost (attrs: {
  96. outputs = [ "out" ]
  97. ++ builtins.filter (x: x != "bin" && x != "out") attrs.outputs;
  98. patches = attrs.patches or [ ] ++ [ ./openssl/genode.patch ];
  99. configureScript = {
  100. x86_64-genode = "./Configure Genode-x86_64";
  101. }.${stdenv.hostPlatform.system} or (throw
  102. "Not sure what configuration to use for ${stdenv.hostPlatform.config}");
  103. configureFlags = attrs.configureFlags ++ [ "no-devcryptoeng" ];
  104. postInstall =
  105. "rm $out/bin/c_rehash"; # eliminate the perl runtime dependency
  106. }) openssl);
  107. rsync = overrideHost {
  108. enableACLs = false;
  109. popt = null;
  110. } (overrideAttrsHost (attrs: { outputs = [ "out" "man" ]; }) rsync);
  111. solo5-tools = callPackage ./solo5-tools { };
  112. tor = overrideAttrsHost (attrs: {
  113. configureFlags = attrs.configureFlags or [ ]
  114. ++ [ "--disable-tool-name-check" ];
  115. patches = attrs.patches or [ ] ++ [ ./tor/genode.patch ];
  116. postPatch = null; # Avoid torsocks patching
  117. }) tor;
  118. zlib = overrideAttrsHost (attrs: {
  119. postInstall = attrs.postInstall or "" + ''
  120. pushd ''${!outputLib}/lib
  121. find . -type l -delete
  122. mv libz.so.* libz.so
  123. popd
  124. '';
  125. }) zlib;
  126. }