From 11bbc5defff987c1d4fe7c96540431286782aca8 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 24 Jan 2024 10:48:38 -0500 Subject: [PATCH] Guixify --- guix.scm | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 guix.scm diff --git a/guix.scm b/guix.scm new file mode 100644 index 0000000..3e08c9a --- /dev/null +++ b/guix.scm @@ -0,0 +1,77 @@ +(use-modules + ((guix licenses) #:prefix license:) + (guix packages) + (guix download) + (guix git-download) + (guix build-system cmake) + (gnu packages crypto) + (gnu packages databases) + (gnu packages libidn) + (gnu packages linux) + (gnu packages python) + (gnu packages sqlite) + (gnu packages version-control) + (gnu packages xml) + (ice-9 rdelim) + (ice-9 popen)) + +;;;; + +(define %source-dir (dirname (current-filename))) +(define %git-dir (string-append %source-dir "/.git")) + +; double-escaped template of the biboumi sexp +; This allows us to bake the expression without doing a full eval to a record, +; so it can be written +(define-public biboumi-template + '(package + (name "biboumi") + (version (read-line (open-pipe* OPEN_READ "git" "--git-dir" %git-dir "describe" "--always" "--dirty"))) + (source + `(origin + (method git-fetch) + (uri (git-reference + (recursive? #t) + (url "https://git.singpolyma.net/biboumi") + (commit ,(read-line (open-pipe* OPEN_READ "git" "--git-dir" %git-dir "rev-parse" "HEAD"))))) + (file-name (git-file-name name version)) + (sha256 + (base32 + ,(read-line (open-pipe* OPEN_READ "guix" "hash" "-rx" %source-dir)))))) + (build-system 'cmake-build-system) + (arguments + '`(#:tests? #f + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'fix-etc-reference + (lambda* (#:key outputs #:allow-other-keys) + (substitute* "CMakeLists.txt" + ((".etc.biboumi") (string-append (assoc-ref outputs "out") "/etc/biboumi")))))))) + (inputs + '(list + botan + expat + git + libidn2 + postgresql + python + sqlite + `(,util-linux "lib"))) + (home-page "https://git.singpolyma.net/biboumi") + (synopsis "XMPP to IRC bridge") + (description "") + (license 'license:bsd-3))) + +; Baked version of jmp-pay-template with leaves eval'd +(define-public biboumi-baked + (cons + (car biboumi-template) + (map + (lambda (x) (list (car x) (eval (cadr x) (current-module)))) + (cdr biboumi-template)))) + +; Build clean from git the version from a local clone +; To build whatever is sitting in local use: +; guix build --with-source=$PWD -f guix.scm + +(eval biboumi-baked (current-module)) -- 2.45.2