summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorBruno Victal <mirai@makinata.eu>2023-01-27 21:06:13 +0000
committerLudovic Courtès <ludo@gnu.org>2023-02-09 01:07:54 +0100
commitb0e18601db2daa3c026baa349e5255d4269b5185 (patch)
tree98eb5faa79f3491c122720f521c5f225936efe73 /doc
parent802ea1f3a43e5fb8d0b8bd2882954d8a6e49cde6 (diff)
downloadguix-b0e18601db2daa3c026baa349e5255d4269b5185.tar.gz
services: Add block-facebook-hosts-service-type.
Deprecates %facebook-host-aliases in favour of using
hosts-service-type service extensions.

* gnu/services/networking.scm
(block-facebook-hosts-service-type): New variable.
(%facebook-host-aliases): Deprecate variable.
* doc/guix.texi: Document it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'doc')
-rw-r--r--doc/guix.texi38
1 files changed, 5 insertions, 33 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index d1cb6eebf7..96b396b58c 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -20998,42 +20998,14 @@ Logging level.
 @end table
 @end deftp
 
-@defvar %facebook-host-aliases
-This variable contains a string for use in @file{/etc/hosts}
-(@pxref{Host Names,,, libc, The GNU C Library Reference Manual}).  Each
-line contains a entry that maps a known server name of the Facebook
+@defvar block-facebook-hosts-service-type
+This service type adds a list of known Facebook hosts to the
+@file{/etc/hosts} file.
+(@pxref{Host Names,,, libc, The GNU C Library Reference Manual})
+Each line contains a entry that maps a known server name of the Facebook
 on-line service---e.g., @code{www.facebook.com}---to the local
 host---@code{127.0.0.1} or its IPv6 equivalent, @code{::1}.
 
-This variable is typically used as a @code{hosts-service-type}
-service extension (@pxref{Service Reference, @code{hosts-service-type}}):
-
-@lisp
-(use-modules (gnu) (gnu services) (guix) (srfi srfi-1) (ice-9 match))
-(use-service-modules networking)
-
-(operating-system
-  ;; @dots{}
-
-  (service
-    (simple-service 'block-facebook-hosts hosts-service-type
-                    (let ((host-pairs
-                            (filter-map
-                              (lambda (x)
-                                (and (not (or (string-null? x)
-                                              (string-prefix? "#" x)))
-	                             (remove string-null?
-                                             (string-split
-                                               x
-                                               char-set:whitespace))))
-                              (string-split %facebook-host-aliases #\newline))))
-                      (map (match-lambda
-                             ((addr name)
-                              (host addr name)))
-                           host-pairs)))
-    ;; @dots{}
-@end lisp
-
 This mechanism can prevent programs running locally, such as Web
 browsers, from accessing Facebook.
 @end defvar