aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/services/shepherd/ng0_wip/.gitignore1
-rw-r--r--contrib/services/shepherd/ng0_wip/00001-gnu-services-Add-gnunet-service.patch186
-rw-r--r--contrib/services/shepherd/ng0_wip/0001-gnu-services-Add-gnunet-service.patch225
-rw-r--r--contrib/services/shepherd/ng0_wip/001-gnu-services-Add-gnunet-service.patch204
4 files changed, 616 insertions, 0 deletions
diff --git a/contrib/services/shepherd/ng0_wip/.gitignore b/contrib/services/shepherd/ng0_wip/.gitignore
new file mode 100644
index 000000000..9b974979a
--- /dev/null
+++ b/contrib/services/shepherd/ng0_wip/.gitignore
@@ -0,0 +1 @@
!*.patch \ No newline at end of file
diff --git a/contrib/services/shepherd/ng0_wip/00001-gnu-services-Add-gnunet-service.patch b/contrib/services/shepherd/ng0_wip/00001-gnu-services-Add-gnunet-service.patch
new file mode 100644
index 000000000..609a0a5ef
--- /dev/null
+++ b/contrib/services/shepherd/ng0_wip/00001-gnu-services-Add-gnunet-service.patch
@@ -0,0 +1,186 @@
1From 60a4c0f7c60ef705db17561fd3e930bbe11730c9 Mon Sep 17 00:00:00 2001
2From: ng0 <ng0@we.make.ritual.n0.is>
3Date: Mon, 12 Sep 2016 12:26:52 +0000
4Subject: [PATCH] gnu: services: Add gnunet-service.
5
6* gnu/services/networking.scm (gnunet): New service.
7
8Signed-off-by: Nils Gillmann <ng0@n0.is>
9---
10 doc/guix.texi | 36 ++++++++++++++
11 gnu/services/networking.scm | 93 ++++++++++++++++++++++++++++++++++++-
12 2 files changed, 128 insertions(+), 1 deletion(-)
13
14diff --git a/doc/guix.texi b/doc/guix.texi
15index d925b4eda..eb7b409d7 100644
16--- a/doc/guix.texi
17+++ b/doc/guix.texi
18@@ -11016,6 +11016,42 @@ Package object of the Open vSwitch.
19 @end table
20 @end deftp
21
22+@cindex GNUnet
23+@cindex gnunet
24+@subsubheading GNUnet Service
25+
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
29+as in this example:
30+
31+@example
32+(service gnunet-service-type
33+ (gnunet-configuration
34+ (config-file (local-file "./gnunet.conf"))))
35+@end example
36+@end deffn
37+
38+@deftp {Data Type} gnunet-configuration
39+Data type representing the configuration of GNUnet.
40+
41+@table @asis
42+@item @code{package} (default: @var{gnunet})
43+Package object of the GNUnet service.
44+
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.
54+
55+@end table
56+@end deftp
57+
58 @node X Window
59 @subsubsection X Window
60
61diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
62index b0c23aafc..0ff20e707 100644
63--- a/gnu/services/networking.scm
64+++ b/gnu/services/networking.scm
65@@ -5,6 +5,7 @@
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>
70 ;;;
71 ;;; This file is part of GNU Guix.
72 ;;;
73@@ -29,6 +30,7 @@
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)
81@@ -92,7 +94,12 @@
82 wpa-supplicant-service-type
83
84 openvswitch-service-type
85- openvswitch-configuration))
86+ openvswitch-configuration
87+
88+ gnunet-configuration
89+ gnunet-configuration?
90+ gnunet-service
91+ gnunet-service-type))
92
93 ;;; Commentary:
94 ;;;
95@@ -1125,4 +1132,88 @@ a network connection manager."))))
96 switch designed to enable massive network automation through programmatic
97 extension.")))
98
99+;;;
100+;;; GNUnet
101+;;;
102+
103+(define-record-type* <gnunet-configuration>
104+ gnunet-configuration make-gnunet-configuration
105+ gnunet-configuration?
106+ (package gnunet-configuration-package
107+ (default gnunet))
108+ (config-file gnunet-configuration-config-file
109+ (default %default-gnunet-config-file)))
110+
111+(define %default-gnunet-config-file
112+ (plain-file "gnunet.conf" "
113+[PATHS]
114+SERVICEHOME = /var/lib/gnunet
115+GNUNET_CONFIG_HOME = /var/lib/gnunet
116+
117+[arm]
118+SYSTEM_ONLY = YES
119+USER_ONLY = NO
120+
121+[nat]
122+BEHIND_NAT = YES
123+ENABLE_UPNP = YES
124+
125+[hostlist]
126+OPTIONS = -b -e
127+"))
128+
129+(define gnunet-shepherd-service
130+ (match-lambda
131+ (($ <gnunet-configuration> package config-file)
132+ (list (shepherd-service
133+ (provision '(gnunet))
134+ (requirement '(loopback))
135+ (documentation "Run the GNUnet service.")
136+ (start
137+ (let ((gnunet
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")))
143+ (stop
144+ #~(make-kill-destructor)))))))
145+
146+(define %gnunet-accounts
147+ (list (user-group
148+ (name "gnunetdns")
149+ (system? #t))
150+ (user-group
151+ (name "gnunet")
152+ (system? #t))
153+ (user-account
154+ (name "gnunet")
155+ (group "gnunet")
156+ (system? #t)
157+ (comment "GNUnet system user")
158+ (home-directory "/var/lib/gnunet")
159+ (shell #~(string-append #$shadow "/sbin/nologin")))))
160+
161+(define gnunet-activation
162+ (match-lambda
163+ (($ <gnunet-configuration> package config-file)
164+ (let ((gnunet
165+ (file-append package "/lib/gnunet/libexec/gnunet-service-arm")))
166+ #~(begin
167+ ;; Create the .config + .cache for gnunet user
168+ (mkdir-p "/var/lib/gnunet/.config/gnunet")
169+ (mkdir-p "/var/lib/gnunet/.cache/gnunet"))))))
170+
171+(define gnunet-service-type
172+ (service-type
173+ (name 'gnunet)
174+ (extensions (list (service-extension account-service-type
175+ (const %gnunet-accounts))
176+ (service-extension activation-service-type
177+ gnunet-activation)
178+ (service-extension profile-service-type
179+ (compose list gnunet-configuration-package))
180+ (service-extension shepherd-root-service-type
181+ gnunet-shepherd-service)))))
182+
183 ;;; networking.scm ends here
184--
1852.17.0
186
diff --git a/contrib/services/shepherd/ng0_wip/0001-gnu-services-Add-gnunet-service.patch b/contrib/services/shepherd/ng0_wip/0001-gnu-services-Add-gnunet-service.patch
new file mode 100644
index 000000000..a494434e0
--- /dev/null
+++ b/contrib/services/shepherd/ng0_wip/0001-gnu-services-Add-gnunet-service.patch
@@ -0,0 +1,225 @@
1From 434b05bc1a11b4865c0bd634281acd91dfce972c Mon Sep 17 00:00:00 2001
2From: ng0 <ng0@we.make.ritual.n0.is>
3Date: Mon, 12 Sep 2016 12:26:52 +0000
4Subject: [PATCH] gnu: services: Add gnunet-service.
5
6Signed-off-by: Nils Gillmann <ng0@n0.is>
7---
8 doc/guix.texi | 36 ++++++++++
9 gnu/services/networking.scm | 134 +++++++++++++++++++++++++++++++++++-
10 2 files changed, 169 insertions(+), 1 deletion(-)
11
12diff --git a/doc/guix.texi b/doc/guix.texi
13index 00bf24d3f..73589c88b 100644
14--- a/doc/guix.texi
15+++ b/doc/guix.texi
16@@ -10138,6 +10138,42 @@ Package object of the Open vSwitch.
17 @end table
18 @end deftp
19
20+@cindex GNUnet
21+@cindex gnunet
22+@subsubheading GNUnet Service
23+
24+@deffn {Scheme Variable} gnunet-service-type
25+This is the type of the @uref{https://gnunet.org, GNUnet}
26+service, whose value should be an @code{gnunet-configuration} object
27+as in this example:
28+
29+@example
30+(service gnunet-service-type
31+ (gnunet-configuration
32+ (config-file (local-file "./gnunet.conf"))))
33+@end example
34+@end deffn
35+
36+@deftp {Data Type} gnunet-configuration
37+Data type representing the configuration of GNUnet.
38+
39+@table @asis
40+@item @code{package} (default: @var{gnunet})
41+Package object of the GNUnet service.
42+
43+@item @code{config-file} (default: @var{%default-gnunet-file})
44+File-like object of the GNUnet configuration file to use. For NAT is
45+assumes by default that you are behind a NAT (@var{BEHIND_NAT = YES})
46+and enables UPNP (@var{ENABLE_UPNP = YES}).
47+The hostlist is configured with the options @var{-b} (bootstrap using
48+configured hostlist servers) and @var{-e} (enable learning advertised hostlists).
49+Read the configuration files in @var{"~/.guix-profile/share/gnunet/config.d/"}
50+for more information. These files also set the defaults when you don't set
51+any explicit values to override them.
52+
53+@end table
54+@end deftp
55+
56 @node X Window
57 @subsubsection X Window
58
59diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
60index 99a3d493c..fe682b267 100644
61--- a/gnu/services/networking.scm
62+++ b/gnu/services/networking.scm
63@@ -5,6 +5,7 @@
64 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
65 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
66 ;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
67+;;; Copyright © 2017 ng0 <ng0@no-reply.pragmatique.xyt>
68 ;;;
69 ;;; This file is part of GNU Guix.
70 ;;;
71@@ -29,6 +30,7 @@
72 #:use-module (gnu system pam)
73 #:use-module (gnu packages admin)
74 #:use-module (gnu packages connman)
75+ #:use-module (gnu packages gnunet)
76 #:use-module (gnu packages linux)
77 #:use-module (gnu packages tor)
78 #:use-module (gnu packages messaging)
79@@ -92,7 +94,12 @@
80 wpa-supplicant-service-type
81
82 openvswitch-service-type
83- openvswitch-configuration))
84+ openvswitch-configuration
85+
86+ gnunet-configuration
87+ gnunet-configuration?
88+ gnunet-service-type
89+ %default-gnunet-config-file))
90
91 ;;; Commentary:
92 ;;;
93@@ -1069,4 +1076,129 @@ dns=" dns "
94 (service-extension shepherd-root-service-type
95 openvswitch-shepherd-service)))))
96
97+;;;
98+;;; GNUnet
99+;;;
100+
101+;; steps:
102+;; 0. The service works!!!
103+;; 1. We want a completely adjustable config.
104+;; 2. We want to extend this service with functions like
105+;; vpn, comparable to tor-service
106+;; Because of (1) we can't have a default. We can have
107+;; default values which can be adjusted. A config is
108+;; generated from these.
109+
110+(define-record-type* <gnunet-configuration>
111+ gnunet-configuration make-gnunet-configuration
112+ gnunet-configuration?
113+ (gnunet gnunet-configuration-package
114+ (default gnunet))
115+ (config-file gnunet-configuration-config-file
116+ (default (plain-file "empty" ""))))
117+
118+(define %default-gnunet-config-file
119+ (plain-file "gnunet.conf" "
120+[PATHS]
121+SERVICEHOME = /var/lib/gnunet
122+GNUNET_CONFIG_HOME = /var/lib/gnunet
123+
124+[arm]
125+SYSTEM_ONLY = NO
126+USER_ONLY = NO
127+
128+[nat]
129+BEHIND_NAT = YES
130+ENABLE_UPNP = YES
131+
132+[hostlist]
133+OPTIONS = -b -e
134+"))
135+
136+(define gnunet-shepherd-service
137+ (match-lambda
138+ (($ <gnunet-configuration> package config-file)
139+ (list (shepherd-service
140+ (provision '(gnunet))
141+ (requirement '(user-processes loopback networking))
142+ (documentation "Run the GNUnet service.")
143+ (start
144+ (let ((gnunet
145+ (file-append package "/lib/gnunet/libexec/gnunet-service-arm")))
146+ #~(make-forkexec-constructor
147+ (list #$gnunet "-c" #$config-file "-d")
148+ #:pid-file "/var/run/gnunet/arm-service.pid"
149+ #:user "gnunet"
150+ #:group "gnunet"
151+ ;;#:log-file "/var/lib/gnunet/gnunet.log")))
152+ #:log-file "/var/log/gnunet.log")))
153+ (stop #~(make-kill-destructor)))))))
154+
155+(define %gnunet-accounts
156+ (list (user-group (name "gnunetdns") (system? #t))
157+ (user-group (name "gnunet") (system? #t))
158+ (user-account
159+ (name "gnunet")
160+ (group "gnunet")
161+ (system? #t)
162+ (comment "GNUnet system user")
163+ (home-directory "/var/empty")
164+ (shell (file-append shadow "/sbin/nologin")))))
165+
166+;; ${GNUNET_HOME}/.local/share/gnunet/gnunet.conf -> chmod 600
167+;; mkdir -p ${GNUNET_HOME}/.cache/gnunet
168+
169+(define gnunet-activation
170+ (match-lambda
171+ (($ <gnunet-configuration> package config-file)
172+ (let ((gnunet
173+ (file-append package "/lib/gnunet/libexec/gnunet-service-arm")))
174+ #~(begin
175+ (use-modules (guix build utils))
176+ (define %user (getpw "gnunet"))
177+ (mkdir-p "/var/lib/gnunet/")
178+ (chown "/var/lib/gnunet" (passwd:uid %user) (passwd:gid %user))
179+ ;;(chmod "/var/lib/gnunet/" #o755)
180+ (mkdir-p "/var/lib/gnunet/.local/share/gnunet")
181+ (mkdir-p "/var/lib/gnunet/.cache/gnunet")
182+ (mkdir-p "/var/lib/gnunet/hostlist")
183+ (mkdir-p "/var/lib/gnunet/.config/gnunet")
184+ (chown "/var/lib/gnunet/.local/share/gnunet" (passwd:uid %user) (passwd:gid %user))
185+ (chown "/var/lib/gnunet/.cache/gnunet" (passwd:uid %user) (passwd:gid %user))
186+ (chown "/var/lib/gnunet/hostlist" (passwd:uid %user) (passwd:gid %user))
187+ ;;(chown "/var/lib/gnunet/gnunet.conf" (passwd:uid %user) (passwd:gid %user))
188+ (chown "/var/lib/gnunet/.config/gnunet" (passwd:uid %user) (passwd:gid %user)))))))
189+ ;;(chmod "/var/lib/gnunet/.config/gnunet" #o755)
190+ ;;(chmod "/var/lib/gnunet/.cache/gnunet" #o755)
191+ ;;(chmod "/var/lib/gnunet/.local/share/gnunet" #o755))))))
192+
193+;; SUID_ROOT_HELPERS="exit nat-server nat-client transport-bluetooth transport-wlan vpn"
194+;; set chmod u+s for those above.
195+;; chmodown_execbin ${libexec}/gnunet-helper-dns 4750 root:gnunetdns
196+;; chmodown_execbin ${libexec}/gnunet-service-dns 2750 gnunet:gnunetdns
197+(define gnunet-setuid-programs
198+ (match-lambda
199+ (($ <gnunet-configuration> package)
200+ (list (file-append package "/lib/gnunet/libexec/gnunet-helper-exit")
201+ (file-append package "/lib/gnunet/libexec/gnunet-helper-nat-server")
202+ (file-append package "/lib/gnunet/libexec/gnunet-helper-nat-client")
203+ (file-append package "/lib/gnunet/libexec/gnunet-helper-transport-bluetooth")
204+ (file-append package "/lib/gnunet/libexec/gnunet-helper-transport-wlan")
205+ (file-append package "/lib/gnunet/libexec/gnunet-helper-vpn")))))
206+
207+(define gnunet-service-type
208+ (service-type
209+ (name 'gnunet)
210+ (extensions (list (service-extension account-service-type
211+ (const %gnunet-accounts))
212+ (service-extension activation-service-type
213+ gnunet-activation)
214+ (service-extension profile-service-type
215+ (compose list gnunet-configuration-package))
216+ (service-extension setuid-program-service-type
217+ gnunet-setuid-programs)
218+ (service-extension shepherd-root-service-type
219+ gnunet-shepherd-service)))))
220+;;; --- here starts the rewrite.
221+
222 ;;; networking.scm ends here
223--
2242.17.0
225
diff --git a/contrib/services/shepherd/ng0_wip/001-gnu-services-Add-gnunet-service.patch b/contrib/services/shepherd/ng0_wip/001-gnu-services-Add-gnunet-service.patch
new file mode 100644
index 000000000..0017ec8cf
--- /dev/null
+++ b/contrib/services/shepherd/ng0_wip/001-gnu-services-Add-gnunet-service.patch
@@ -0,0 +1,204 @@
1From 91241bacb6533745535ff28d20f087ecd571e7be Mon Sep 17 00:00:00 2001
2From: ng0 <ng0@we.make.ritual.n0.is>
3Date: Mon, 12 Sep 2016 12:26:52 +0000
4Subject: [PATCH] gnu: services: Add gnunet-service.
5
6---
7 doc/guix.texi | 36 ++++++++++++++
8 gnu/services/networking.scm | 114 +++++++++++++++++++++++++++++++++++++++++++-
9 2 files changed, 149 insertions(+), 1 deletion(-)
10
11diff --git a/doc/guix.texi b/doc/guix.texi
12index 99bde4aca..6c683393e 100644
13--- a/doc/guix.texi
14+++ b/doc/guix.texi
15@@ -8903,6 +8903,42 @@ Boolean values @var{ipv4?} and @var{ipv6?} determine whether to use IPv4/IPv6
16 sockets.
17 @end deffn
18
19+@cindex GNUnet
20+@cindex gnunet
21+@subsubheading GNUnet Service
22+
23+@deffn {Scheme Variable} gnunet-service-type
24+This is the type of the @uref{https://gnunet.org, GNUnet}
25+service, whose value should be an @code{gnunet-configuration} object
26+as in this example:
27+
28+@example
29+(service gnunet-service-type
30+ (gnunet-configuration
31+ (config-file (local-file "./gnunet.conf"))))
32+@end example
33+@end deffn
34+
35+@deftp {Data Type} gnunet-configuration
36+Data type representing the configuration of GNUnet.
37+
38+@table @asis
39+@item @code{package} (default: @var{gnunet})
40+Package object of the GNUnet service.
41+
42+@item @code{config-file} (default: @var{%default-gnunet-file})
43+File-like object of the GNUnet configuration file to use. For NAT is
44+assumes by default that you are behind a NAT (@var{BEHIND_NAT = YES})
45+and enables UPNP (@var{ENABLE_UPNP = YES}).
46+The hostlist is configured with the options @var{-b} (bootstrap using
47+configured hostlist servers) and @var{-e} (enable learning advertised hostlists).
48+Read the configuration files in @var{"~/.guix-profile/share/gnunet/config.d/"}
49+for more information. These files also set the defaults when you don't set
50+any explicit values to override them.
51+
52+@end table
53+@end deftp
54+
55
56 @node X Window
57 @subsubsection X Window
58diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
59index d672ecf68..ff3615ea2 100644
60--- a/gnu/services/networking.scm
61+++ b/gnu/services/networking.scm
62@@ -3,6 +3,7 @@
63 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
64 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
65 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
66+;;; Copyright © 2016 ng0 <ng0@libertad.pw>
67 ;;;
68 ;;; This file is part of GNU Guix.
69 ;;;
70@@ -27,6 +28,7 @@
71 #:use-module (gnu system pam)
72 #:use-module (gnu packages admin)
73 #:use-module (gnu packages connman)
74+ #:use-module (gnu packages gnunet)
75 #:use-module (gnu packages linux)
76 #:use-module (gnu packages tor)
77 #:use-module (gnu packages messaging)
78@@ -66,7 +68,12 @@
79 wicd-service
80 network-manager-service
81 connman-service
82- wpa-supplicant-service-type))
83+ wpa-supplicant-service-type
84+
85+ gnunet-configuration
86+ gnunet-configuration?
87+ gnunet-service-type
88+ %default-gnunet-config-file))
89
90 ;;; Commentary:
91 ;;;
92@@ -781,4 +788,109 @@ configure networking."
93 (service-extension dbus-root-service-type list)
94 (service-extension profile-service-type list)))))
95
96+
97+;;; GNUnet
98+;;;
99+;;;
100+
101+(define-record-type* <gnunet-configuration>
102+ gnunet-configuration make-gnunet-configuration
103+ gnunet-configuration?
104+ (package gnunet-configuration-package
105+ (default gnunet))
106+ (config-file gnunet-configuration-config-file
107+ (default %default-gnunet-config-file)))
108+
109+(define %default-gnunet-config-file
110+ (plain-file "gnunet.conf" "
111+[PATHS]
112+SERVICEHOME = /var/lib/gnunet
113+GNUNET_CONFIG_HOME = /var/lib/gnunet
114+
115+[arm]
116+SYSTEM_ONLY = YES
117+USER_ONLY = NO
118+
119+[nat]
120+BEHIND_NAT = YES
121+ENABLE_UPNP = YES
122+
123+[hostlist]
124+OPTIONS = -b -e
125+"))
126+
127+(define gnunet-shepherd-service
128+ (match-lambda
129+ (($ <gnunet-configuration> package config-file)
130+ (list (shepherd-service
131+ (provision '(gnunet))
132+ (requirement '(user-processes loopback))
133+ (documentation "Run the GNUnet service.")
134+ (start
135+ (let ((gnunet
136+ (file-append package "/lib/gnunet/libexec/gnunet-service-arm")))
137+ #~(make-forkexec-constructor
138+ (list #$gnunet "-c" #$config-file)
139+ #:pid-file "/var/run/gnunet.pid")))
140+ (stop
141+ #~(make-kill-destructor
142+ (list #$gnunet "-e"))))))))
143+
144+(define %gnunet-accounts
145+ (list (user-group
146+ (name "gnunetdns")
147+ (system? #t))
148+ (user-group
149+ (name "gnunet")
150+ (system? #t))
151+ (user-account
152+ (name "gnunet")
153+ (group "gnunet")
154+ (system? #t)
155+ (comment "GNUnet system user")
156+ (home-directory "/var/empty")
157+ (shell #~(string-append #$shadow "/sbin/nologin")))))
158+
159+(define gnunet-activation
160+ (match-lambda
161+ (($ <gnunet-configuration> package config-file)
162+ (let ((gnunet
163+ (file-append package "/lib/gnunet/libexec/gnunet-service-arm")))
164+ #~(begin
165+ (use-modules (guix build utils))
166+ (define %user (getpw "gnunet"))
167+ (mkdir-p "/var/lib/gnunet/")
168+ (chown "/var/lib/gnunet" (passwd:uid %user) (passwd:gid %user))
169+ (chmod "/var/lib/gnunet/" #o600)
170+ (mkdir-p "/var/lib/gnunet/.local/share/gnunet")
171+ (mkdir-p "/var/lib/gnunet/.cache/gnunet")
172+ (mkdir-p "/var/lib/gnunet/.config/gnunet")
173+ (chmod "/var/lib/gnunet/.config/gnunet" #o600)
174+ (chmod "/var/lib/gnunet/.cache/gnunet" #o600)
175+ (chmod "/var/lib/gnunet/.local/share/gnunet" #o600))))))
176+
177+(define gnunet-setuid-programs
178+ (match-lambda
179+ (($ <gnunet-configuration> package)
180+ (list (file-append package "/lib/gnunet/libexec/gnunet-helper-exit")
181+ (file-append package "/lib/gnunet/libexec/gnunet-helper-nat-server")
182+ (file-append package "/lib/gnunet/libexec/gnunet-helper-nat-client")
183+ (file-append package "/lib/gnunet/libexec/gnunet-helper-transport-bluetooth")
184+ (file-append package "/lib/gnunet/libexec/gnunet-helper-transport-wlan")
185+ (file-append package "/lib/gnunet/libexec/gnunet-helper-vpn")))))
186+
187+(define gnunet-service-type
188+ (service-type
189+ (name 'gnunet)
190+ (extensions (list (service-extension account-service-type
191+ (const %gnunet-accounts))
192+ (service-extension activation-service-type
193+ gnunet-activation)
194+ (service-extension profile-service-type
195+ (compose list gnunet-configuration-package))
196+ (service-extension setuid-program-service-type
197+ gnunet-setuid-programs)
198+ (service-extension shepherd-root-service-type
199+ gnunet-shepherd-service)))))
200+
201 ;;; networking.scm ends here
202--
2032.11.0
204