From 10f3dd0e9e06d71d1bc1615c6a60cc3aa1ad1ff4 Mon Sep 17 00:00:00 2001 From: Janneke Nieuwenhuizen Date: Fri, 18 Aug 2023 11:47:05 +0200 Subject: [PATCH] gnu: Add snuik. * gnu/packages/irc.scm (snuik): New variable. --- gnu/packages/irc.scm | 81 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/gnu/packages/irc.scm b/gnu/packages/irc.scm index f966724022..27e6fde911 100644 --- a/gnu/packages/irc.scm +++ b/gnu/packages/irc.scm @@ -13,6 +13,7 @@ ;;; Copyright © 2021 WinterHound ;;; Copyright © 2022 Jai Vetrivelan ;;; Copyright © 2022 jgart +;;; Copyright © 2023 Janneke Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -39,6 +40,7 @@ (define-module (gnu packages irc) #:use-module (guix build-system cmake) #:use-module (guix build-system gnu) #:use-module (guix build-system go) + #:use-module (guix build-system guile) #:use-module (guix build-system haskell) #:use-module (guix build-system meson) #:use-module (guix build-system python) @@ -49,6 +51,7 @@ (define-module (gnu packages irc) #:use-module (gnu packages autogen) #:use-module (gnu packages autotools) #:use-module (gnu packages base) + #:use-module (gnu packages bash) #:use-module (gnu packages backup) #:use-module (gnu packages boost) #:use-module (gnu packages check) @@ -66,6 +69,7 @@ (define-module (gnu packages irc) #:use-module (gnu packages golang) #:use-module (gnu packages gtk) #:use-module (gnu packages guile) + #:use-module (gnu packages guile-xyz) #:use-module (gnu packages haskell-check) #:use-module (gnu packages haskell-crypto) #:use-module (gnu packages haskell-xyz) @@ -830,3 +834,80 @@ (define-public inspircd server written in C++ for Unix-like operating systems.") (home-page "https://www.inspircd.org/") (license license:gpl2))) + +(define-public snuik + (package + (name "snuik") + (version "0.0") + (source + (origin + (method url-fetch) + (uri (string-append "https://dezyne.org/download/snuik/" + name "-" version ".tar.gz")) + (sha256 + (base32 "1lm6mbgfjzjk3pvzp1y9wkdz9dr2qyl1c6ib1hqxrnvkmlciy5p5")))) + (native-inputs (list guile-3.0)) + (inputs (list bash-minimal guile-3.0 guile-8sync)) + (build-system guile-build-system) + (arguments + (list + #:not-compiled-file-regexp "(guix|guix/.*)[.]scm$" + #:modules '((srfi srfi-1) + (ice-9 popen) + (guix build guile-build-system) + (guix build utils)) + #:phases + #~(modify-phases %standard-phases + #$@(if (%current-target-system) + #~() + #~((add-after 'build 'check + (lambda _ + (let* ((tests (find-files "test" "[.]scm$")) + (guile #$(this-package-input "guile")) + (guile (string-append guile "/bin/guile"))) + (fold (lambda (test result) + (and + result + (invoke guile "--no-auto-compile" test))) + #t + tests)))))) + (add-after 'install 'install-script + (lambda _ + (let* ((bash #$(this-package-input "bash-minimal")) + (bash (string-append bash "/bin/bash")) + (guile #$(this-package-input "guile")) + (guile (string-append guile "/bin/guile")) + (build-guile #$(this-package-native-input "guile")) + (build-guile (string-append build-guile "/bin/guile")) + (guile-8sync #$(this-package-input "guile-8sync")) + (out #$output) + (bin (string-append out "/bin")) + (effective (read + (open-pipe* OPEN_READ + build-guile "-c" + "(write (effective-version))"))) + (path (list (string-append guile "/bin"))) + (scm-dir (string-append "/share/guile/site/" effective)) + (scm-path (list (string-append out scm-dir) + (string-append guile-8sync scm-dir))) + (go-dir (string-append "/lib/guile/" effective + "/site-ccache/")) + (go-path (list (string-append out go-dir) + (string-append guile-8sync go-dir)))) + (mkdir-p "bin") + (copy-file "snuik.sh" "bin/snuik") + (substitute* "bin/snuik" + (("@SHELL@") bash)) + (chmod "snuik" #o755) + (install-file "bin/snuik" bin) + (wrap-script (string-append out "/bin/snuik") + `("PATH" ":" prefix ,path) + `("GUILE_AUTO_COMPILE" ":" = ("0")) + `("GUILE_LOAD_PATH" ":" prefix ,scm-path) + `("GUILE_LOAD_COMPILED_PATH" ":" prefix ,go-path)))))))) + (home-page "https://gitlab.com/janneke/snuik") + (synopsis "IRC bot using Guile-8sync") + (description "@code{Snuik} is an IRC bot using the GNU 8sync (for +now). It has some basic functionality only, such as seen, tell, and +what.") + (license license:gpl3+)))