mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
gnu: Honor the operating system's locale and timezone.
* gnu/system.scm (etc-directory): Add 'locale' and 'timezone' parameters. Set 'LC_ALL', 'TZ', and 'TZDIR' in /etc/profile. (operating-system-derivation): Adjust call accordingly. * gnu/system/vm.scm (%demo-operating-system): Change locale to 'en_US.UTF-8'. Add TZDATA to 'packages'.
This commit is contained in:
parent
dfb74e50b7
commit
3141a8bdb3
2 changed files with 17 additions and 3 deletions
|
@ -85,7 +85,8 @@ (define-record-type* <operating-system> operating-system
|
||||||
guile
|
guile
|
||||||
bash
|
bash
|
||||||
(@ (gnu packages dmd) dmd)
|
(@ (gnu packages dmd) dmd)
|
||||||
guix)))
|
guix
|
||||||
|
tzdata)))
|
||||||
|
|
||||||
(timezone operating-system-timezone) ; string
|
(timezone operating-system-timezone) ; string
|
||||||
(locale operating-system-locale) ; string
|
(locale operating-system-locale) ; string
|
||||||
|
@ -214,6 +215,7 @@ (define builder
|
||||||
#:inputs inputs)))
|
#:inputs inputs)))
|
||||||
|
|
||||||
(define* (etc-directory #:key
|
(define* (etc-directory #:key
|
||||||
|
(locale "C") (timezone "Europe/Paris")
|
||||||
(accounts '())
|
(accounts '())
|
||||||
(groups '())
|
(groups '())
|
||||||
(pam-services '())
|
(pam-services '())
|
||||||
|
@ -238,9 +240,18 @@ (define* (etc-directory #:key
|
||||||
You can log in as 'guest' or 'root' with no password.
|
You can log in as 'guest' or 'root' with no password.
|
||||||
"))
|
"))
|
||||||
|
|
||||||
|
;; Assume TZDATA is installed---e.g., as part of the system packages.
|
||||||
|
;; Users can choose not to have it.
|
||||||
|
(tzdir (package-file tzdata "share/zoneinfo"))
|
||||||
|
|
||||||
;; TODO: Generate bashrc from packages' search-paths.
|
;; TODO: Generate bashrc from packages' search-paths.
|
||||||
(bashrc (text-file "bashrc" (string-append "
|
(bashrc (text-file "bashrc" (string-append "
|
||||||
export PS1='\\u@\\h\\$ '
|
export PS1='\\u@\\h\\$ '
|
||||||
|
|
||||||
|
export LC_ALL=\"" locale "\"
|
||||||
|
export TZ=\"" timezone "\"
|
||||||
|
export TZDIR=\"" tzdir "\"
|
||||||
|
|
||||||
export PATH=$HOME/.guix-profile/bin:" profile "/bin:" profile "/sbin
|
export PATH=$HOME/.guix-profile/bin:" profile "/bin:" profile "/sbin
|
||||||
export CPATH=$HOME/.guix-profile/include:" profile "/include
|
export CPATH=$HOME/.guix-profile/include:" profile "/include
|
||||||
export LIBRARY_PATH=$HOME/.guix-profile/lib:" profile "/lib
|
export LIBRARY_PATH=$HOME/.guix-profile/lib:" profile "/lib
|
||||||
|
@ -297,6 +308,8 @@ (define (operating-system-derivation os)
|
||||||
(profile -> (derivation->output-path profile-drv))
|
(profile -> (derivation->output-path profile-drv))
|
||||||
(etc-drv (etc-directory #:accounts accounts #:groups groups
|
(etc-drv (etc-directory #:accounts accounts #:groups groups
|
||||||
#:pam-services pam-services
|
#:pam-services pam-services
|
||||||
|
#:locale (operating-system-locale os)
|
||||||
|
#:timezone (operating-system-timezone os)
|
||||||
#:profile profile))
|
#:profile profile))
|
||||||
(etc -> (derivation->output-path etc-drv))
|
(etc -> (derivation->output-path etc-drv))
|
||||||
(dmd-conf (dmd-configuration-file services etc))
|
(dmd-conf (dmd-configuration-file services etc))
|
||||||
|
|
|
@ -26,7 +26,7 @@ (define-module (gnu system vm)
|
||||||
#:select (%final-inputs
|
#:select (%final-inputs
|
||||||
guile-final gcc-final glibc-final
|
guile-final gcc-final glibc-final
|
||||||
ld-wrapper binutils-final
|
ld-wrapper binutils-final
|
||||||
coreutils findutils grep sed))
|
coreutils findutils grep sed tzdata))
|
||||||
#:use-module (gnu packages guile)
|
#:use-module (gnu packages guile)
|
||||||
#:use-module (gnu packages bash)
|
#:use-module (gnu packages bash)
|
||||||
#:use-module (gnu packages less)
|
#:use-module (gnu packages less)
|
||||||
|
@ -411,7 +411,7 @@ (define %demo-operating-system
|
||||||
(operating-system
|
(operating-system
|
||||||
(host-name "gnu")
|
(host-name "gnu")
|
||||||
(timezone "Europe/Paris")
|
(timezone "Europe/Paris")
|
||||||
(locale "C.UTF-8")
|
(locale "en_US.UTF-8")
|
||||||
(users (list (user-account
|
(users (list (user-account
|
||||||
(name "guest")
|
(name "guest")
|
||||||
(password "")
|
(password "")
|
||||||
|
@ -434,6 +434,7 @@ (define %demo-operating-system
|
||||||
psmisc
|
psmisc
|
||||||
zile
|
zile
|
||||||
less
|
less
|
||||||
|
tzdata
|
||||||
guix))))
|
guix))))
|
||||||
|
|
||||||
(define* (system-qemu-image #:optional (os %demo-operating-system))
|
(define* (system-qemu-image #:optional (os %demo-operating-system))
|
||||||
|
|
Loading…
Reference in a new issue