| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 |
|
| 19 | (define-module (gnu home services messaging)
|
| 20 | #:use-module (srfi srfi-26)
|
| 21 | #:use-module (gnu home services)
|
| 22 | #:use-module (gnu home services shepherd)
|
| 23 | #:use-module (gnu packages irc)
|
| 24 | #:use-module (gnu packages messaging)
|
| 25 | #:use-module (gnu services)
|
| 26 | #:use-module (gnu services configuration)
|
| 27 | #:use-module (gnu services shepherd)
|
| 28 | #:use-module (gnu services messaging)
|
| 29 | #:use-module ((gnu system shadow) #:select (account-service-type))
|
| 30 | #:use-module (guix records)
|
| 31 | #:use-module (guix gexp)
|
| 32 | #:export (home-snuik-service-type
|
| 33 | home-znc-configuration
|
| 34 | home-znc-service-type))
|
| 35 |
|
| 36 | |
| 37 | |
| 38 | |
| 39 | (define-record-type* <home-znc-configuration>
|
| 40 | home-znc-configuration make-home-znc-configuration
|
| 41 | home-znc-configuration?
|
| 42 | (znc home-znc-znc |
| 43 | (default znc))
|
| 44 | (extra-options home-znc-extra-options |
| 45 | (default '())))
|
| 46 |
|
| 47 | (define (home-znc-services config)
|
| 48 | "Return a <shepherd-service> for znc with CONFIG."
|
| 49 | (match-record config <home-znc-configuration>
|
| 50 | (znc extra-options)
|
| 51 | (let* ((znc (file-append znc "/bin/znc"))
|
| 52 | (command #~'(#$znc "--foreground" #$@extra-options))
|
| 53 | (log-file #~(string-append %user-log-dir "/znc.log")))
|
| 54 | (list (shepherd-service
|
| 55 | (documentation "Run the znc IRC bouncer.")
|
| 56 | (provision '(znc))
|
| 57 | (modules '((shepherd support))) |
| 58 | (start #~(make-forkexec-constructor #$command
|
| 59 | #:log-file #$log-file))
|
| 60 | (stop #~(make-kill-destructor)))))))
|
| 61 |
|
| 62 | (define home-znc-service-type
|
| 63 | (service-type
|
| 64 | (name 'home-znc)
|
| 65 | (default-value (home-znc-configuration))
|
| 66 | (extensions
|
| 67 | (list (service-extension home-shepherd-service-type
|
| 68 | home-znc-services)))
|
| 69 | (description
|
| 70 | "Install and configure @command{znc}, an @acronym{IRC, Internet Relay
|
| 71 | Chat} bouncer, as a Shepherd service.")))
|
| 72 |
|
| 73 |
|
| 74 | |
| 75 | |
| 76 | |
| 77 | (define home-snuik-service-type
|
| 78 | (service-type
|
| 79 | (inherit (system->home-service-type
|
| 80 | (remove-service-extensions snuik-service-type
|
| 81 | (list account-service-type
|
| 82 | activation-service-type))))
|
| 83 | (default-value (for-home (snuik-configuration)))))
|