summaryrefslogtreecommitdiff
path: root/guix.scm
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-11-16 18:52:53 +0100
committerWojtek Kosior <koszko@koszko.org>2022-11-16 21:43:50 +0100
commit08f4d63f450ccd96f5077bc60774d8f1fecec92c (patch)
tree7f09941d62ca23737bc0b1f616d2d50eb7dd14af /guix.scm
downloadkoszko-org-website-08f4d63f450ccd96f5077bc60774d8f1fecec92c.tar.gz
koszko-org-website-08f4d63f450ccd96f5077bc60774d8f1fecec92c.zip
initial commitv2022.11.16
Diffstat (limited to 'guix.scm')
-rw-r--r--guix.scm66
1 files changed, 66 insertions, 0 deletions
diff --git a/guix.scm b/guix.scm
new file mode 100644
index 0000000..9717135
--- /dev/null
+++ b/guix.scm
@@ -0,0 +1,66 @@
+;; SPDX-License-Identifier: CC0-1.0
+
+;; Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org>
+;;
+;; Available under the terms of Creative Commons Zero v1.0 Universal.
+
+;; This file is based on `hydrilla-guix/hydrilla.scm` from Hydrilla&Haketilo
+;; repository at ../pydrilla.
+
+(use-modules
+ (ice-9 rdelim)
+ (ice-9 regex))
+
+;; We're mostly running from Makefile, so it's pretty safe to use `getcwd`.
+(define %source-dir (getcwd))
+
+;; The PKG-INFO file is generated when running `python3 -m build -s` or similar.
+;; It is also automatically included in the source release tarballs.
+(define %website-version
+ (if (access? "src/koszko_org_website.egg-info/PKG-INFO" R_OK)
+ (let* ((port (open-input-file "src/koszko_org_website.egg-info/PKG-INFO"))
+ (process-line
+ (lambda (self-ref)
+ (let ((match-result
+ (string-match "^Version: (.*)" (read-line port))))
+ (if match-result (match:substring match-result 1)
+ (self-ref self-ref))))))
+ (process-line process-line))
+ "unknown"))
+
+(define source-tarball-name
+ (string-append "koszko_org_website-" %website-version ".tar.gz"))
+
+(use-modules
+ (guix packages)
+ (guix gexp)
+ (guix build-system python)
+ ((guix licenses) #:prefix license:)
+ (gnu packages python-build)
+ (gnu packages python-web)
+ (gnu packages python-xyz)
+ (gnu packages python-check))
+
+(package
+ (name "koszko-org-website")
+ (version %website-version)
+ (source
+ ;; setuptools_scm makes it impossible to build directly from git
+ ;; 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)
+ (propagated-inputs
+ (list python-flask))
+ (native-inputs
+ (list python-setuptools-scm
+ python-babel
+ python-pypa-build
+ python-mypy))
+ (home-page "https://git.koszko.org/koszko-org-website")
+ (synopsis "koszko.org website")
+ (description "This is the packaging of the website at https://koszko.org.")
+ (license (list license:cc0
+ (license:non-copyleft
+ "file://LICENSES/LicenseRef-Yahoo-BSD-3.txt")
+ (license:x11-style
+ "file://LICENSES/LicenseRef-Normalize-CSS-MIT.txt"))))