mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-11 13:49:23 -05:00
system: Factorize (gnu system).
* gnu/system.scm (operating-system-accounts, operating-system-etc-directory): New procedures. (operating-system-derivation): Use them. * gnu/services/base.scm (%base-services): Add 'host-name-service' invocation.
This commit is contained in:
parent
42b001381e
commit
0b6f49ef69
2 changed files with 38 additions and 26 deletions
|
@ -186,6 +186,9 @@ (define %base-services
|
||||||
(mingetty-service "tty6" #:motd motd)
|
(mingetty-service "tty6" #:motd motd)
|
||||||
(syslog-service)
|
(syslog-service)
|
||||||
(guix-service)
|
(guix-service)
|
||||||
(nscd-service))))
|
(nscd-service)
|
||||||
|
|
||||||
|
;; FIXME: Make this an activation-time thing instead of a service.
|
||||||
|
(host-name-service "gnu"))))
|
||||||
|
|
||||||
;;; base.scm ends here
|
;;; base.scm ends here
|
||||||
|
|
|
@ -292,42 +292,50 @@ (define (operating-system-profile-directory os)
|
||||||
(mlet %store-monad ((drv (operating-system-profile-derivation os)))
|
(mlet %store-monad ((drv (operating-system-profile-derivation os)))
|
||||||
(return (derivation->output-path drv))))
|
(return (derivation->output-path drv))))
|
||||||
|
|
||||||
(define (operating-system-derivation os)
|
(define (operating-system-accounts os)
|
||||||
"Return a derivation that builds OS."
|
"Return the user accounts for OS, including an obligatory 'root' account."
|
||||||
|
(mlet %store-monad ((services (sequence %store-monad
|
||||||
|
(operating-system-services os))))
|
||||||
|
(return (cons (user-account
|
||||||
|
(name "root")
|
||||||
|
(password "")
|
||||||
|
(uid 0) (gid 0)
|
||||||
|
(comment "System administrator")
|
||||||
|
(home-directory "/root"))
|
||||||
|
(append (operating-system-users os)
|
||||||
|
(append-map service-user-accounts
|
||||||
|
services))))))
|
||||||
|
|
||||||
|
(define (operating-system-etc-directory os)
|
||||||
|
"Return that static part of the /etc directory of OS."
|
||||||
(mlet* %store-monad
|
(mlet* %store-monad
|
||||||
((services (sequence %store-monad
|
((services (sequence %store-monad (operating-system-services os)))
|
||||||
(cons (host-name-service
|
|
||||||
(operating-system-host-name os))
|
|
||||||
(operating-system-services os))))
|
|
||||||
(pam-services ->
|
(pam-services ->
|
||||||
;; Services known to PAM.
|
;; Services known to PAM.
|
||||||
(delete-duplicates
|
(delete-duplicates
|
||||||
(cons %pam-other-services
|
(cons %pam-other-services
|
||||||
(append-map service-pam-services services))))
|
(append-map service-pam-services services))))
|
||||||
|
(accounts (operating-system-accounts os))
|
||||||
(bash-file (package-file bash "bin/bash"))
|
(profile-drv (operating-system-profile-derivation os))
|
||||||
(dmd-file (package-file (@ (gnu packages admin) dmd) "bin/dmd"))
|
|
||||||
(accounts -> (cons (user-account
|
|
||||||
(name "root")
|
|
||||||
(password "")
|
|
||||||
(uid 0) (gid 0)
|
|
||||||
(comment "System administrator")
|
|
||||||
(home-directory "/root"))
|
|
||||||
(append (operating-system-users os)
|
|
||||||
(append-map service-user-accounts
|
|
||||||
services))))
|
|
||||||
(groups -> (append (operating-system-groups os)
|
(groups -> (append (operating-system-groups os)
|
||||||
(append-map service-user-groups services)))
|
(append-map service-user-groups services))))
|
||||||
|
(etc-directory #:accounts accounts #:groups groups
|
||||||
|
#:pam-services pam-services
|
||||||
|
#:locale (operating-system-locale os)
|
||||||
|
#:timezone (operating-system-timezone os)
|
||||||
|
#:profile profile-drv)))
|
||||||
|
|
||||||
|
(define (operating-system-derivation os)
|
||||||
|
"Return a derivation that builds OS."
|
||||||
|
(mlet* %store-monad
|
||||||
|
((bash-file (package-file bash "bin/bash"))
|
||||||
|
(dmd-file (package-file (@ (gnu packages admin) dmd) "bin/dmd"))
|
||||||
(profile-drv (operating-system-profile-derivation os))
|
(profile-drv (operating-system-profile-derivation os))
|
||||||
(profile -> (derivation->output-path profile-drv))
|
(profile -> (derivation->output-path profile-drv))
|
||||||
(etc-drv (etc-directory #:accounts accounts #:groups groups
|
(etc-drv (operating-system-etc-directory os))
|
||||||
#:pam-services pam-services
|
|
||||||
#:locale (operating-system-locale os)
|
|
||||||
#:timezone (operating-system-timezone os)
|
|
||||||
#:profile profile-drv))
|
|
||||||
(etc -> (derivation->output-path etc-drv))
|
(etc -> (derivation->output-path etc-drv))
|
||||||
(dmd-conf (dmd-configuration-file services etc))
|
(services (sequence %store-monad (operating-system-services os)))
|
||||||
|
(dmd-conf (dmd-configuration-file services etc))
|
||||||
|
|
||||||
|
|
||||||
(boot (text-file "boot"
|
(boot (text-file "boot"
|
||||||
|
@ -349,6 +357,7 @@ (define (operating-system-derivation os)
|
||||||
,(string-append "--load=" boot)))
|
,(string-append "--load=" boot)))
|
||||||
(initrd initrd-file))))
|
(initrd initrd-file))))
|
||||||
(grub.cfg (grub-configuration-file entries))
|
(grub.cfg (grub-configuration-file entries))
|
||||||
|
(accounts (operating-system-accounts os))
|
||||||
(extras (links (delete-duplicates
|
(extras (links (delete-duplicates
|
||||||
(append (append-map service-inputs services)
|
(append (append-map service-inputs services)
|
||||||
(append-map user-account-inputs accounts))))))
|
(append-map user-account-inputs accounts))))))
|
||||||
|
|
Loading…
Reference in a new issue