2014-02-19 19:58:24 +00:00
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
monads: Move '%store-monad' and related procedures where they belong.
This turns (guix monads) into a generic module for monads, and moves the
store monad and related monadic procedures in their corresponding
module.
* guix/monads.scm (store-return, store-bind, %store-monad, store-lift,
text-file, interned-file, package-file, package->derivation,
package->cross-derivation, origin->derivation, imported-modules,
compiled, modules, built-derivations, run-with-store): Move to...
* guix/store.scm (store-return, store-bind, %store-monad, store-lift,
text-file, interned-file): ... here.
(%guile-for-build): New variable.
(run-with-store): Moved from monads.scm. Remove default value for
#:guile-for-build.
* guix/packages.scm (default-guile): Export.
(set-guile-for-build): New procedure.
(package-file, package->derivation, package->cross-derivation,
origin->derivation): Moved from monads.scm.
* guix/derivations.scm (%guile-for-build): Remove.
(imported-modules): Rename to...
(%imported-modules): ... this.
(compiled-modules): Rename to...
(%compiled-modules): ... this.
(built-derivations, imported-modules, compiled-modules): New
procedures.
* gnu/services/avahi.scm, gnu/services/base.scm, gnu/services/dbus.scm,
gnu/services/dmd.scm, gnu/services/networking.scm,
gnu/services/ssh.scm, gnu/services/xorg.scm, gnu/system/install.scm,
gnu/system/linux-initrd.scm, gnu/system/shadow.scm, guix/download.scm,
guix/gexp.scm, guix/git-download.scm, guix/profiles.scm,
guix/svn-download.scm, tests/monads.scm: Adjust imports accordingly.
* guix/monad-repl.scm (default-guile-derivation): New procedure.
(store-monad-language, run-in-store): Use it.
* build-aux/hydra/gnu-system.scm (qemu-jobs): Add explicit
'set-guile-for-build' call.
* guix/scripts/archive.scm (derivation-from-expression): Likewise.
* guix/scripts/build.scm (options/resolve-packages): Likewise.
* guix/scripts/environment.scm (guix-environment): Likewise.
* guix/scripts/system.scm (guix-system): Likewise.
* doc/guix.texi (The Store Monad): Adjust module names accordingly.
2015-01-14 12:34:52 +00:00
|
|
|
;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
|
2014-02-19 19:58:24 +00:00
|
|
|
;;;
|
|
|
|
;;; This file is part of GNU Guix.
|
|
|
|
;;;
|
|
|
|
;;; GNU Guix is free software; you can redistribute it and/or modify it
|
|
|
|
;;; under the terms of the GNU General Public License as published by
|
|
|
|
;;; the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
;;; your option) any later version.
|
|
|
|
;;;
|
|
|
|
;;; GNU Guix is distributed in the hope that it will be useful, but
|
|
|
|
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;;; GNU General Public License for more details.
|
|
|
|
;;;
|
|
|
|
;;; You should have received a copy of the GNU General Public License
|
|
|
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
(define-module (gnu services dmd)
|
2015-03-09 22:49:18 +00:00
|
|
|
#:use-module (guix ui)
|
|
|
|
#:use-module (guix sets)
|
2014-04-28 21:07:08 +00:00
|
|
|
#:use-module (guix gexp)
|
monads: Move '%store-monad' and related procedures where they belong.
This turns (guix monads) into a generic module for monads, and moves the
store monad and related monadic procedures in their corresponding
module.
* guix/monads.scm (store-return, store-bind, %store-monad, store-lift,
text-file, interned-file, package-file, package->derivation,
package->cross-derivation, origin->derivation, imported-modules,
compiled, modules, built-derivations, run-with-store): Move to...
* guix/store.scm (store-return, store-bind, %store-monad, store-lift,
text-file, interned-file): ... here.
(%guile-for-build): New variable.
(run-with-store): Moved from monads.scm. Remove default value for
#:guile-for-build.
* guix/packages.scm (default-guile): Export.
(set-guile-for-build): New procedure.
(package-file, package->derivation, package->cross-derivation,
origin->derivation): Moved from monads.scm.
* guix/derivations.scm (%guile-for-build): Remove.
(imported-modules): Rename to...
(%imported-modules): ... this.
(compiled-modules): Rename to...
(%compiled-modules): ... this.
(built-derivations, imported-modules, compiled-modules): New
procedures.
* gnu/services/avahi.scm, gnu/services/base.scm, gnu/services/dbus.scm,
gnu/services/dmd.scm, gnu/services/networking.scm,
gnu/services/ssh.scm, gnu/services/xorg.scm, gnu/system/install.scm,
gnu/system/linux-initrd.scm, gnu/system/shadow.scm, guix/download.scm,
guix/gexp.scm, guix/git-download.scm, guix/profiles.scm,
guix/svn-download.scm, tests/monads.scm: Adjust imports accordingly.
* guix/monad-repl.scm (default-guile-derivation): New procedure.
(store-monad-language, run-in-store): Use it.
* build-aux/hydra/gnu-system.scm (qemu-jobs): Add explicit
'set-guile-for-build' call.
* guix/scripts/archive.scm (derivation-from-expression): Likewise.
* guix/scripts/build.scm (options/resolve-packages): Likewise.
* guix/scripts/environment.scm (guix-environment): Likewise.
* guix/scripts/system.scm (guix-system): Likewise.
* doc/guix.texi (The Store Monad): Adjust module names accordingly.
2015-01-14 12:34:52 +00:00
|
|
|
#:use-module (guix store)
|
2014-02-19 19:58:24 +00:00
|
|
|
#:use-module (guix monads)
|
monads: Move '%store-monad' and related procedures where they belong.
This turns (guix monads) into a generic module for monads, and moves the
store monad and related monadic procedures in their corresponding
module.
* guix/monads.scm (store-return, store-bind, %store-monad, store-lift,
text-file, interned-file, package-file, package->derivation,
package->cross-derivation, origin->derivation, imported-modules,
compiled, modules, built-derivations, run-with-store): Move to...
* guix/store.scm (store-return, store-bind, %store-monad, store-lift,
text-file, interned-file): ... here.
(%guile-for-build): New variable.
(run-with-store): Moved from monads.scm. Remove default value for
#:guile-for-build.
* guix/packages.scm (default-guile): Export.
(set-guile-for-build): New procedure.
(package-file, package->derivation, package->cross-derivation,
origin->derivation): Moved from monads.scm.
* guix/derivations.scm (%guile-for-build): Remove.
(imported-modules): Rename to...
(%imported-modules): ... this.
(compiled-modules): Rename to...
(%compiled-modules): ... this.
(built-derivations, imported-modules, compiled-modules): New
procedures.
* gnu/services/avahi.scm, gnu/services/base.scm, gnu/services/dbus.scm,
gnu/services/dmd.scm, gnu/services/networking.scm,
gnu/services/ssh.scm, gnu/services/xorg.scm, gnu/system/install.scm,
gnu/system/linux-initrd.scm, gnu/system/shadow.scm, guix/download.scm,
guix/gexp.scm, guix/git-download.scm, guix/profiles.scm,
guix/svn-download.scm, tests/monads.scm: Adjust imports accordingly.
* guix/monad-repl.scm (default-guile-derivation): New procedure.
(store-monad-language, run-in-store): Use it.
* build-aux/hydra/gnu-system.scm (qemu-jobs): Add explicit
'set-guile-for-build' call.
* guix/scripts/archive.scm (derivation-from-expression): Likewise.
* guix/scripts/build.scm (options/resolve-packages): Likewise.
* guix/scripts/environment.scm (guix-environment): Likewise.
* guix/scripts/system.scm (guix-system): Likewise.
* doc/guix.texi (The Store Monad): Adjust module names accordingly.
2015-01-14 12:34:52 +00:00
|
|
|
#:use-module (guix derivations) ;imported-modules, etc.
|
2014-02-19 19:58:24 +00:00
|
|
|
#:use-module (gnu services)
|
|
|
|
#:use-module (ice-9 match)
|
|
|
|
#:use-module (srfi srfi-1)
|
2015-03-09 22:49:18 +00:00
|
|
|
#:use-module (srfi srfi-34)
|
|
|
|
#:use-module (srfi srfi-35)
|
2014-02-19 19:58:24 +00:00
|
|
|
#:export (dmd-configuration-file))
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
;;;
|
|
|
|
;;; Instantiating system services as a dmd configuration file.
|
|
|
|
;;;
|
|
|
|
;;; Code:
|
|
|
|
|
2015-03-09 22:49:18 +00:00
|
|
|
(define (assert-no-duplicates services)
|
|
|
|
"Raise an error if SERVICES provide the same dmd service more than once.
|
|
|
|
|
|
|
|
This is a constraint that dmd's 'register-service' verifies but we'd better
|
|
|
|
verify it here statically than wait until PID 1 halts with an assertion
|
|
|
|
failure."
|
|
|
|
(fold (lambda (service set)
|
|
|
|
(define (assert-unique symbol)
|
|
|
|
(when (set-contains? set symbol)
|
|
|
|
(raise (condition
|
|
|
|
(&message
|
|
|
|
(message
|
|
|
|
(format #f (_ "service '~a' provided more than once")
|
|
|
|
symbol)))))))
|
|
|
|
|
|
|
|
(for-each assert-unique (service-provision service))
|
|
|
|
(fold set-insert set (service-provision service)))
|
|
|
|
(setq)
|
|
|
|
services))
|
|
|
|
|
2014-04-30 13:44:59 +00:00
|
|
|
(define (dmd-configuration-file services)
|
|
|
|
"Return the dmd configuration file for SERVICES."
|
2014-05-10 20:58:22 +00:00
|
|
|
(define modules
|
|
|
|
;; Extra modules visible to dmd.conf.
|
2014-05-10 21:33:52 +00:00
|
|
|
'((guix build syscalls)
|
Move part of (gnu build linux-boot) to (gnu build file-systems).
* gnu/build/linux-boot.scm (%ext2-endianness, %ext2-sblock-magic,
%ext2-sblock-creator-os, %ext2-sblock-uuid, %ext2-sblock-volume-name,
read-ext2-superblock, ext2-superblock-uuid,
ext2-superblock-volume-name, disk-partitions,
partition-label-predicate, find-partition-by-label,
canonicalize-device-spec, MS_RDONLY, MS_NOSUID, MS_NODEV, MS_NOEXEC,
MS_BIND, MS_MOVE, bind-mount, check-file-system,
mount-flags->bit-mask, mount-file-system): Move to...
* gnu/build/file-systems.scm: ... here. New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
* gnu/services/base.scm: Use (gnu build file-systems).
* gnu/services/dmd.scm (dmd-configuration-file): Likewise.
* gnu/system.scm (operating-system-activation-script): Likewise.
* gnu/system/linux-initrd.scm (base-initrd): Likewise.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Likewise.
2014-09-03 12:19:51 +00:00
|
|
|
(gnu build file-systems)
|
2014-05-10 21:33:52 +00:00
|
|
|
(guix build utils)))
|
2014-05-10 20:58:22 +00:00
|
|
|
|
2015-03-09 22:49:18 +00:00
|
|
|
(assert-no-duplicates services)
|
|
|
|
|
2014-05-10 20:58:22 +00:00
|
|
|
(mlet %store-monad ((modules (imported-modules modules))
|
|
|
|
(compiled (compiled-modules modules)))
|
|
|
|
(define config
|
|
|
|
#~(begin
|
|
|
|
(eval-when (expand load eval)
|
|
|
|
(set! %load-path (cons #$modules %load-path))
|
|
|
|
(set! %load-compiled-path
|
|
|
|
(cons #$compiled %load-compiled-path)))
|
|
|
|
|
|
|
|
(use-modules (ice-9 ftw)
|
2014-05-10 21:33:52 +00:00
|
|
|
(guix build syscalls)
|
2014-07-22 20:12:05 +00:00
|
|
|
(guix build utils)
|
Move part of (gnu build linux-boot) to (gnu build file-systems).
* gnu/build/linux-boot.scm (%ext2-endianness, %ext2-sblock-magic,
%ext2-sblock-creator-os, %ext2-sblock-uuid, %ext2-sblock-volume-name,
read-ext2-superblock, ext2-superblock-uuid,
ext2-superblock-volume-name, disk-partitions,
partition-label-predicate, find-partition-by-label,
canonicalize-device-spec, MS_RDONLY, MS_NOSUID, MS_NODEV, MS_NOEXEC,
MS_BIND, MS_MOVE, bind-mount, check-file-system,
mount-flags->bit-mask, mount-file-system): Move to...
* gnu/build/file-systems.scm: ... here. New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
* gnu/services/base.scm: Use (gnu build file-systems).
* gnu/services/dmd.scm (dmd-configuration-file): Likewise.
* gnu/system.scm (operating-system-activation-script): Likewise.
* gnu/system/linux-initrd.scm (base-initrd): Likewise.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Likewise.
2014-09-03 12:19:51 +00:00
|
|
|
((gnu build file-systems)
|
2014-06-02 21:58:50 +00:00
|
|
|
#:select (check-file-system canonicalize-device-spec)))
|
2014-05-10 20:58:22 +00:00
|
|
|
|
|
|
|
(register-services
|
|
|
|
#$@(map (lambda (service)
|
|
|
|
#~(make <service>
|
|
|
|
#:docstring '#$(service-documentation service)
|
|
|
|
#:provides '#$(service-provision service)
|
|
|
|
#:requires '#$(service-requirement service)
|
|
|
|
#:respawn? '#$(service-respawn? service)
|
|
|
|
#:start #$(service-start service)
|
|
|
|
#:stop #$(service-stop service)))
|
|
|
|
services))
|
|
|
|
|
|
|
|
;; guix-daemon 0.6 aborts if 'PATH' is undefined, so work around it.
|
2014-05-17 15:39:30 +00:00
|
|
|
(setenv "PATH" "/run/current-system/profile/bin")
|
2014-05-10 20:58:22 +00:00
|
|
|
|
|
|
|
(format #t "starting services...~%")
|
2014-11-10 22:23:32 +00:00
|
|
|
(for-each start
|
|
|
|
'#$(append-map service-provision
|
|
|
|
(filter service-auto-start? services)))))
|
2014-05-10 20:58:22 +00:00
|
|
|
|
|
|
|
(gexp->file "dmd.conf" config)))
|
2014-02-19 19:58:24 +00:00
|
|
|
|
|
|
|
;;; dmd.scm ends here
|