aboutsummaryrefslogtreecommitdiff
path: root/flakes/mediagoblin/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flakes/mediagoblin/default.nix')
-rw-r--r--flakes/mediagoblin/default.nix213
1 files changed, 213 insertions, 0 deletions
diff --git a/flakes/mediagoblin/default.nix b/flakes/mediagoblin/default.nix
new file mode 100644
index 0000000..47cc628
--- /dev/null
+++ b/flakes/mediagoblin/default.nix
@@ -0,0 +1,213 @@
1{ src, makeWrapper, stdenv, writeScript, fetchurl, buildBowerComponents, which, python36, gst_all_1, automake, autoconf, nodejs, nodePackages, lib, callPackage, fetchgit, fetchFromGitHub }:
2let
3 overridePython = let
4 packageOverrides = self: super: {
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 };
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 };
31 doCheck = false;
32 doInstallCheck = false;
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 doCheck = false;
42 });
43 kombu = super.kombu.overridePythonAttrs(old: rec {
44 version = "3.0.37";
45 src = self.fetchPypi {
46 inherit version;
47 inherit (old) pname;
48 sha256 = "e064a00c66b4d1058cd2b0523fb8d98c82c18450244177b6c0f7913016642650";
49 };
50 propagatedBuildInputs = old.propagatedBuildInputs ++ [ self.anyjson ];
51 doCheck = false;
52 });
53 markdown = super.markdown.overridePythonAttrs(old: rec {
54 version = "3.1.1";
55 src = self.fetchPypi {
56 inherit version;
57 inherit (old) pname;
58 sha256 = "2e50876bcdd74517e7b71f3e7a76102050edec255b3983403f1a63e7c8a41e7a";
59 };
60 });
61 sqlalchemy = super.sqlalchemy.overridePythonAttrs(old: rec {
62 version = "1.1.18";
63 src = self.fetchPypi {
64 inherit version;
65 inherit (old) pname;
66 sha256 = "8b0ec71af9291191ba83a91c03d157b19ab3e7119e27da97932a4773a3f664a9";
67 };
68 doCheck = false;
69 });
70 tempita_5_3_dev = super.buildPythonPackage rec {
71 version = "47414a7-master";
72 pname = "tempita";
73 name = "${pname}-${version}";
74 src = fetchFromGitHub {
75 owner = "gjhiggins";
76 repo = "tempita";
77 rev = "47414a7c6e46a9a9afe78f0bce2ea299fa84d10d";
78 sha256 = "0f33jjjs5rvp7ar2j6ggyfykcrsrn04jaqcq71qfvycf6b7nw3rn";
79 fetchSubmodules = true;
80 };
81 buildInputs = with self; [ nose ];
82 disabled = false;
83 };
84 sqlalchemy_migrate = super.sqlalchemy_migrate.overridePythonAttrs(old: rec {
85 propagatedBuildInputs = with self; [ pbr tempita_5_3_dev decorator sqlalchemy six sqlparse ];
86 });
87 pasteScript = super.pasteScript.overridePythonAttrs(old: rec {
88 version = "2.0.2";
89 name = "PasteScript-${version}";
90 src = fetchurl {
91 url = "mirror://pypi/P/PasteScript/${name}.tar.gz";
92 sha256 = "1h3nnhn45kf4pbcv669ik4faw04j58k8vbj1hwrc532k0nc28gy0";
93 };
94 propagatedBuildInputs = with self; [ six paste PasteDeploy ];
95 });
96 werkzeug = super.werkzeug.overridePythonAttrs(old: rec {
97 version = "0.16.1";
98 src = self.fetchPypi {
99 inherit version;
100 inherit (old) pname;
101 sha256 = "b353856d37dec59d6511359f97f6a4b2468442e454bd1c98298ddce53cac1f04";
102 };
103 });
104 };
105 in
106 python36.override { inherit packageOverrides; };
107 pythonEnv = python-pkgs: with python-pkgs; [
108 waitress alembic dateutil wtforms pybcrypt
109 pytest pytest_xdist werkzeug celery
110 kombu jinja2 Babel webtest configobj markdown
111 sqlalchemy itsdangerous pytz sphinx six
112 oauthlib unidecode jsonschema PasteDeploy
113 requests PyLD exifread
114 typing pasteScript lxml
115 # For images plugin
116 pillow
117 # For video plugin
118 gst-python
119 # migrations
120 sqlalchemy_migrate
121 # authentication
122 ldap3
123 redis
124 psycopg2
125 ];
126 python = overridePython.withPackages pythonEnv;
127 gmg = writeScript "gmg" ''
128 #!${python}/bin/python
129 __requires__ = 'mediagoblin'
130 import sys
131 from pkg_resources import load_entry_point
132
133 if __name__ == '__main__':
134 sys.exit(
135 load_entry_point('mediagoblin', 'console_scripts', 'gmg')()
136 )
137 '';
138 bowerComponents = buildBowerComponents {
139 name = "mediagoblin-bower-components";
140 generated = ./bower-packages.nix;
141 inherit src;
142 };
143 pluginNames = [ "basicsearch" ];
144 allPlugins = lib.attrsets.genAttrs pluginNames
145 (name: callPackage (./plugins + "/${name}") {});
146 toPassthru = pkg: plugins: {
147 inherit allPlugins plugins;
148 withPlugins = withPlugins pkg;
149 };
150 withPlugins = pkg: toPlugins:
151 let
152 plugins = toPlugins allPlugins;
153 toBuildPlugin = n: "ln -s ${n} mediagoblin/plugins/${n.pluginName}";
154 newMediagoblin = pkg.overrideAttrs(old: {
155 postBuild = old.postBuild + "\n" + builtins.concatStringsSep "\n" (map toBuildPlugin plugins);
156 passthru = toPassthru newMediagoblin plugins;
157 });
158 in newMediagoblin;
159 package = stdenv.mkDerivation rec {
160 pname = "mediagoblin";
161 name = "${pname}-${version}";
162 version = "cd465eb-stable";
163 inherit src;
164 preConfigure = ''
165 # ./bootstrap.sh
166 aclocal -I m4 --install
167 autoreconf -fvi
168 # end
169 export HOME=$PWD
170 '';
171 configureFlags = [ "--with-python3" "--without-virtualenv" ];
172 postBuild = ''
173 cp -a ${bowerComponents}/bower_components/* extlib
174 chmod -R u+w extlib
175 make extlib
176 '';
177 installPhase = let
178 libpaths = with gst_all_1; [
179 python
180 gstreamer
181 gst-plugins-base
182 gst-libav
183 gst-plugins-good
184 gst-plugins-bad
185 gst-plugins-ugly
186 ];
187 plugin_paths = builtins.concatStringsSep ":" (map (x: "${x}/lib") libpaths);
188 typelib_paths = with gst_all_1; "${gstreamer}/lib/girepository-1.0:${gst-plugins-base}/lib/girepository-1.0";
189 in ''
190 sed -i "s/registry.has_key(current_theme_name)/current_theme_name in registry/" mediagoblin/tools/theme.py
191 sed -i -e "s@\[DEFAULT\]@[DEFAULT]\nhere = $out@" mediagoblin/config_spec.ini
192 sed -i -e "/from gi.repository import GstPbutils/s/^/gi.require_version('GstPbutils', '1.0')\n/" mediagoblin/media_types/video/transcoders.py
193 cp ${./ldap_fix.py} mediagoblin/plugins/ldap/tools.py
194 find . -name '*.pyc' -delete
195 find . -type f -exec sed -i "s|$PWD|$out|g" {} \;
196 python setup.py build
197 cp -a . $out
198 mkdir $out/bin
199 makeWrapper ${gmg} $out/bin/gmg --prefix PYTHONPATH : "$out:$PYTHONPATH" \
200 --prefix GST_PLUGIN_SYSTEM_PATH : ${plugin_paths} \
201 --prefix GI_TYPELIB_PATH : ${typelib_paths}
202 makeWrapper ${python}/bin/paster $out/bin/paster --prefix PYTHONPATH : "$out:$PYTHONPATH" \
203 --prefix GST_PLUGIN_SYSTEM_PATH : ${plugin_paths} \
204 --prefix GI_TYPELIB_PATH : ${typelib_paths}
205 makeWrapper ${python}/bin/celery $out/bin/celery --prefix PYTHONPATH : "$out:$PYTHONPATH" \
206 --prefix GST_PLUGIN_SYSTEM_PATH : ${plugin_paths} \
207 --prefix GI_TYPELIB_PATH : ${typelib_paths}
208 '';
209 buildInputs = [ makeWrapper automake autoconf which nodePackages.bower nodejs python ];
210 propagatedBuildInputs = with gst_all_1; [ python gst-libav gst-plugins-good gst-plugins-bad gst-plugins-ugly gstreamer ];
211 passthru = toPassthru package [];
212 };
213in package