services: Move 'session-environment-service-type' to pam.scm.
* gnu/services/base.scm (environment-variables->environment-file) (session-environment-service-type) (session-environment-service): Move to... * gnu/system/pam.scm: ... here.
This commit is contained in:
parent
db4e8fd5d4
commit
fbc31dc124
|
@ -59,8 +59,6 @@
|
||||||
user-unmount-service
|
user-unmount-service
|
||||||
swap-service
|
swap-service
|
||||||
user-processes-service
|
user-processes-service
|
||||||
session-environment-service
|
|
||||||
session-environment-service-type
|
|
||||||
host-name-service
|
host-name-service
|
||||||
console-keymap-service
|
console-keymap-service
|
||||||
%default-console-font
|
%default-console-font
|
||||||
|
@ -600,47 +598,6 @@ to add @var{device} to the kernel's entropy pool. The service will fail if
|
||||||
(rng-tools rng-tools)
|
(rng-tools rng-tools)
|
||||||
(device device))))
|
(device device))))
|
||||||
|
|
||||||
|
|
||||||
;;;
|
|
||||||
;;; System-wide environment variables.
|
|
||||||
;;;
|
|
||||||
|
|
||||||
(define (environment-variables->environment-file vars)
|
|
||||||
"Return a file for pam_env(8) that contains environment variables VARS."
|
|
||||||
(apply mixed-text-file "environment"
|
|
||||||
(append-map (match-lambda
|
|
||||||
((key . value)
|
|
||||||
(list key "=" value "\n")))
|
|
||||||
vars)))
|
|
||||||
|
|
||||||
(define session-environment-service-type
|
|
||||||
(service-type
|
|
||||||
(name 'session-environment)
|
|
||||||
(extensions
|
|
||||||
(list (service-extension
|
|
||||||
etc-service-type
|
|
||||||
(lambda (vars)
|
|
||||||
(list `("environment"
|
|
||||||
,(environment-variables->environment-file vars)))))))
|
|
||||||
(compose concatenate)
|
|
||||||
(extend append)
|
|
||||||
(description
|
|
||||||
"Populate @file{/etc/environment} with the specified environment
|
|
||||||
variables. The value of this service is a list of name/value pairs for
|
|
||||||
environments variables, such as:
|
|
||||||
|
|
||||||
@example
|
|
||||||
'((\"TZ\" . \"Canada/Pacific\"))
|
|
||||||
@end example\n")))
|
|
||||||
|
|
||||||
(define (session-environment-service vars)
|
|
||||||
"Return a service that builds the @file{/etc/environment}, which can be read
|
|
||||||
by PAM-aware applications to set environment variables for sessions.
|
|
||||||
|
|
||||||
VARS should be an association list in which both the keys and the values are
|
|
||||||
strings or string-valued gexps."
|
|
||||||
(service session-environment-service-type vars))
|
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; Console & co.
|
;;; Console & co.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -50,6 +50,9 @@
|
||||||
unix-pam-service
|
unix-pam-service
|
||||||
base-pam-services
|
base-pam-services
|
||||||
|
|
||||||
|
session-environment-service
|
||||||
|
session-environment-service-type
|
||||||
|
|
||||||
pam-root-service-type
|
pam-root-service-type
|
||||||
pam-root-service))
|
pam-root-service))
|
||||||
|
|
||||||
|
@ -276,6 +279,48 @@ authenticate to run COMMAND."
|
||||||
'("useradd" "userdel" "usermod"
|
'("useradd" "userdel" "usermod"
|
||||||
"groupadd" "groupdel" "groupmod"))))
|
"groupadd" "groupdel" "groupmod"))))
|
||||||
|
|
||||||
|
|
||||||
|
;;;
|
||||||
|
;;; System-wide environment variables.
|
||||||
|
;;;
|
||||||
|
|
||||||
|
(define (environment-variables->environment-file vars)
|
||||||
|
"Return a file for pam_env(8) that contains environment variables VARS."
|
||||||
|
(apply mixed-text-file "environment"
|
||||||
|
(append-map (match-lambda
|
||||||
|
((key . value)
|
||||||
|
(list key "=" value "\n")))
|
||||||
|
vars)))
|
||||||
|
|
||||||
|
(define session-environment-service-type
|
||||||
|
(service-type
|
||||||
|
(name 'session-environment)
|
||||||
|
(extensions
|
||||||
|
(list (service-extension
|
||||||
|
etc-service-type
|
||||||
|
(lambda (vars)
|
||||||
|
(list `("environment"
|
||||||
|
,(environment-variables->environment-file vars)))))))
|
||||||
|
(compose concatenate)
|
||||||
|
(extend append)
|
||||||
|
(description
|
||||||
|
"Populate @file{/etc/environment}, which is honored by @code{pam_env},
|
||||||
|
with the specified environment variables. The value of this service is a list
|
||||||
|
of name/value pairs for environments variables, such as:
|
||||||
|
|
||||||
|
@example
|
||||||
|
'((\"TZ\" . \"Canada/Pacific\"))
|
||||||
|
@end example\n")))
|
||||||
|
|
||||||
|
(define (session-environment-service vars)
|
||||||
|
"Return a service that builds the @file{/etc/environment}, which can be read
|
||||||
|
by PAM-aware applications to set environment variables for sessions.
|
||||||
|
|
||||||
|
VARS should be an association list in which both the keys and the values are
|
||||||
|
strings or string-valued gexps."
|
||||||
|
(service session-environment-service-type vars))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; PAM root service.
|
;;; PAM root service.
|
||||||
|
|
Loading…
Reference in New Issue