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'.
This commit is contained in:
parent
f9d53de105
commit
c65e183403
|
@ -55,6 +55,7 @@
|
||||||
operating-system-user-services
|
operating-system-user-services
|
||||||
operating-system-packages
|
operating-system-packages
|
||||||
operating-system-host-name
|
operating-system-host-name
|
||||||
|
operating-system-hosts-file
|
||||||
operating-system-kernel
|
operating-system-kernel
|
||||||
operating-system-initrd
|
operating-system-initrd
|
||||||
operating-system-users
|
operating-system-users
|
||||||
|
@ -92,6 +93,8 @@
|
||||||
(default base-initrd))
|
(default base-initrd))
|
||||||
|
|
||||||
(host-name operating-system-host-name) ; string
|
(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
|
(file-systems operating-system-file-systems) ; list of fs
|
||||||
|
|
||||||
|
@ -221,12 +224,19 @@ explicitly appear in OS."
|
||||||
"
|
"
|
||||||
This is the GNU system. Welcome.\n")
|
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
|
(define* (etc-directory #:key
|
||||||
(locale "C") (timezone "Europe/Paris")
|
(locale "C") (timezone "Europe/Paris")
|
||||||
(issue "Hello!\n")
|
(issue "Hello!\n")
|
||||||
(skeletons '())
|
(skeletons '())
|
||||||
(pam-services '())
|
(pam-services '())
|
||||||
(profile "/run/current-system/profile")
|
(profile "/run/current-system/profile")
|
||||||
|
hosts-file
|
||||||
(sudoers ""))
|
(sudoers ""))
|
||||||
"Return a derivation that builds the static part of the /etc directory."
|
"Return a derivation that builds the static part of the /etc directory."
|
||||||
(mlet* %store-monad
|
(mlet* %store-monad
|
||||||
|
@ -269,6 +279,7 @@ alias ll='ls -l'
|
||||||
("skel" ,#~#$skel)
|
("skel" ,#~#$skel)
|
||||||
("shells" ,#~#$shells)
|
("shells" ,#~#$shells)
|
||||||
("profile" ,#~#$bashrc)
|
("profile" ,#~#$bashrc)
|
||||||
|
("hosts" ,#~#$hosts-file)
|
||||||
("localtime" ,#~(string-append #$tzdata "/share/zoneinfo/"
|
("localtime" ,#~(string-append #$tzdata "/share/zoneinfo/"
|
||||||
#$timezone))
|
#$timezone))
|
||||||
("sudoers" ,#~#$sudoers)))))
|
("sudoers" ,#~#$sudoers)))))
|
||||||
|
@ -311,12 +322,15 @@ alias ll='ls -l'
|
||||||
(append (operating-system-pam-services os)
|
(append (operating-system-pam-services os)
|
||||||
(append-map service-pam-services services))))
|
(append-map service-pam-services services))))
|
||||||
(profile-drv (operating-system-profile os))
|
(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
|
(etc-directory #:pam-services pam-services
|
||||||
#:skeletons skeletons
|
#:skeletons skeletons
|
||||||
#:issue (operating-system-issue os)
|
#:issue (operating-system-issue os)
|
||||||
#:locale (operating-system-locale os)
|
#:locale (operating-system-locale os)
|
||||||
#:timezone (operating-system-timezone os)
|
#:timezone (operating-system-timezone os)
|
||||||
|
#:hosts-file /etc/hosts
|
||||||
#:sudoers (operating-system-sudoers os)
|
#:sudoers (operating-system-sudoers os)
|
||||||
#:profile profile-drv)))
|
#:profile profile-drv)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue