aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix.scm31
-rw-r--r--wsgi.py14
2 files changed, 44 insertions, 1 deletions
diff --git a/guix.scm b/guix.scm
index 9717135..7277e95 100644
--- a/guix.scm
+++ b/guix.scm
@@ -49,6 +49,32 @@
;; checkout. We instead build from source tarball generated under ./dist/.
(local-file (string-append %source-dir "/dist/" source-tarball-name)))
(build-system python-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'replace-wsgi.py
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ ;; In the wsgi.py file, embed the PYTHONPATH containing both the
+ ;; dependencies and the python modules of this package. This will
+ ;; make them available at runtime.
+ (let ((pythonpath
+ (string-append (getenv "GUIX_PYTHONPATH")
+ ":"
+ (site-packages inputs outputs))))
+ (substitute* "wsgi.py"
+ (("^from .* import .*" import-line)
+ (string-append
+ "# Make Guix-installed dependencies visible to Python.\n"
+ "import sys\n"
+ "sys.path.extend('" pythonpath "'.split(':'))\n"
+ "\n"
+ import-line))))))
+ (add-after 'install 'install-wsgi-script
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (share-dir (string-append out "/share/koszko-org-website")))
+ (mkdir-p share-dir)
+ (copy-file "wsgi.py" (string-append share-dir "/wsgi.py"))))))))
(propagated-inputs
(list python-flask))
(native-inputs
@@ -60,7 +86,10 @@
(synopsis "koszko.org website")
(description "This is the packaging of the website at https://koszko.org.")
(license (list license:cc0
+ license:cc-by3.0
(license:non-copyleft
"file://LICENSES/LicenseRef-Yahoo-BSD-3.txt")
(license:x11-style
- "file://LICENSES/LicenseRef-Normalize-CSS-MIT.txt"))))
+ "file://LICENSES/LicenseRef-Normalize-CSS-MIT.txt")
+ (license:fsdg-compatible
+ "file://LICENSES/LicenseRef-no-facebook.txt"))))
diff --git a/wsgi.py b/wsgi.py
new file mode 100644
index 0000000..daebfc8
--- /dev/null
+++ b/wsgi.py
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: CC0-1.0
+
+# WSGI script for koszko.org website.
+#
+# Copyright (C) 2022 Wojtek Kosior
+
+# Uncomment the lines below if you want to use a virtualenv installation of
+# the website package.
+
+#from pathlib import Path
+#path = Path('/path/to/virtualenv/bin/activate_this.py')
+#exec(path.read_text(), {'__file__': str(path)})
+
+from koszko_org_website.app import website_app as application