aboutsummaryrefslogtreecommitdiff
;;; Whispers --- Stealth VPN and ssh tunneler
;;; Copyright © 2023 Runciter <runciter@whispers-vpn.org>
;;;
;;; This file is part of Whispers.
;;;
;;; Whispers is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; Whispers is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with Whispers.  If not, see <http://www.gnu.org/licenses/>.

(define-module (whispers packages whispers)
  #:use-module (gnu)
  #:use-module (gnu packages package-management)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages gettext)
  #:use-module (gnu packages texinfo)
  #:use-module (gnu packages man)
  #:use-module (gnu packages base)
  #:use-module (gnu packages admin)
  #:use-module (gnu packages guile)
  #:use-module (gnu packages guile-xyz)
  #:use-module (gnu packages pkg-config)
  #:use-module (guix packages)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system guile)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix git)
  #:use-module ((guix licenses) #:prefix license:)
  #:export ())

(define-public whispers
  (let ((commit "2b583171c9480e129d0349d1cf9a580a9c8b19e6")
        (chksum "13p02hdfnmkf5wr2d6acpcfix03crsn68wkvm73cmy0ibndjvczk"))
    (package
     (name "whispers")
     (version "0.1")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
              (url "https://git.whispers-vpn.org/whispers-command.git")
              (commit commit)))
        (sha256 (base32 chksum))))
     (build-system gnu-build-system)
     (arguments
      `(#:modules
        ((ice-9 match)
         (ice-9 ftw)
         ,@%gnu-build-system-modules)
        #:phases
        (modify-phases
         %standard-phases
         (add-after
          'install
          'hall-wrap-binaries
          (lambda* (#:key inputs outputs #:allow-other-keys)
            (let* ((compiled-dir
                    (lambda (out version)
                      (string-append
                       out
                       "/lib/guile/"
                       version
                       "/site-ccache")))
                   (uncompiled-dir
                    (lambda (out version)
                      (string-append
                       out
                       "/share/guile/site"
                       (if (string-null? version) "" "/")
                       version)))
                   (dep-path
                    (lambda (env modules path)
                      (list env
                            ":"
                            'prefix
                            (cons modules
                                  (map (lambda (input)
                                         (string-append
                                          (assoc-ref inputs input)
                                          path))
                                       ,''("guile-config"))))))
                   (out (assoc-ref outputs "out"))
                   (bin (string-append out "/bin/"))
                   (site (uncompiled-dir out "")))
              (match (scandir site)
                (("." ".." version)
                 (for-each
                  (lambda (file)
                    (wrap-program
                     (string-append bin file)
                     (dep-path
                      "GUILE_LOAD_PATH"
                      (uncompiled-dir out version)
                      (uncompiled-dir "" version))
                     (dep-path
                      "GUILE_LOAD_COMPILED_PATH"
                      (compiled-dir out version)
                      (compiled-dir "" version))))
                  ,''("whispers"))
                 #t))))))))
     (native-inputs
      (list autoconf automake pkg-config texinfo))
     (inputs (list guile-3.0))
     (propagated-inputs (list guile-config))
     (synopsis
      "Perform actions of the services of the shepherd daemons of\na whispers tree.")
     (description
      "The whispers command is a simple convenience wrapper\n around the herd program. Instead of specifying a file path\nto the listening socket of a running shepherd in the whispers tree, the\nuser simply provides its absolute whispers tree path as an\nargument to the --lieutenant option of this command.")
     (home-page "https://git.whispers-vpn.org/whispers-command.git")
     (license license:gpl3+))))