mirror of
https://gitlab.univ-nantes.fr/glicid-public/guix-glicid.git
synced 2025-04-30 06:08:37 +02:00
adding sssd service
This commit is contained in:
commit
7f544d9fce
1 changed files with 91 additions and 0 deletions
91
glicid/services/authentication.scm
Normal file
91
glicid/services/authentication.scm
Normal file
|
@ -0,0 +1,91 @@
|
|||
(define-module (glicid services authentication)
|
||||
#:use-module (gnu services)
|
||||
#:use-module (gnu services shepherd)
|
||||
#:use-module (guix)
|
||||
#:use-module (guix records)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (gnu packages sssd)
|
||||
#:use-module (glicid system file-systems)
|
||||
#:export (
|
||||
sssd-configuration
|
||||
sssd-configuration?
|
||||
sssd-service
|
||||
sssd-service-type
|
||||
)
|
||||
)
|
||||
|
||||
(define-record-type* <sssd-configuration>
|
||||
sssd-configuration make-sssd-configuration sssd-configuration?
|
||||
(sssd-pkg sssd-pkg
|
||||
(default sssd)
|
||||
)
|
||||
(sssd-conf sssd-conf
|
||||
(default (file-append sssd-pkg "/lib/sssd/conf/sssd.conf"))
|
||||
)
|
||||
(sssd-logger sssd-logger
|
||||
(default "stderr")
|
||||
)
|
||||
(sssd-debug-level sssd-debug-level
|
||||
(default "")
|
||||
)
|
||||
(log-file log-file
|
||||
(default "/var/log/sssd/sssd.log")
|
||||
)
|
||||
)
|
||||
|
||||
(define sssd-service
|
||||
(match-lambda
|
||||
(($ <sssd-configuration> sssd-pkg sssd-conf sssd-logger sssd-debug-level log-file)
|
||||
(list
|
||||
(shepherd-service
|
||||
(provision '(sssd) )
|
||||
(documentation "Run sssd.")
|
||||
(requirement '(
|
||||
user-processes
|
||||
))
|
||||
(respawn? #t)
|
||||
(start #~(make-forkexec-constructor
|
||||
(list
|
||||
#$(file-append sssd-pkg "/sbin/sssd")
|
||||
"--interactive"
|
||||
(list (string-append "--config=" sssd-conf))
|
||||
(list(string-append "--logger=" sssd-logger))
|
||||
#$@(if sssd-debug-level
|
||||
(list (string-append "--debug-level=" sssd-debug-level))
|
||||
'()
|
||||
)
|
||||
)
|
||||
#:log-file #$log-file
|
||||
))
|
||||
(stop #~(make-kill-destructor))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(define %sssd-activation
|
||||
(with-imported-modules '((guix build utils))
|
||||
#~(begin
|
||||
(use-modules (guix build utils))
|
||||
(define (touch file-name)
|
||||
(call-with-output-file file-name (const #t))
|
||||
)
|
||||
(mkdir-p "/var/log/sssd")
|
||||
(mkdir-p "/var/lib/sssd")
|
||||
#t
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(define sssd-service-type
|
||||
(service-type (name 'sssd)
|
||||
(extensions
|
||||
(list
|
||||
(service-extension shepherd-root-service-type sssd-service)
|
||||
(service-extension activation-service-type (const %sssd-activation))
|
||||
)
|
||||
)
|
||||
(description "Run sssd")
|
||||
)
|
||||
)
|
Loading…
Add table
Reference in a new issue