docs: Add chapter on upgrading, inc. system Python upgrades [#972].
[mediagoblin.git] / guix-env.scm
1 ;;; GNU MediaGoblin -- federated, autonomous media hosting
2 ;;; Copyright © 2015, 2016 David Thompson <davet@gnu.org>
3 ;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org>
4 ;;; Copyright © 2019 Ben Sturmfels <ben@sturm.com.au>
5 ;;;
6 ;;; This program is free software: you can redistribute it and/or modify
7 ;;; it under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation, either version 3 of the License, or
9 ;;; (at your option) any later version.
10 ;;;
11 ;;; This program is distributed in the hope that it will be useful,
12 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; ========================================
17 ;;;
18 ;;; ... This file is also part of GNU MediaGoblin, but we're leaving it
19 ;;; under GPLv3 for easy merge back and forth between Guix proper. It
20 ;;; also borrows some code directly from Guix.
21 ;;;
22 ;;; ========================================
23 ;;;
24 ;;; With `guix environment' you can use guix as kind of a universal
25 ;;; virtualenv, except a universal virtualenv with magical time traveling
26 ;;; properties and also, not just for Python.
27 ;;;
28 ;;; Ok, here's how to use this thing! First, install Guix.
29 ;;; Then do:
30 ;;; guix environment -l guix-env.scm --pure
31 ;;;
32 ;;; While using --pure is a robust way to ensure that other environment
33 ;;; variables don't cause unexpected behaviour, it may trip up aspects of your
34 ;;; development tools, such as removing reference to $EDITOR. Feel free to
35 ;;; remove the --pure.
36 ;;;
37 ;;; You'll need to run the above command every time you close your terminal or
38 ;;; restart your system, so a handy way to save having to remember is to install
39 ;;; "direnv" an then create a ".envrc" file in your current directory containing
40 ;;; the following and then run "direnv allow" when prompted:
41 ;;; use guix -l guix-env.scm
42 ;;;
43 ;;; To set things up for the first time, you'll also need to run:
44 ;;; git submodule init
45 ;;; git submodule update
46 ;;; ./bootstrap.sh
47 ;;; ./configure --with-python3 --without-virtualenv
48 ;;; make
49 ;;; python3 -m venv --system-site-packages . && bin/python setup.py develop --no-deps
50 ;;; bin/python -m pip install --force-reinstall PasteScript # workaround
51 ;;; bin/python -m pip install 'werkzeug<1.0.0' # workaround
52 ;;; bin/python -m pip install 'email-validator' # email-validator
53 ;;;
54 ;;; ... wait whaaat, what's that venv line?! I thought you said this
55 ;;; was a reasonable virtualenv replacement! Well it is and it will
56 ;;; be, but there's a catch, and the catch is that Guix doesn't know
57 ;;; about this directory and "setup.py dist" is technically necessary
58 ;;; for certain things to run, so we have a virtualenv with nothing
59 ;;; in it but this project itself.
60 ;;;
61 ;;; The devtools/update_extlib.sh script won't run on Guix due to missing
62 ;;; "/usr/bin/env", so then run:
63 ;;; node node_modules/.bin/bower install
64 ;;; ./devtools/update_extlib.sh
65 ;;; bin/gmg dbupdate
66 ;;; bin/gmg adduser --username admin --password a --email admin@example.com
67 ;;; ./lazyserver.sh <-- won't work
68 ;;; CELERY_ALWAYS_EAGER=true ./bin/paster serve paste.ini --reload
69 ;;;
70 ;;; So anyway, now you can do:
71 ;;; PYTHONPATH="${PYTHONPATH}:$(pwd)" ./runtests.sh
72 ;;; or:
73 ;;; bin/python -m pytest ./mediagoblin/tests --boxed
74 ;;;
75 ;;; Now notably this is goofier looking than running a virtualenv,
76 ;;; but soon I'll do something truly evil (I hope) that will make
77 ;;; the virtualenv and path-hacking stuff unnecessary.
78 ;;;
79 ;;; Have fun!
80 ;;;
81 ;;; Known issues:
82 ;;; - currently fails to upload h264 source video: "GStreamer: missing H.264 decoder"
83 ;;
84 ;; TODO: Add PDF support.
85
86 (use-modules (ice-9 match)
87 (srfi srfi-1)
88 (guix packages)
89 (guix licenses)
90 (guix download)
91 (guix git-download)
92 (guix build-system gnu)
93 (guix build-system python)
94 (gnu packages)
95 (gnu packages autotools)
96 (gnu packages base)
97 (gnu packages certs)
98 (gnu packages check)
99 (gnu packages databases)
100 (gnu packages python)
101 (gnu packages python-crypto)
102 (gnu packages python-web)
103 (gnu packages python-xyz)
104 (gnu packages sphinx)
105 (gnu packages gstreamer)
106 (gnu packages glib)
107 (gnu packages rsync)
108 (gnu packages ssh)
109 (gnu packages time)
110 (gnu packages video)
111 (gnu packages version-control)
112 (gnu packages xml)
113 ((guix licenses) #:select (expat zlib) #:prefix license:))
114
115 ;; =================================================================
116 ;; These packages are on their way into Guix proper but haven't made
117 ;; it in yet... or they're old versions of packages we're pinning
118 ;; ourselves to...
119 ;; =================================================================
120
121 (define python-pytest-forked
122 (package
123 (name "python-pytest-forked")
124 (version "1.0.2")
125 (source
126 (origin
127 (method url-fetch)
128 (uri (pypi-uri "pytest-forked" version))
129 (sha256
130 (base32
131 "0f4y1jhcg70xhm220pdb8r24n01knhn749aqlr14vmgbsb7allnk"))))
132 (build-system python-build-system)
133 (propagated-inputs
134 `(("python-pytest" ,python-pytest)
135 ("python-setuptools-scm" ,python-setuptools-scm)))
136 (home-page
137 "https://github.com/pytest-dev/pytest-forked")
138 (synopsis
139 "run tests in isolated forked subprocesses")
140 (description
141 "run tests in isolated forked subprocesses")
142 (license license:expat)))
143
144 ;; =================================================================
145
146 (define mediagoblin
147 (package
148 (name "mediagoblin")
149 (version "0.8.1")
150 (source
151 (origin
152 (method url-fetch)
153 (uri (pypi-uri "mediagoblin" version))
154 (sha256
155 (base32
156 "0p2gj4z351166d1zqmmd8wc9bzb69w0fjm8qq1fs8dw2yhcg2wwv"))))
157 (build-system python-build-system)
158 (arguments
159 ;; Complains about missing gunicorn. Not sure where that comes from.
160 '(#:tests? #f))
161 (native-inputs
162 `(("python-pytest" ,python-pytest)
163 ("nss-certs" ,nss-certs)))
164 (propagated-inputs
165 `(("python-alembic" ,python-alembic)
166 ("python-pytest-xdist" ,python-pytest-xdist)
167 ("python-pytest-forked" ,python-pytest-forked)
168 ("python-celery" ,python-celery)
169 ("python-kombu" ,python-kombu)
170 ("python-webtest" ,python-webtest)
171 ("python-pastedeploy" ,python-pastedeploy)
172 ("python-paste" ,python-paste)
173 ("python-pastescript" ,python-pastescript)
174 ("python-translitcodec" ,python-translitcodec)
175 ("python-babel" ,python-babel)
176 ("python-configobj" ,python-configobj)
177 ("python-dateutil" ,python-dateutil)
178 ("python-itsdangerous" ,python-itsdangerous)
179 ("python-jinja2" ,python-jinja2)
180 ("python-jsonschema" ,python-jsonschema)
181 ("python-lxml" ,python-lxml)
182 ("python-markdown" ,python-markdown)
183 ("python-oauthlib" ,python-oauthlib)
184 ("python-pillow" ,python-pillow)
185 ("python-py-bcrypt" ,python-py-bcrypt)
186 ("python-pyld" ,python-pyld)
187 ("python-pytz" ,python-pytz)
188 ("python-requests" ,python-requests)
189 ("python-setuptools" ,python-setuptools)
190 ("python-six" ,python-six)
191 ("python-sphinx" ,python-sphinx)
192 ("python-docutils" ,python-docutils)
193 ("python-sqlalchemy" ,python-sqlalchemy)
194 ("python-unidecode" ,python-unidecode)
195 ;; ("python-werkzeug" ,python-werkzeug) ; Broken due to missing werkzeug.contrib.atom in 1.0.0.
196 ("python-exif-read" ,python-exif-read)
197 ("python-wtforms" ,python-wtforms)))
198 (home-page "http://mediagoblin.org/")
199 (synopsis "Web application for media publishing")
200 (description "MediaGoblin is a web application for publishing all kinds of
201 media.")
202 (license agpl3+)))
203
204 (package
205 (inherit mediagoblin)
206 (name "mediagoblin-hackenv")
207 (version "git")
208 (inputs
209 `(;;; audio/video stuff
210 ("openh264" ,openh264)
211 ("gstreamer" ,gstreamer)
212 ("gst-libav" ,gst-plugins-base)
213 ("gst-plugins-base" ,gst-plugins-base)
214 ("gst-plugins-good" ,gst-plugins-good)
215 ("gst-plugins-bad" ,gst-plugins-bad)
216 ("gst-plugins-ugly" ,gst-plugins-ugly)
217 ("gobject-introspection" ,gobject-introspection)
218 ;; useful to have!
219 ("coreutils" ,coreutils)
220 ;; used by runtests.sh!
221 ("which" ,which)
222 ("git" ,git)
223 ("automake" ,automake)
224 ("autoconf" ,autoconf)
225 ,@(package-inputs mediagoblin)))
226 (propagated-inputs
227 `(("python" ,python)
228 ("python-virtualenv" ,python-virtualenv)
229 ("python-pygobject" ,python-pygobject)
230 ("python-gst" ,python-gst)
231 ;; Needs python-gst in order for all tests to pass
232 ("python-numpy" ,python-numpy) ; this pulls in texlive...
233 ; and texlive-texmf is very large...
234 ("python-chardet", python-chardet)
235 ("python-psycopg2" ,python-psycopg2)
236 ;; For developing
237 ("openssh" ,openssh)
238 ("git" ,git)
239 ("rsync" ,rsync)
240 ,@(package-propagated-inputs mediagoblin))))