1 From 60a4c0f7c60ef705db17561fd3e930bbe11730c9 Mon Sep 17 00:00:00 2001
2 From: ng0 <ng0@we.make.ritual.n0.is>
3 Date: Mon, 12 Sep 2016 12:26:52 +0000
4 Subject: [PATCH] gnu: services: Add gnunet-service.
6 * gnu/services/networking.scm (gnunet): New service.
8 Signed-off-by: Nils Gillmann <ng0@n0.is>
10 doc/guix.texi | 36 ++++++++++++++
11 gnu/services/networking.scm | 93 ++++++++++++++++++++++++++++++++++++-
12 2 files changed, 128 insertions(+), 1 deletion(-)
14 diff --git a/doc/guix.texi b/doc/guix.texi
15 index d925b4eda..eb7b409d7 100644
18 @@ -11016,6 +11016,42 @@ Package object of the Open vSwitch.
24 +@subsubheading GNUnet Service
26 +@deffn {Scheme Variable} gnunet-service-type
27 +This is the type of the @uref{https://gnunet.org, GNUnet}
28 +service, whose value should be an @code{gnunet-configuration} object
32 +(service gnunet-service-type
33 + (gnunet-configuration
34 + (config-file (local-file "./gnunet.conf"))))
38 +@deftp {Data Type} gnunet-configuration
39 +Data type representing the configuration of GNUnet.
42 +@item @code{package} (default: @var{gnunet})
43 +Package object of the GNUnet service.
45 +@item @code{config-file} (default: @var{%default-gnunet-file})
46 +File-like object of the GNUnet configuration file to use. For NAT is
47 +assumes by default that you are behind a NAT (@var{BEHIND_NAT = YES})
48 +and enables UPNP (@var{ENABLE_UPNP = YES}).
49 +The hostlist is configured with the options @var{-b} (bootstrap using
50 +configured hostlist servers) and @var{-e} (enable learning advertised hostlists).
51 +Read the configuration files in @var{"~/.guix-profile/share/gnunet/config.d/"}
52 +for more information. These files also set the defaults when you don't set
53 +any explicit values to override them.
59 @subsubsection X Window
61 diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
62 index b0c23aafc..0ff20e707 100644
63 --- a/gnu/services/networking.scm
64 +++ b/gnu/services/networking.scm
66 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
67 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
68 ;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
69 +;;; Copyright © 2017 ng0 <contact.ng0@cryptolab.net>
71 ;;; This file is part of GNU Guix.
74 #:use-module (gnu system pam)
75 #:use-module (gnu packages admin)
76 #:use-module (gnu packages connman)
77 + #:use-module (gnu packages gnunet)
78 #:use-module (gnu packages linux)
79 #:use-module (gnu packages tor)
80 #:use-module (gnu packages messaging)
82 wpa-supplicant-service-type
84 openvswitch-service-type
85 - openvswitch-configuration))
86 + openvswitch-configuration
88 + gnunet-configuration
89 + gnunet-configuration?
91 + gnunet-service-type))
95 @@ -1125,4 +1132,88 @@ a network connection manager."))))
96 switch designed to enable massive network automation through programmatic
103 +(define-record-type* <gnunet-configuration>
104 + gnunet-configuration make-gnunet-configuration
105 + gnunet-configuration?
106 + (package gnunet-configuration-package
108 + (config-file gnunet-configuration-config-file
109 + (default %default-gnunet-config-file)))
111 +(define %default-gnunet-config-file
112 + (plain-file "gnunet.conf" "
114 +SERVICEHOME = /var/lib/gnunet
115 +GNUNET_CONFIG_HOME = /var/lib/gnunet
129 +(define gnunet-shepherd-service
131 + (($ <gnunet-configuration> package config-file)
132 + (list (shepherd-service
133 + (provision '(gnunet))
134 + (requirement '(loopback))
135 + (documentation "Run the GNUnet service.")
138 + (file-append package "/lib/gnunet/libexec/gnunet-service-arm")))
139 + #~(make-forkexec-constructor
140 + (list #$gnunet "-c" #$config-file)
141 + #:log-file "/var/log/gnunet.log"
142 + #:pid-file "/var/run/gnunet.pid")))
144 + #~(make-kill-destructor)))))))
146 +(define %gnunet-accounts
157 + (comment "GNUnet system user")
158 + (home-directory "/var/lib/gnunet")
159 + (shell #~(string-append #$shadow "/sbin/nologin")))))
161 +(define gnunet-activation
163 + (($ <gnunet-configuration> package config-file)
165 + (file-append package "/lib/gnunet/libexec/gnunet-service-arm")))
167 + ;; Create the .config + .cache for gnunet user
168 + (mkdir-p "/var/lib/gnunet/.config/gnunet")
169 + (mkdir-p "/var/lib/gnunet/.cache/gnunet"))))))
171 +(define gnunet-service-type
174 + (extensions (list (service-extension account-service-type
175 + (const %gnunet-accounts))
176 + (service-extension activation-service-type
178 + (service-extension profile-service-type
179 + (compose list gnunet-configuration-package))
180 + (service-extension shepherd-root-service-type
181 + gnunet-shepherd-service)))))
183 ;;; networking.scm ends here