summaryrefslogtreecommitdiff
path: root/gnu/system.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-11-26 22:49:11 +0100
committerLudovic Courtès <ludo@gnu.org>2014-11-27 08:55:46 +0100
commit598e19dca1677aebfe235e974f480b5bdd322694 (patch)
treea894c7f5a56ea04163ea687b01aa1c701d97d73c /gnu/system.scm
parent9b4d1e7321d04f5d0075810090e72dc16e1578ac (diff)
system: Build system-wide locale definitions.
* gnu/system/locale.scm: New file. * gnu-system.am (GNU_SYSTEM_MODULES): Add it. * gnu/system.scm (<operating-system>)[locale]: Change the default to "en_US.utf8". (operating-system-locale-directory): New procecure. (operating-system-derivation): Use it. * doc/guix.texi (Using the Configuration System): Change example locale to "fr_FR.utf8". (operating-system Reference): Add xref to "Locales". Document 'locale-definitions'. (Locales): New section. * po/guix/POTFILES.in: Add gnu/system.scm.
Diffstat (limited to 'gnu/system.scm')
-rw-r--r--gnu/system.scm23
1 files changed, 22 insertions, 1 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index 5c915d39698..8883d3e752c 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -46,12 +46,15 @@
46 #:use-module (gnu services base) 46 #:use-module (gnu services base)
47 #:use-module (gnu system grub) 47 #:use-module (gnu system grub)
48 #:use-module (gnu system shadow) 48 #:use-module (gnu system shadow)
49 #:use-module (gnu system locale)
49 #:use-module (gnu system linux) 50 #:use-module (gnu system linux)
50 #:use-module (gnu system linux-initrd) 51 #:use-module (gnu system linux-initrd)
51 #:use-module (gnu system file-systems) 52 #:use-module (gnu system file-systems)
52 #:use-module (ice-9 match) 53 #:use-module (ice-9 match)
53 #:use-module (srfi srfi-1) 54 #:use-module (srfi srfi-1)
54 #:use-module (srfi srfi-26) 55 #:use-module (srfi srfi-26)
56 #:use-module (srfi srfi-34)
57 #:use-module (srfi srfi-35)
55 #:export (operating-system 58 #:export (operating-system
56 operating-system? 59 operating-system?
57 60
@@ -69,6 +72,7 @@
69 operating-system-packages 72 operating-system-packages
70 operating-system-timezone 73 operating-system-timezone
71 operating-system-locale 74 operating-system-locale
75 operating-system-locale-definitions
72 operating-system-mapped-devices 76 operating-system-mapped-devices
73 operating-system-file-systems 77 operating-system-file-systems
74 operating-system-activation-script 78 operating-system-activation-script
@@ -129,7 +133,9 @@
129 133
130 (timezone operating-system-timezone) ; string 134 (timezone operating-system-timezone) ; string
131 (locale operating-system-locale ; string 135 (locale operating-system-locale ; string
132 (default "en_US.UTF-8")) 136 (default "en_US.utf8"))
137 (locale-definitions operating-system-locale-definitions ; list of <locale-definition>
138 (default %default-locale-definitions))
133 139
134 (services operating-system-user-services ; list of monadic services 140 (services operating-system-user-services ; list of monadic services
135 (default %base-services)) 141 (default %base-services))
@@ -649,6 +655,19 @@ we're running in the final root."
649 #:mapped-devices mapped-devices))) 655 #:mapped-devices mapped-devices)))
650 (return #~(string-append #$initrd "/initrd")))) 656 (return #~(string-append #$initrd "/initrd"))))
651 657
658(define (operating-system-locale-directory os)
659 "Return the directory containing the locales compiled for the definitions
660listed in OS. The C library expects to find it under
661/run/current-system/locale."
662 ;; While we're at it, check whether the locale of OS is defined.
663 (unless (member (operating-system-locale os)
664 (map locale-definition-name
665 (operating-system-locale-definitions os)))
666 (raise (condition
667 (&message (message "system locale lacks a definition")))))
668
669 (locale-directory (operating-system-locale-definitions os)))
670
652(define (kernel->grub-label kernel) 671(define (kernel->grub-label kernel)
653 "Return a label for the GRUB menu entry that boots KERNEL." 672 "Return a label for the GRUB menu entry that boots KERNEL."
654 (string-append "GNU with " 673 (string-append "GNU with "
@@ -698,6 +717,7 @@ this file is the reconstruction of GRUB menu entries for old configurations."
698 (boot (operating-system-boot-script os)) 717 (boot (operating-system-boot-script os))
699 (kernel -> (operating-system-kernel os)) 718 (kernel -> (operating-system-kernel os))
700 (initrd (operating-system-initrd-file os)) 719 (initrd (operating-system-initrd-file os))
720 (locale (operating-system-locale-directory os))
701 (params (operating-system-parameters-file os))) 721 (params (operating-system-parameters-file os)))
702 (file-union "system" 722 (file-union "system"
703 `(("boot" ,#~#$boot) 723 `(("boot" ,#~#$boot)
@@ -705,6 +725,7 @@ this file is the reconstruction of GRUB menu entries for old configurations."
705 ("parameters" ,#~#$params) 725 ("parameters" ,#~#$params)
706 ("initrd" ,initrd) 726 ("initrd" ,initrd)
707 ("profile" ,#~#$profile) 727 ("profile" ,#~#$profile)
728 ("locale" ,#~#$locale) ;used by libc
708 ("etc" ,#~#$etc))))) 729 ("etc" ,#~#$etc)))))
709 730
710;;; system.scm ends here 731;;; system.scm ends here