summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-12-10 21:46:59 +0100
committerLudovic Courtès <ludo@gnu.org>2013-12-10 21:46:59 +0100
commit3141a8bdb35a6df12975d335ee05409fc604ab4c (patch)
treecbd613bf0557113ca1118f7dd4c7a3557601f663
parentdfb74e50b790c9d31a1ff1f71f93d5230cc03924 (diff)
downloadguix-3141a8bdb35a6df12975d335ee05409fc604ab4c.tar.gz
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'.
-rw-r--r--gnu/system.scm15
-rw-r--r--gnu/system/vm.scm5
2 files changed, 17 insertions, 3 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index 642e4b275c..0516112553 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -85,7 +85,8 @@
                            guile
                            bash
                            (@ (gnu packages dmd) dmd)
-                           guix)))
+                           guix
+                           tzdata)))
 
   (timezone operating-system-timezone)            ; string
   (locale   operating-system-locale)              ; string
@@ -214,6 +215,7 @@ directories or regular files."
                            #:inputs inputs)))
 
 (define* (etc-directory #:key
+                        (locale "C") (timezone "Europe/Paris")
                         (accounts '())
                         (groups '())
                         (pam-services '())
@@ -238,9 +240,18 @@ GNU dmd (http://www.gnu.org/software/dmd/).
 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.
        (bashrc    (text-file "bashrc" (string-append "
 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 CPATH=$HOME/.guix-profile/include:" profile "/include
 export LIBRARY_PATH=$HOME/.guix-profile/lib:" profile "/lib
@@ -297,6 +308,8 @@ alias ll='ls -l'
        (profile ->  (derivation->output-path profile-drv))
        (etc-drv     (etc-directory #:accounts accounts #:groups groups
                                    #:pam-services pam-services
+                                   #:locale (operating-system-locale os)
+                                   #:timezone (operating-system-timezone os)
                                    #:profile profile))
        (etc     ->  (derivation->output-path etc-drv))
        (dmd-conf  (dmd-configuration-file services etc))
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index a81c84672b..6c99fb1365 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -26,7 +26,7 @@
                 #:select (%final-inputs
                           guile-final gcc-final glibc-final
                           ld-wrapper binutils-final
-                          coreutils findutils grep sed))
+                          coreutils findutils grep sed tzdata))
   #:use-module (gnu packages guile)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages less)
@@ -411,7 +411,7 @@ such as /etc files."
   (operating-system
    (host-name "gnu")
    (timezone "Europe/Paris")
-   (locale "C.UTF-8")
+   (locale "en_US.UTF-8")
    (users (list (user-account
                  (name "guest")
                  (password "")
@@ -434,6 +434,7 @@ such as /etc files."
                    psmisc
                    zile
                    less
+                   tzdata
                    guix))))
 
 (define* (system-qemu-image #:optional (os %demo-operating-system))