aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author宋文武 <iyzsong@gmail.com>2015-12-02 21:14:02 +0800
committer宋文武 <iyzsong@gmail.com>2015-12-05 10:51:49 +0800
commit6bad7524a6dba18f700893953584ad8865b18729 (patch)
tree8be134a7f9ad2b0a62efcfa5c6ec981aba7e03a5
parentaf9908ff56fc9263c5f343c23002ac11300e195e (diff)
downloadguix-6bad7524a6dba18f700893953584ad8865b18729.tar
guix-6bad7524a6dba18f700893953584ad8865b18729.tar.gz
system: Add /etc/environment.
* gnu/system.scm: (operating-system-environment-variables): New procedure. Adapted and moved environment variables from /etc/profile. (operating-system-etc-service): Adjust accordingly. (essential-services): Add an instance of SESSION-ENVIRONMENT-SERVICE-TYPE.
-rw-r--r--gnu/system.scm39
1 files changed, 20 insertions, 19 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index 2755d85b23..ff981d95a2 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -299,6 +299,8 @@ a container or that of a \"bare metal\" system."
(operating-system-groups os))
(operating-system-skeletons os))
(operating-system-etc-service os)
+ (session-environment-service
+ (operating-system-environment-variables os))
host-name procs root-fs unmount
(service setuid-program-service-type
(operating-system-setuid-programs os))
@@ -417,18 +419,6 @@ directory."
;; Startup file for POSIX-compliant login shells, which set system-wide
;; environment variables.
(profile (mixed-text-file "profile" "\
-export LANG=\"" (operating-system-locale os) "\"
-export TZ=\"" (operating-system-timezone os) "\"
-export TZDIR=\"" tzdata "/share/zoneinfo\"
-
-# Tell 'modprobe' & co. where to look for modules.
-export LINUX_MODULE_DIRECTORY=/run/booted-system/kernel/lib/modules
-
-# These variables are honored by OpenSSL (libssl) and Git.
-export SSL_CERT_DIR=/etc/ssl/certs
-export SSL_CERT_FILE=\"$SSL_CERT_DIR/ca-certificates.crt\"
-export GIT_SSL_CAINFO=\"$SSL_CERT_FILE\"
-
# Crucial variables that could be missing in the profiles' 'etc/profile'
# because they would require combining both profiles.
# FIXME: See <http://bugs.gnu.org/20255>.
@@ -458,13 +448,6 @@ else
export PATH=\"$HOME/.guix-profile/bin:$PATH\"
fi
-# Append the directory of 'site-start.el' to the search path.
-export EMACSLOADPATH=:/etc/emacs
-
-# By default, applications that use D-Bus, such as Emacs, abort at startup
-# when /etc/machine-id is missing. Make sure these warnings are non-fatal.
-export DBUS_FATAL_WARNINGS=0
-
# Allow Aspell to find dictionaries installed in the user profile.
export ASPELL_CONF=\"dict-dir $HOME/.guix-profile/lib/aspell\"
@@ -561,6 +544,24 @@ use 'plain-file' instead~%")
(fold-services (operating-system-services os)
#:target-type etc-service-type)))
+(define (operating-system-environment-variables os)
+ "Return the environment variables of OS for
+@var{session-environment-service-type}, to be used in @file{/etc/environment}."
+ `(("LANG" . ,(operating-system-locale os))
+ ("TZ" . ,(operating-system-timezone os))
+ ("TZDIR" . ,#~(string-append #$tzdata "/share/zoneinfo"))
+ ;; Tell 'modprobe' & co. where to look for modules.
+ ("LINUX_MODULE_DIRECTORY" . "/run/booted-system/kernel/lib/modules")
+ ;; These variables are honored by OpenSSL (libssl) and Git.
+ ("SSL_CERT_DIR" . "/etc/ssl/certs")
+ ("SSL_CERT_FILE" . "/etc/ssl/certs/ca-certificates.crt")
+ ("GIT_SSL_CAINFO" . "/etc/ssl/certs/ca-certificates.crt")
+ ;; Append the directory of 'site-start.el' to the search path.
+ ("EMACSLOADPATH" . ":/etc/emacs")
+ ;; By default, applications that use D-Bus, such as Emacs, abort at startup
+ ;; when /etc/machine-id is missing. Make sure these warnings are non-fatal.
+ ("DBUS_FATAL_WARNINGS" . "0")))
+
(define %setuid-programs
;; Default set of setuid-root programs.
(let ((shadow (@ (gnu packages admin) shadow)))