aboutsummaryrefslogtreecommitdiff
path: root/pkgs/webapps/mediagoblin
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/webapps/mediagoblin')
-rw-r--r--pkgs/webapps/mediagoblin/bower-packages.nix8
-rw-r--r--pkgs/webapps/mediagoblin/default.nix210
-rw-r--r--pkgs/webapps/mediagoblin/ldap_fix.py93
-rw-r--r--pkgs/webapps/mediagoblin/plugins/basicsearch/default.nix18
-rw-r--r--pkgs/webapps/mediagoblin/tempita.json15
5 files changed, 0 insertions, 344 deletions
diff --git a/pkgs/webapps/mediagoblin/bower-packages.nix b/pkgs/webapps/mediagoblin/bower-packages.nix
deleted file mode 100644
index 03af849..0000000
--- a/pkgs/webapps/mediagoblin/bower-packages.nix
+++ /dev/null
@@ -1,8 +0,0 @@
1# Generated by bower2nix v3.2.0 (https://github.com/rvl/bower2nix)
2{ fetchbower, buildEnv }:
3buildEnv { name = "bower-env"; ignoreCollisions = true; paths = [
4 (fetchbower "jquery" "2.1.4" "~2.1.3" "1ywrpk2xsr6ghkm3j9gfnl9r3jn6xarfamp99b0bcm57kq9fm2k0")
5 (fetchbower "video.js" "4.11.4" "~4.11.4" "05prdvyk0rxbkh7sdd0d9ns5l5crwvc68wzkyqmrdjw367pcv8sn")
6 (fetchbower "leaflet" "0.7.7" "~0.7.3" "0jim285bljmxxngpm3yx6bnnd10n2whwkgmmhzpcd1rdksnr5nca")
7 (fetchbower "tinymce" "4.1.10" "~4.1.7" "16jyvdb9bq8gjwhs69q8p88vdixalajrz81nsmbrzzxhkih57dyx")
8]; }
diff --git a/pkgs/webapps/mediagoblin/default.nix b/pkgs/webapps/mediagoblin/default.nix
deleted file mode 100644
index 22cb292..0000000
--- a/pkgs/webapps/mediagoblin/default.nix
+++ /dev/null
@@ -1,210 +0,0 @@
1{ makeWrapper, stdenv, writeScript, fetchurl, buildBowerComponents, mylibs, which, python36, gst_all_1, automake, autoconf, nodejs, nodePackages, lib, callPackage, fetchgit }:
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 (mylibs.fetchedGithub ./tempita.json // rec {
71 buildInputs = with self; [ nose ];
72 disabled = false;
73 });
74 sqlalchemy_migrate = super.sqlalchemy_migrate.overridePythonAttrs(old: rec {
75 propagatedBuildInputs = with self; [ pbr tempita_5_3_dev decorator sqlalchemy six sqlparse ];
76 });
77 pasteScript = super.pasteScript.overridePythonAttrs(old: rec {
78 version = "2.0.2";
79 name = "PasteScript-${version}";
80 src = fetchurl {
81 url = "mirror://pypi/P/PasteScript/${name}.tar.gz";
82 sha256 = "1h3nnhn45kf4pbcv669ik4faw04j58k8vbj1hwrc532k0nc28gy0";
83 };
84 propagatedBuildInputs = with self; [ six paste PasteDeploy ];
85 });
86 werkzeug = super.werkzeug.overridePythonAttrs(old: rec {
87 version = "0.16.1";
88 src = self.fetchPypi {
89 inherit version;
90 inherit (old) pname;
91 sha256 = "b353856d37dec59d6511359f97f6a4b2468442e454bd1c98298ddce53cac1f04";
92 };
93 });
94 };
95 in
96 python36.override { inherit packageOverrides; };
97 pythonEnv = python-pkgs: with python-pkgs; [
98 waitress alembic dateutil wtforms pybcrypt
99 pytest pytest_xdist werkzeug celery
100 kombu jinja2 Babel webtest configobj markdown
101 sqlalchemy itsdangerous pytz sphinx six
102 oauthlib unidecode jsonschema PasteDeploy
103 requests PyLD exifread
104 typing pasteScript lxml
105 # For images plugin
106 pillow
107 # For video plugin
108 gst-python
109 # migrations
110 sqlalchemy_migrate
111 # authentication
112 ldap3
113 redis
114 psycopg2
115 ];
116 python = overridePython.withPackages pythonEnv;
117 gmg = writeScript "gmg" ''
118 #!${python}/bin/python
119 __requires__ = 'mediagoblin'
120 import sys
121 from pkg_resources import load_entry_point
122
123 if __name__ == '__main__':
124 sys.exit(
125 load_entry_point('mediagoblin', 'console_scripts', 'gmg')()
126 )
127 '';
128 mediagoblinSrc = fetchgit {
129 name = "mediagoblin";
130 url = "git://git.savannah.gnu.org/mediagoblin.git";
131 rev = "cd465ebfec837a75a44c4ebd727dffe2fff6d850";
132 sha256 = "1yz4i4i97z3rxl534a6psaybyjbyp5nnc52v3nvbpzc4pd2s69mx";
133 fetchSubmodules = true; # important!
134 };
135 bowerComponents = buildBowerComponents {
136 name = "mediagoblin-bower-components";
137 generated = ./bower-packages.nix;
138 src = mediagoblinSrc;
139 };
140 pluginNames = [ "basicsearch" ];
141 allPlugins = lib.attrsets.genAttrs pluginNames
142 (name: callPackage (./plugins + "/${name}") {});
143 toPassthru = pkg: {
144 inherit allPlugins;
145 withPlugins = withPlugins pkg;
146 };
147 withPlugins = pkg: toPlugins:
148 let
149 plugins = toPlugins allPlugins;
150 toBuildPlugin = n: "ln -s ${n} mediagoblin/plugins/${n.pluginName}";
151 newMediagoblin = pkg.overrideAttrs(old: {
152 postBuild = old.postBuild + "\n" + builtins.concatStringsSep "\n" (map toBuildPlugin plugins);
153 passthru = toPassthru newMediagoblin;
154 });
155 in newMediagoblin;
156 package = stdenv.mkDerivation rec {
157 pname = "mediagoblin";
158 name = "${pname}-${version}";
159 version = "cd465eb-stable";
160 src = mediagoblinSrc;
161 preConfigure = ''
162 # ./bootstrap.sh
163 aclocal -I m4 --install
164 autoreconf -fvi
165 # end
166 export HOME=$PWD
167 '';
168 configureFlags = [ "--with-python3" "--without-virtualenv" ];
169 postBuild = ''
170 cp -a ${bowerComponents}/bower_components/* extlib
171 chmod -R u+w extlib
172 make extlib
173 '';
174 installPhase = let
175 libpaths = with gst_all_1; [
176 python
177 gstreamer
178 gst-plugins-base
179 gst-libav
180 gst-plugins-good
181 gst-plugins-bad
182 gst-plugins-ugly
183 ];
184 plugin_paths = builtins.concatStringsSep ":" (map (x: "${x}/lib") libpaths);
185 typelib_paths = with gst_all_1; "${gstreamer}/lib/girepository-1.0:${gst-plugins-base}/lib/girepository-1.0";
186 in ''
187 sed -i "s/registry.has_key(current_theme_name)/current_theme_name in registry/" mediagoblin/tools/theme.py
188 sed -i -e "s@\[DEFAULT\]@[DEFAULT]\nhere = $out@" mediagoblin/config_spec.ini
189 sed -i -e "/from gi.repository import GstPbutils/s/^/gi.require_version('GstPbutils', '1.0')\n/" mediagoblin/media_types/video/transcoders.py
190 cp ${./ldap_fix.py} mediagoblin/plugins/ldap/tools.py
191 find . -name '*.pyc' -delete
192 find . -type f -exec sed -i "s|$PWD|$out|g" {} \;
193 python setup.py build
194 cp -a . $out
195 mkdir $out/bin
196 makeWrapper ${gmg} $out/bin/gmg --prefix PYTHONPATH : "$out:$PYTHONPATH" \
197 --prefix GST_PLUGIN_SYSTEM_PATH : ${plugin_paths} \
198 --prefix GI_TYPELIB_PATH : ${typelib_paths}
199 makeWrapper ${python}/bin/paster $out/bin/paster --prefix PYTHONPATH : "$out:$PYTHONPATH" \
200 --prefix GST_PLUGIN_SYSTEM_PATH : ${plugin_paths} \
201 --prefix GI_TYPELIB_PATH : ${typelib_paths}
202 makeWrapper ${python}/bin/celery $out/bin/celery --prefix PYTHONPATH : "$out:$PYTHONPATH" \
203 --prefix GST_PLUGIN_SYSTEM_PATH : ${plugin_paths} \
204 --prefix GI_TYPELIB_PATH : ${typelib_paths}
205 '';
206 buildInputs = [ makeWrapper automake autoconf which nodePackages.bower nodejs python ];
207 propagatedBuildInputs = with gst_all_1; [ python gst-libav gst-plugins-good gst-plugins-bad gst-plugins-ugly gstreamer ];
208 passthru = toPassthru package;
209 };
210in package
diff --git a/pkgs/webapps/mediagoblin/ldap_fix.py b/pkgs/webapps/mediagoblin/ldap_fix.py
deleted file mode 100644
index 10cc375..0000000
--- a/pkgs/webapps/mediagoblin/ldap_fix.py
+++ /dev/null
@@ -1,93 +0,0 @@
1# GNU MediaGoblin -- federated, autonomous media hosting
2# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU Affero General Public License as published by
6# the Free Software Foundation, either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU Affero General Public License for more details.
13#
14# You should have received a copy of the GNU Affero General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16from ldap3 import Server, Connection, SUBTREE
17from ldap3.core.exceptions import LDAPException
18import logging
19
20import six
21
22from mediagoblin.tools import pluginapi
23
24_log = logging.getLogger(__name__)
25
26
27class LDAP(object):
28 def __init__(self):
29 self.ldap_settings = pluginapi.get_config('mediagoblin.plugins.ldap')
30
31 def _connect(self, server):
32 _log.info('Connecting to {0}.'.format(server['LDAP_SERVER_URI']))
33 self.server = Server(server['LDAP_SERVER_URI'])
34
35 if 'LDAP_START_TLS' in server and server['LDAP_START_TLS'] == 'true':
36 _log.info('Initiating TLS')
37 self.server.start_tls()
38
39 def _manager_auth(self, settings, username, password):
40 conn = Connection(self.server,
41 settings['LDAP_BIND_DN'],
42 settings['LDAP_BIND_PW'],
43 auto_bind=True)
44 found = conn.search(
45 search_base=settings['LDAP_SEARCH_BASE'],
46 search_filter=settings['LDAP_SEARCH_FILTER'].format(username=username),
47 search_scope=SUBTREE,
48 attributes=[settings['EMAIL_SEARCH_FIELD']])
49 if (not found) or len(conn.entries) > 1:
50 return False, None
51
52 user = conn.entries[0]
53 user_dn = user.entry_dn
54 try:
55 email = user.entry_attributes_as_dict[settings['EMAIL_SEARCH_FIELD']][0]
56 except KeyError:
57 email = None
58
59 Connection(self.server, user_dn, password, auto_bind=True)
60
61 return username, email
62
63 def _direct_auth(self, settings, username, password):
64 user_dn = settings['LDAP_USER_DN_TEMPLATE'].format(username=username)
65 conn = Connection(self.server, user_dn, password, auto_bind=True)
66 email_found = conn.search(
67 search_base=settings['LDAP_SEARCH_BASE'],
68 search_filter='uid={0}'.format(username),
69 search_scope=SUBTREE,
70 attributes=[settings['EMAIL_SEARCH_FIELD']])
71
72 if email_found:
73 try:
74 email = conn.entries[0].entry_attributes_as_dict[settings['EMAIL_SEARCH_FIELD']][0]
75 except KeyError:
76 email = None
77
78 return username, email
79
80 def login(self, username, password):
81 for k, v in six.iteritems(self.ldap_settings):
82 try:
83 self._connect(v)
84
85 if 'LDAP_BIND_DN' in v:
86 return self._manager_auth(v, username, password)
87 else:
88 return self._direct_auth(v, username, password)
89
90 except LDAPException as e:
91 _log.info(e)
92
93 return False, None
diff --git a/pkgs/webapps/mediagoblin/plugins/basicsearch/default.nix b/pkgs/webapps/mediagoblin/plugins/basicsearch/default.nix
deleted file mode 100644
index 16be613..0000000
--- a/pkgs/webapps/mediagoblin/plugins/basicsearch/default.nix
+++ /dev/null
@@ -1,18 +0,0 @@
1{ stdenv, fetchFromGitHub }:
2stdenv.mkDerivation rec {
3 name = "mediagoblin-plugin-basicsearch-${version}";
4 version = "ba0a154-master";
5 src = fetchFromGitHub {
6 owner = "ayleph";
7 repo = "mediagoblin-basicsearch";
8 rev = "ba0a1547bd24ebaf363227fe17644d38c6ce8a6b";
9 sha256 = "0d4r7xkf4gxmgaxlb264l44xbanis77g49frwfhfzsflxmdwgncy";
10 };
11 phases = "unpackPhase installPhase";
12 installPhase = ''
13 cp -R ./basicsearch $out
14 '';
15 passthru = {
16 pluginName = "basicsearch";
17 };
18}
diff --git a/pkgs/webapps/mediagoblin/tempita.json b/pkgs/webapps/mediagoblin/tempita.json
deleted file mode 100644
index 5371e17..0000000
--- a/pkgs/webapps/mediagoblin/tempita.json
+++ /dev/null
@@ -1,15 +0,0 @@
1{
2 "tag": "47414a7-master",
3 "meta": {
4 "name": "tempita",
5 "url": "https://github.com/gjhiggins/tempita",
6 "branch": "master"
7 },
8 "github": {
9 "owner": "gjhiggins",
10 "repo": "tempita",
11 "rev": "47414a7c6e46a9a9afe78f0bce2ea299fa84d10d",
12 "sha256": "0f33jjjs5rvp7ar2j6ggyfykcrsrn04jaqcq71qfvycf6b7nw3rn",
13 "fetchSubmodules": true
14 }
15}