Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. { pkgs, pythonPackages }:
  2.  
  3. with builtins;
  4.  
  5. with pythonPackages;
  6.  
  7. with { inherit (pkgs) lib; };
  8.  
  9. let removeNulls = lib.filterAttrs (n: v: v != null);
  10. srcHelper = url: sha256: curlOpts: name:
  11. assert url != null;
  12. assert sha256 != null;
  13. pkgs.fetchurl (removeNulls { inherit url sha256 name curlOpts; });
  14.  
  15. mkPython =
  16. { packageName # < A package name.
  17. , version # < A package version.
  18. , srcURL ? null # < A url to download from.
  19. , srcSHA ? null # < A SHA256 checksum for the download.
  20. , srcName ? null # < A name for the downloaded file.
  21. , srcCurlOpts ? null # < A curl options for the download.
  22. , src ? null # < A source to use (overrides other options).
  23. , buildDeps ? [] # < Build dependencies to add.
  24. , propDeps ? [] # < Propagated dependencies to add.
  25. , nativeBuildDeps ? [] # < Native build dependencies to add.
  26. , nativePropDeps ? [] # < Native propagated dependencies to add.
  27. # The following attributes are equivalent to those in meta:
  28. , homepage ? null # < A homepage of the project.
  29. , description ? null # < A description.
  30. , longDescription ? null # < A longer description.
  31. , maintainers ? null # < A list of maintainers.
  32. , license ? null # < A license.
  33. , platforms ? null # < A list of supported platforms.
  34. , ... # Any other options will be passed to buildPythonPackage directly
  35. } @ args:
  36.  
  37. buildPythonPackage (removeNulls ({
  38. name = "${packageName}-${version}";
  39.  
  40. src = if isNull src
  41. then srcHelper srcURL srcSHA srcCurlOpts srcName
  42. else src;
  43.  
  44. buildInputs = buildDeps;
  45. propagatedBuildInputs = propDeps;
  46.  
  47. nativeBuildInputs = nativeBuildDeps;
  48. propagatedNativeBuildInputs = nativePropDeps;
  49.  
  50. meta = removeNulls {
  51. inherit homepage description longDescription
  52. license maintainers platforms;
  53. };
  54. } // args));
  55. isNonEmptyString = x: stringLength x > 0;
  56. strHead = x: (assert isNonEmptyString x; substring 0 1 x);
  57. pypiURL = name: version:
  58. assert isNonEmptyString name;
  59. assert isNonEmptyString version;
  60. "mirror://pypi/${strHead name}/${name}/${name}-${version}.tar.gz";
  61.  
  62. in pythonPackages // (rec {
  63. # bobbuilder = pkgs.callPackage ./bobbuilder {};
  64.  
  65. # No longer used, Theano was finally added to nix main channel
  66. # theano-deep = mkPython (rec {
  67. # packageName = "theano-deep";
  68. # version = "0.8.2";
  69. # srcURL = pypiURL "Theano" version;
  70. # srcSHA = "0c49mz3bg57vigkyfz3yd6302587hsikhvgkh7w7ny0sxpvwhqvl";
  71. # propDeps = with pkgs; [ six scipy ];
  72. # homepage = http://deeplearning.net/software/theano/;
  73. # description = "Optimizing compiler for evaluating mathematical expressions on CPUs and GPUs.";
  74. # license = null;#lib.licenses.bsd;
  75. # maintainers = null;
  76. # platforms = with lib.platforms; all;
  77. #
  78. # });
  79.  
  80. panda3d = mkPython (rec {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement