install: Have several OS config templates under /etc/configuration.

* gnu/system/install.scm (configuration-template-service): Remove
  'local-template' and 'template'.  Add 'search' and 'templates'.
  [activate]: Copy all of TEMPLATES to /etc/configuration.
* doc/guix.texi (System Installation): Adjust file name accordingly.
This commit is contained in:
Ludovic Courtès 2015-05-09 23:34:01 +02:00
parent 36ffaca246
commit e1fbc32a0a
2 changed files with 23 additions and 8 deletions

View File

@ -3927,7 +3927,7 @@ It is better to store that file on the target root file system, say, as
A minimal operating system configuration, with just the bare minimum and A minimal operating system configuration, with just the bare minimum and
only a root account would look like this (on the installation system, only a root account would look like this (on the installation system,
this example is available as @file{/etc/configuration-template.scm}): this example is available as @file{/etc/configuration/bare-bones.scm}):
@example @example
@include os-config.texi @include os-config.texi

View File

@ -32,6 +32,8 @@
#:use-module (gnu packages grub) #:use-module (gnu packages grub)
#:use-module (gnu packages texinfo) #:use-module (gnu packages texinfo)
#:use-module (gnu packages compression) #:use-module (gnu packages compression)
#:use-module (ice-9 match)
#:use-module (srfi srfi-26)
#:export (self-contained-tarball #:export (self-contained-tarball
installation-os)) installation-os))
@ -172,12 +174,17 @@ the given target.")
"Return a dummy service whose purpose is to install an operating system "Return a dummy service whose purpose is to install an operating system
configuration template file in the installation system." configuration template file in the installation system."
(define local-template (define search
"/etc/configuration-template.scm") (cut search-path %load-path <>))
(define template (define templates
(search-path %load-path "gnu/system/examples/bare-bones.tmpl")) (map (match-lambda
((file '-> target)
(list (local-file (search file))
(string-append "/etc/configuration/" target))))
'(("gnu/system/examples/bare-bones.tmpl" -> "bare-bones.scm")
("gnu/system/examples/desktop.tmpl" -> "desktop.scm"))))
(mlet %store-monad ((template (interned-file template))) (with-monad %store-monad
(return (service (return (service
(requirement '(root-file-system)) (requirement '(root-file-system))
(provision '(os-config-template)) (provision '(os-config-template))
@ -186,8 +193,16 @@ configuration template file in the installation system."
(start #~(const #t)) (start #~(const #t))
(stop #~(const #f)) (stop #~(const #f))
(activate (activate
#~(unless (file-exists? #$local-template) #~(begin
(copy-file #$template #$local-template))))))) (use-modules (ice-9 match)
(guix build utils))
(mkdir-p "/etc/configuration")
(for-each (match-lambda
((file target)
(unless (file-exists? target)
(copy-file file target))))
'#$templates)))))))
(define %nscd-minimal-caches (define %nscd-minimal-caches
;; Minimal in-memory caching policy for nscd. ;; Minimal in-memory caching policy for nscd.