summary refs log tree commit diff
path: root/gnu/system.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-10-07 21:17:22 +0200
committerLudovic Courtès <ludo@gnu.org>2014-10-07 23:18:41 +0200
commit568841d4910df8ce904959b843c0c3559f282450 (patch)
treecded38e4b0f93618edea75c4ca6f47cc457267cd /gnu/system.scm
parentc28ba7aa60729c0629ae4a5b35aec63cd9f36dd8 (diff)
downloadguix-568841d4910df8ce904959b843c0c3559f282450.tar.gz
system: Export 'local-host-aliases'.
* gnu/system.scm (local-host-aliases): New procedure.
  (default-/etc/hosts): Use it.
Diffstat (limited to 'gnu/system.scm')
-rw-r--r--gnu/system.scm10
1 files changed, 7 insertions, 3 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index ed8289b375..9906695bd9 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -75,6 +75,7 @@
             operating-system-profile
             operating-system-grub.cfg
 
+            local-host-aliases
             %setuid-programs
             %base-packages
 
@@ -318,11 +319,14 @@ explicitly appear in OS."
   "
 This is the GNU system.  Welcome.\n")
 
+(define (local-host-aliases host-name)
+  "Return aliases for HOST-NAME, to be used in /etc/hosts."
+  (string-append "127.0.0.1 localhost " host-name "\n"
+                 "::1       localhost " host-name "\n"))
+
 (define (default-/etc/hosts host-name)
   "Return the default /etc/hosts file."
-  (text-file "hosts"
-             (string-append "127.0.0.1 localhost " host-name "\n"
-                            "::1       localhost " host-name "\n")))
+  (text-file "hosts" (local-host-aliases host-name)))
 
 (define* (etc-directory #:key
                         (locale "C") (timezone "Europe/Paris")