]>
Commit | Line | Data |
---|---|---|
db343436 | 1 | { makeWrapper, stdenv, writeScript, fetchurl, buildBowerComponents, mylibs, which, python36, gst_all_1, automake, autoconf, nodejs, nodePackages, lib, callPackage, sources }: |
ddd3f845 IB |
2 | let |
3 | overridePython = let | |
4 | packageOverrides = self: super: { | |
5400b9b6 IB |
5 | pybcrypt = super.buildPythonPackage rec { |
6 | pname = "pybcrypt"; | |
7 | version = "0.4"; | |
8 | ||
9 | src = self.fetchPypi { | |
10 | inherit pname version; | |
11 | sha256 = "5fa13bce551468350d66c4883694850570f3da28d6866bb638ba44fe5eabda78"; | |
12 | }; | |
13 | }; | |
ddd3f845 IB |
14 | celery = super.celery.overridePythonAttrs(old: rec { |
15 | version = "3.1.26.post2"; | |
16 | src = self.fetchPypi { | |
17 | inherit version; | |
18 | inherit (old) pname; | |
19 | sha256 = "5493e172ae817b81ba7d09443ada114886765a8ce02f16a56e6fac68d953a9b2"; | |
20 | }; | |
21 | patches = []; | |
22 | doCheck = false; | |
23 | }); | |
24 | billiard = super.billiard.overridePythonAttrs(old: rec { | |
25 | version = "3.3.0.23"; | |
26 | src = self.fetchPypi { | |
27 | inherit version; | |
28 | inherit (old) pname; | |
29 | sha256 = "02wxsc6bhqvzh8j6w758kvgqbnj14l796mvmrcms8fgfamd2lak9"; | |
30 | }; | |
258dd18b IB |
31 | doCheck = false; |
32 | doInstallCheck = false; | |
ddd3f845 IB |
33 | }); |
34 | amqp = super.amqp.overridePythonAttrs(old: rec { | |
35 | version = "1.4.9"; | |
36 | src = self.fetchPypi { | |
37 | inherit version; | |
38 | inherit (old) pname; | |
39 | sha256 = "2dea4d16d073c902c3b89d9b96620fb6729ac0f7a923bbc777cb4ad827c0c61a"; | |
40 | }; | |
41 | }); | |
42 | kombu = super.kombu.overridePythonAttrs(old: rec { | |
43 | version = "3.0.37"; | |
44 | src = self.fetchPypi { | |
45 | inherit version; | |
46 | inherit (old) pname; | |
47 | sha256 = "e064a00c66b4d1058cd2b0523fb8d98c82c18450244177b6c0f7913016642650"; | |
48 | }; | |
49 | propagatedBuildInputs = old.propagatedBuildInputs ++ [ self.anyjson ]; | |
50 | doCheck = false; | |
51 | }); | |
52 | sqlalchemy = super.sqlalchemy.overridePythonAttrs(old: rec { | |
53 | version = "1.1.18"; | |
54 | src = self.fetchPypi { | |
55 | inherit version; | |
56 | inherit (old) pname; | |
57 | sha256 = "8b0ec71af9291191ba83a91c03d157b19ab3e7119e27da97932a4773a3f664a9"; | |
58 | }; | |
5400b9b6 | 59 | doCheck = false; |
ddd3f845 IB |
60 | }); |
61 | tempita_5_3_dev = super.buildPythonPackage (mylibs.fetchedGithub ./tempita.json // rec { | |
62 | buildInputs = with self; [ nose ]; | |
63 | disabled = false; | |
64 | }); | |
65 | sqlalchemy_migrate = super.sqlalchemy_migrate.overridePythonAttrs(old: rec { | |
66 | propagatedBuildInputs = with self; [ pbr tempita_5_3_dev decorator sqlalchemy six sqlparse ]; | |
67 | }); | |
68 | pasteScript = super.pasteScript.overridePythonAttrs(old: rec { | |
69 | version = "2.0.2"; | |
70 | name = "PasteScript-${version}"; | |
71 | src = fetchurl { | |
72 | url = "mirror://pypi/P/PasteScript/${name}.tar.gz"; | |
73 | sha256 = "1h3nnhn45kf4pbcv669ik4faw04j58k8vbj1hwrc532k0nc28gy0"; | |
74 | }; | |
75 | propagatedBuildInputs = with self; [ six paste PasteDeploy ]; | |
76 | }); | |
77 | }; | |
78 | in | |
79 | python36.override { inherit packageOverrides; }; | |
80 | pythonEnv = python-pkgs: with python-pkgs; [ | |
81 | waitress alembic dateutil wtforms pybcrypt | |
82 | pytest pytest_xdist werkzeug celery | |
83 | kombu jinja2 Babel webtest configobj markdown | |
84 | sqlalchemy itsdangerous pytz sphinx six | |
85 | oauthlib unidecode jsonschema PasteDeploy | |
86 | requests PyLD exifread | |
87 | typing pasteScript lxml | |
88 | # For images plugin | |
89 | pillow | |
90 | # For video plugin | |
91 | gst-python | |
92 | # migrations | |
93 | sqlalchemy_migrate | |
94 | # authentication | |
95 | ldap3 | |
96 | redis | |
97 | psycopg2 | |
98 | ]; | |
99 | python = overridePython.withPackages pythonEnv; | |
100 | gmg = writeScript "gmg" '' | |
101 | #!${python}/bin/python | |
102 | __requires__ = 'mediagoblin' | |
103 | import sys | |
104 | from pkg_resources import load_entry_point | |
105 | ||
106 | if __name__ == '__main__': | |
107 | sys.exit( | |
108 | load_entry_point('mediagoblin', 'console_scripts', 'gmg')() | |
109 | ) | |
110 | ''; | |
db343436 | 111 | mediagoblinSrc = sources.webapps-mediagoblin; |
ddd3f845 IB |
112 | bowerComponents = buildBowerComponents { |
113 | name = "mediagoblin-bower-components"; | |
114 | generated = ./bower-packages.nix; | |
db343436 | 115 | src = mediagoblinSrc; |
ddd3f845 | 116 | }; |
34c7b88e IB |
117 | pluginNames = [ "basicsearch" ]; |
118 | allPlugins = lib.attrsets.genAttrs pluginNames | |
119 | (name: callPackage (./plugins + "/${name}") {}); | |
120 | toPassthru = pkg: { | |
121 | inherit allPlugins; | |
122 | withPlugins = withPlugins pkg; | |
123 | }; | |
124 | withPlugins = pkg: toPlugins: | |
125 | let | |
126 | plugins = toPlugins allPlugins; | |
127 | toBuildPlugin = n: "ln -s ${n} mediagoblin/plugins/${n.pluginName}"; | |
128 | newMediagoblin = pkg.overrideAttrs(old: { | |
129 | postBuild = old.postBuild + "\n" + builtins.concatStringsSep "\n" (map toBuildPlugin plugins); | |
130 | passthru = toPassthru newMediagoblin; | |
131 | }); | |
132 | in newMediagoblin; | |
db343436 IB |
133 | package = stdenv.mkDerivation rec { |
134 | pname = "mediagoblin"; | |
135 | name = "${pname}-${version}"; | |
136 | version = mediagoblinSrc.version; | |
137 | src = mediagoblinSrc; | |
ddd3f845 IB |
138 | preConfigure = '' |
139 | # ./bootstrap.sh | |
140 | aclocal -I m4 --install | |
141 | autoreconf -fvi | |
142 | # end | |
143 | export HOME=$PWD | |
144 | ''; | |
145 | configureFlags = [ "--with-python3" "--without-virtualenv" ]; | |
146 | postBuild = '' | |
147 | cp -a ${bowerComponents}/bower_components/* extlib | |
148 | chmod -R u+w extlib | |
149 | make extlib | |
150 | ''; | |
151 | installPhase = let | |
152 | libpaths = with gst_all_1; [ | |
153 | python | |
154 | gstreamer | |
155 | gst-plugins-base | |
156 | gst-libav | |
157 | gst-plugins-good | |
158 | gst-plugins-bad | |
159 | gst-plugins-ugly | |
160 | ]; | |
161 | plugin_paths = builtins.concatStringsSep ":" (map (x: "${x}/lib") libpaths); | |
162 | typelib_paths = with gst_all_1; "${gstreamer}/lib/girepository-1.0:${gst-plugins-base}/lib/girepository-1.0"; | |
163 | in '' | |
164 | sed -i "s/registry.has_key(current_theme_name)/current_theme_name in registry/" mediagoblin/tools/theme.py | |
165 | sed -i -e "s@\[DEFAULT\]@[DEFAULT]\nhere = $out@" mediagoblin/config_spec.ini | |
166 | sed -i -e "/from gi.repository import GstPbutils/s/^/gi.require_version('GstPbutils', '1.0')\n/" mediagoblin/media_types/video/transcoders.py | |
167 | cp ${./ldap_fix.py} mediagoblin/plugins/ldap/tools.py | |
168 | find . -name '*.pyc' -delete | |
169 | find . -type f -exec sed -i "s|$PWD|$out|g" {} \; | |
170 | python setup.py build | |
171 | cp -a . $out | |
172 | mkdir $out/bin | |
173 | makeWrapper ${gmg} $out/bin/gmg --prefix PYTHONPATH : "$out:$PYTHONPATH" \ | |
174 | --prefix GST_PLUGIN_SYSTEM_PATH : ${plugin_paths} \ | |
175 | --prefix GI_TYPELIB_PATH : ${typelib_paths} | |
176 | makeWrapper ${python}/bin/paster $out/bin/paster --prefix PYTHONPATH : "$out:$PYTHONPATH" \ | |
177 | --prefix GST_PLUGIN_SYSTEM_PATH : ${plugin_paths} \ | |
178 | --prefix GI_TYPELIB_PATH : ${typelib_paths} | |
179 | makeWrapper ${python}/bin/celery $out/bin/celery --prefix PYTHONPATH : "$out:$PYTHONPATH" \ | |
180 | --prefix GST_PLUGIN_SYSTEM_PATH : ${plugin_paths} \ | |
181 | --prefix GI_TYPELIB_PATH : ${typelib_paths} | |
182 | ''; | |
183 | buildInputs = [ makeWrapper automake autoconf which nodePackages.bower nodejs python ]; | |
184 | propagatedBuildInputs = with gst_all_1; [ python gst-libav gst-plugins-good gst-plugins-bad gst-plugins-ugly gstreamer ]; | |
34c7b88e | 185 | passthru = toPassthru package; |
db343436 | 186 | }; |
ddd3f845 | 187 | in package |