Skip to content
Snippets Groups Projects
Commit 217a5b85 authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

system: Automatically add essential services.

* gnu/services/base.scm (%base-services): Remove calls to
  'host-name-service', 'user-processes-service', and
  'root-file-system-service'.
* gnu/system.scm (<operating-system>)[operating-system-services]: Rename
  to...
  [operating-system-user-services]: ... this.
  (essential-services, operating-system-services): New procedures.
  (operating-system-accounts, operating-system-etc-directory,
  operating-system-boot-script, operating-system-derivation): Adjust to
  new 'operating-system-services' return type.
parent e5c66f8c
No related branches found
No related tags found
No related merge requests found
...@@ -267,13 +267,6 @@ (define %base-services ...@@ -267,13 +267,6 @@ (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")
;; The "root" services.
(user-processes-service)
(root-file-system-service))))
;;; base.scm ends here ;;; base.scm ends here
...@@ -40,6 +40,7 @@ (define-module (gnu system) ...@@ -40,6 +40,7 @@ (define-module (gnu system)
#:export (operating-system #:export (operating-system
operating-system? operating-system?
operating-system-services operating-system-services
operating-system-user-services
operating-system-packages operating-system-packages
operating-system-bootloader-entries operating-system-bootloader-entries
operating-system-host-name operating-system-host-name
...@@ -50,7 +51,6 @@ (define-module (gnu system) ...@@ -50,7 +51,6 @@ (define-module (gnu system)
operating-system-packages operating-system-packages
operating-system-timezone operating-system-timezone
operating-system-locale operating-system-locale
operating-system-services
operating-system-file-systems operating-system-file-systems
operating-system-derivation operating-system-derivation
...@@ -112,7 +112,7 @@ (define-record-type* <operating-system> operating-system ...@@ -112,7 +112,7 @@ (define-record-type* <operating-system> operating-system
(timezone operating-system-timezone) ; string (timezone operating-system-timezone) ; string
(locale operating-system-locale) ; string (locale operating-system-locale) ; string
(services operating-system-services ; list of monadic services (services operating-system-user-services ; list of monadic services
(default %base-services)) (default %base-services))
(pam-services operating-system-pam-services ; list of PAM services (pam-services operating-system-pam-services ; list of PAM services
...@@ -184,6 +184,24 @@ (define builder ...@@ -184,6 +184,24 @@ (define builder
(gexp->derivation name builder)) (gexp->derivation name builder))
(define (essential-services os)
"Return the list of essential services for OS. These are special services
that implement part of what's declared in OS are responsible for low-level
bookkeeping."
(mlet %store-monad ((procs (user-processes-service))
(root-fs (root-file-system-service))
(host-name (host-name-service
(operating-system-host-name os))))
(return (list host-name procs root-fs))))
(define (operating-system-services os)
"Return all the services of OS, including \"internal\" services that do not
explicitly appear in OS."
(mlet %store-monad
((user (sequence %store-monad (operating-system-user-services os)))
(essential (essential-services os)))
(return (append essential user))))
(define* (etc-directory #:key (define* (etc-directory #:key
(locale "C") (timezone "Europe/Paris") (locale "C") (timezone "Europe/Paris")
(accounts '()) (accounts '())
...@@ -254,8 +272,7 @@ (define (operating-system-profile os) ...@@ -254,8 +272,7 @@ (define (operating-system-profile os)
(define (operating-system-accounts os) (define (operating-system-accounts os)
"Return the user accounts for OS, including an obligatory 'root' account." "Return the user accounts for OS, including an obligatory 'root' account."
(mlet %store-monad ((services (sequence %store-monad (mlet %store-monad ((services (operating-system-services os)))
(operating-system-services os))))
(return (cons (user-account (return (cons (user-account
(name "root") (name "root")
(password "") (password "")
...@@ -269,7 +286,7 @@ (define (operating-system-accounts os) ...@@ -269,7 +286,7 @@ (define (operating-system-accounts os)
(define (operating-system-etc-directory os) (define (operating-system-etc-directory os)
"Return that static part of the /etc directory of OS." "Return that static part of the /etc directory of OS."
(mlet* %store-monad (mlet* %store-monad
((services (sequence %store-monad (operating-system-services os))) ((services (operating-system-services os))
(pam-services -> (pam-services ->
;; Services known to PAM. ;; Services known to PAM.
(delete-duplicates (delete-duplicates
...@@ -310,7 +327,7 @@ (define %modules ...@@ -310,7 +327,7 @@ (define %modules
(guix build utils))) (guix build utils)))
(mlet* %store-monad (mlet* %store-monad
((services (sequence %store-monad (operating-system-services os))) ((services (operating-system-services os))
(etc (operating-system-etc-directory os)) (etc (operating-system-etc-directory os))
(modules (imported-modules %modules)) (modules (imported-modules %modules))
(compiled (compiled-modules %modules)) (compiled (compiled-modules %modules))
...@@ -367,7 +384,7 @@ (define boot-file-systems ...@@ -367,7 +384,7 @@ (define boot-file-systems
(mlet* %store-monad (mlet* %store-monad
((profile (operating-system-profile os)) ((profile (operating-system-profile os))
(etc (operating-system-etc-directory os)) (etc (operating-system-etc-directory os))
(services (sequence %store-monad (operating-system-services os))) (services (operating-system-services os))
(boot (operating-system-boot-script os)) (boot (operating-system-boot-script os))
(kernel -> (operating-system-kernel os)) (kernel -> (operating-system-kernel os))
(initrd ((operating-system-initrd os) boot-file-systems)) (initrd ((operating-system-initrd os) boot-file-systems))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment