aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/uucp.scm
blob: e10de59aa23612b808c7c64780d7e874b0661567 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix 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.
;;;
;;; GNU Guix 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 GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages uucp)
  #:use-module (gnu packages golang)
  #:use-module (gnu packages texinfo)
  #:use-module (guix licenses)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system go))

(define-public uucp
  (package
    (name "uucp")
    (version "1.07")
    (source (origin
              (method url-fetch)
              (uri (string-append "mirror://gnu/uucp/uucp-"
                                  version ".tar.gz"))
              (sha256
               (base32
                "0b5nhl9vvif1w3wdipjsk8ckw49jj1w85xw1mmqi3zbcpazia306"))))
    (build-system gnu-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (replace 'configure
           (lambda* (#:key outputs #:allow-other-keys)
             ;; The old 'configure' script doesn't support the arguments
             ;; that we pass by default.
             (setenv "CONFIG_SHELL" (which "sh"))
             (let ((out (assoc-ref outputs "out")))
               (invoke "./configure"
                       (string-append "--prefix=" out)
                       (string-append "--infodir=" out
                                      "/share/info"))))))))
    (home-page "https://www.gnu.org/software/uucp/uucp.html")
    (synopsis "UUCP protocol implementation")
    (description
     "Taylor UUCP is the GNU implementation of UUCP (Unix-to-Unix Copy), a
set of utilities for remotely transferring files, email and net news
between computers.")
    (license gpl2+)))

(define-public nncp
  (package
    (name "nncp")
    (version "7.5.0")
    (source
     (origin
       (method url-fetch)
       (uri (string-append "http://www.nncpgo.org/download/nncp-"
                           version ".tar.xz"))
       (sha256
        (base32
         "1r1zgj7gpkdmdm3wf31m0xi8y313kzd4dbyp4r4y8khnp32jvn8l"))
       (modules '((ice-9 ftw)
                  (guix build utils)))
       (snippet
        '(begin
           ;; Unbundle dependencies.
           ;; TODO: go.cypherpunks.ru was down at the time of
           ;; packaging. Unbundle go.cypherpunks dependencies as well once it
           ;; comes back online.
           (for-each (lambda (file)
                       (unless (member file (list "." ".." "go.cypherpunks.ru"))
                         (delete-file-recursively (string-append "src/vendor/" file))))
                     (scandir "src/vendor"))
           ;; Delete built documentation.
           (delete-file "doc/nncp.info")
           #t))))
    (build-system gnu-build-system)
    (arguments
     `(#:modules ((guix build gnu-build-system)
                  ((guix build go-build-system) #:prefix go:)
                  (guix build utils))
       #:imported-modules ,%go-build-system-modules
       #:phases
       (modify-phases %standard-phases
         (add-before 'unpack 'setup-go-environment
           (assoc-ref go:%standard-phases 'setup-go-environment))
         (add-after 'unpack 'go-unpack
           (lambda* (#:key source #:allow-other-keys)
             ;; Copy source to GOPATH.
             (copy-recursively "src" "../src/go.cypherpunks.ru/nncp/v7")
             ;; Move bundled dependencies to GOPATH.
             (for-each (lambda (dependency)
                         (rename-file (string-append "src/vendor/go.cypherpunks.ru/"
                                                     dependency)
                                      (string-append "../src/go.cypherpunks.ru/"
                                                     dependency)))
                       (list "balloon" "recfile"))
             ;; Delete empty bundled dependencies directory.
             (delete-file-recursively "src/vendor")))
         (replace 'configure
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
               ;; Set configuration path.
               (setenv "CFGPATH" "/etc/nncp.hjson")
               ;; Set output directories.
               (setenv "BINDIR" (string-append out "/bin"))
               (setenv "INFODIR" (string-append out "/share/info"))
               (setenv "DOCDIR" (string-append out "/share/doc/nncp")))
             ;; Set absolute store paths to sh and cat.
             (substitute* (list "src/pipe.go" "src/toss_test.go")
               (("/bin/sh") (which "sh")))
             (substitute* "src/toss_test.go"
               (("; cat") (string-append "; " (which "cat"))))
             ;; Remove module flags.
             (substitute* (list "bin/default.do" "bin/hjson-cli.do" "test.do")
               ((" -mod=vendor") "")
               ((" -m") ""))
             ;; Use the correct module path. `go list` does not report the
             ;; correct module path since we have moved the source files.
             (substitute* "bin/default.do"
               (("^mod=[^\n]*" all) "mod=go.cypherpunks.ru/nncp/v7"))
             ;; Disable timeout in tests. Tests can take longer than the
             ;; default timeout on spinning disks.
             (substitute* "test.do"
               (("test") "test -timeout 0"))))
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (invoke "contrib/do" "-c" "test"))))
         (add-after 'install 'remove-go-references
           (assoc-ref go:%standard-phases 'remove-go-references)))))
    (inputs
     (list go-github-com-davecgh-go-xdr
           go-github-com-dustin-go-humanize
           go-github-com-flynn-noise
           go-github-com-gorhill-cronexpr
           go-github-com-hjson-hjson-go
           go-github-com-klauspost-compress
           go-golang-org-x-crypto
           go-golang-org-x-net
           go-golang-org-x-term
           go-lukechampine-com-blake3))
    (native-inputs
     (list go texinfo))
    (home-page "http://www.nncpgo.org/")
    (synopsis "Store and forward utilities")
    (description "NNCP (Node to Node copy) is a collection of utilities
simplifying secure store-and-forward files, mail and command exchanging.
These utilities are intended to help build up small size (dozens of nodes)
ad-hoc friend-to-friend (F2F) statically routed darknet delay-tolerant
networks for fire-and-forget secure reliable files, file requests, Internet
mail and commands transmission.  All packets are integrity checked, end-to-end
encrypted, explicitly authenticated by known participants public keys.  Onion
encryption is applied to relayed packets.  Each node acts both as a client and
server, can use push and poll behaviour model.  Multicasting areas, offline
sneakernet/floppynet, dead drops, sequential and append-only CD-ROM/tape
storages, air-gapped computers and online TCP daemon with full-duplex
resumable data transmission exists are all supported.")
    (license gpl3)))
'unknown) ((channels ...) (map (lambda (channel) (let* ((uri (string->uri (channel-url channel))) (url (if (or (not uri) (eq? 'file (uri-scheme uri))) "local checkout" (channel-url channel)))) `(channel ,(channel-name channel) ,url ,(channel-commit channel)))) channels)))) (define (installer-program) "Return a file-like object that runs the given INSTALLER." (define init-gettext ;; Initialize gettext support, so that installer messages can be ;; translated. #~(begin (bindtextdomain "guix" (string-append #$guix "/share/locale")) (textdomain "guix") (setlocale LC_ALL ""))) (define set-installer-path ;; Add the specified binary to PATH for later use by the installer. #~(let* ((inputs '#$(list bash ;start subshells connman ;call connmanctl cryptsetup dosfstools ;mkfs.fat e2fsprogs ;mkfs.ext4 lvm2-static ;dmsetup btrfs-progs jfsutils ;jfs_mkfs ntfs-3g ;mkfs.ntfs xfsprogs ;mkfs.xfs kbd ;chvt util-linux ;mkwap nano shadow tar ;dump gzip ;dump coreutils))) (with-output-to-port (%make-void-port "w") (lambda () (set-path-environment-variable "PATH" '("bin" "sbin") inputs))))) (define steps (installer-steps)) (define modules (scheme-modules* (string-append (current-source-directory) "/..") "gnu/installer")) (define installer-builder ;; Note: Include GUIX as an extension to get all the (gnu system …), (gnu ;; packages …), etc. modules. (with-extensions (list guile-gcrypt guile-newt guile-parted guile-bytestructures guile-json-3 guile-git guile-webutils guile-gnutls guile-zlib ;for (gnu build linux-modules) guile-zstd ;for (gnu build linux-modules) (current-guix)) (with-imported-modules `(,@(source-module-closure `(,@modules (gnu services herd) (guix build utils)) #:select? module-to-import?) ((guix config) => ,(make-config.scm))) #~(begin (use-modules (gnu installer record) (gnu installer keymap) (gnu installer steps) (gnu installer dump) (gnu installer final) (gnu installer hostname) (gnu installer locale) (gnu installer parted) (gnu installer services) (gnu installer timezone) (gnu installer user) (gnu installer utils) (gnu installer newt) ((gnu installer newt keymap) #:select (keyboard-layout->configuration)) (gnu services herd) (guix i18n) (guix build utils) ((system repl debug) #:select (terminal-width)) (ice-9 match) (ice-9 textual-ports)) ;; Enable core dump generation. (setrlimit 'core #f #f) (call-with-output-file "/proc/sys/kernel/core_pattern" (lambda (port) (format port %core-dump))) ;; Initialize gettext support so that installers can use ;; (guix i18n) module. #$init-gettext ;; Add some binaries used by the installers to PATH. #$set-installer-path ;; Arrange for language and territory name translations to be ;; available. We need them at run time, not just compile time, ;; because some territories have several corresponding languages ;; (e.g., "French" is always displayed as "français", but ;; "Belgium" could be translated to Dutch, French, or German.) (bindtextdomain "iso_639-3" ;languages #+(file-append iso-codes "/share/locale")) (bindtextdomain "iso_3166-1" ;territories #+(file-append iso-codes "/share/locale")) ;; Likewise for XKB keyboard layout names. (bindtextdomain "xkeyboard-config" #+(file-append xkeyboard-config "/share/locale")) ;; Initialize 'terminal-width' in (system repl debug) ;; to a large-enough value to make backtrace more ;; verbose. (terminal-width 200) (define current-installer newt-installer) (define steps (#$steps current-installer)) (installer-log-line "installer provenance: ~s" '#$(provenance-sexp)) (dynamic-wind (installer-init current-installer) (lambda () (parameterize ((run-command-in-installer (installer-run-command current-installer))) (catch #t (lambda () (define results (run-installer-steps #:rewind-strategy 'menu #:menu-proc (installer-menu-page current-installer) #:steps steps)) (match (result-step results 'final) ('success ;; We did it! Let's reboot! (sync) (stop-service 'root)) (_ ;; The installation failed, exit so that it is ;; restarted by login. #f))) (const #f) (lambda (key . args) (installer-log-line "crashing due to uncaught exception: ~s ~s" key args) (define dump-dir (prepare-dump key args #:result %current-result)) (define user-abort? (match args (((? user-abort-error? obj)) #t) (_ #f))) (define action (if user-abort? 'dump ((installer-exit-error current-installer) (get-string-all (open-input-file (string-append dump-dir "/installer-backtrace")))))) (match action ('dump (let* ((dump-files ((installer-dump-page current-installer) dump-dir)) (dump-archive (make-dump dump-dir dump-files))) ((installer-report-page current-installer) dump-archive))) (_ #f)) (exit 1))))) (installer-exit current-installer)))))) (program-file "installer" #~(begin ;; Set the default locale to install unicode support. For ;; some reason, unicode support is not correctly installed ;; when calling this in 'installer-builder'. (setenv "LANG" "en_US.UTF-8") (execl #$(program-file "installer-real" installer-builder #:guile guile-3.0-latest) "installer-real"))))