diff options
author | Ludovic Courtès <ludo@gnu.org> | 2014-09-11 22:03:24 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2014-09-12 00:14:52 +0200 |
commit | c65e1834032d7f6e1bc4ebbc8157389a922f1e99 (patch) | |
tree | f636e7302b513f7224e2a410b27017a70f97f34f | |
parent | f9d53de1054961208b153081a82037619419f25a (diff) | |
download | guix-c65e1834032d7f6e1bc4ebbc8157389a922f1e99.tar.gz |
system: Add 'hosts-file' field.
* gnu/system.scm (<operating-system>)[hosts-file]: New field. (default-/etc/hosts): New procedure. (etc-directory): Add #:hosts-file parameter and honor it. (operating-system-etc-directory): Build /etc/hosts, and pass it as #:hosts-file to 'etc-directory'.
-rw-r--r-- | gnu/system.scm | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/gnu/system.scm b/gnu/system.scm index 067f4e1634..20fe1d0a8f 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -55,6 +55,7 @@ operating-system-user-services operating-system-packages operating-system-host-name + operating-system-hosts-file operating-system-kernel operating-system-initrd operating-system-users @@ -92,6 +93,8 @@ (default base-initrd)) (host-name operating-system-host-name) ; string + (hosts-file operating-system-hosts-file ; M item | #f + (default #f)) (file-systems operating-system-file-systems) ; list of fs @@ -221,12 +224,19 @@ explicitly appear in OS." " This is the GNU system. Welcome.\n") +(define (default-/etc/hosts host-name) + "Return the default /etc/hosts file." + (text-file "hosts" + (string-append "localhost 127.0.0.1\n" + host-name " 127.0.0.1\n"))) + (define* (etc-directory #:key (locale "C") (timezone "Europe/Paris") (issue "Hello!\n") (skeletons '()) (pam-services '()) (profile "/run/current-system/profile") + hosts-file (sudoers "")) "Return a derivation that builds the static part of the /etc directory." (mlet* %store-monad @@ -269,6 +279,7 @@ alias ll='ls -l' ("skel" ,#~#$skel) ("shells" ,#~#$shells) ("profile" ,#~#$bashrc) + ("hosts" ,#~#$hosts-file) ("localtime" ,#~(string-append #$tzdata "/share/zoneinfo/" #$timezone)) ("sudoers" ,#~#$sudoers))))) @@ -311,12 +322,15 @@ alias ll='ls -l' (append (operating-system-pam-services os) (append-map service-pam-services services)))) (profile-drv (operating-system-profile os)) - (skeletons (operating-system-skeletons os))) + (skeletons (operating-system-skeletons os)) + (/etc/hosts (or (operating-system-hosts-file os) + (default-/etc/hosts (operating-system-host-name os))))) (etc-directory #:pam-services pam-services #:skeletons skeletons #:issue (operating-system-issue os) #:locale (operating-system-locale os) #:timezone (operating-system-timezone os) + #:hosts-file /etc/hosts #:sudoers (operating-system-sudoers os) #:profile profile-drv))) |