From c833ab556f811da6d1d9e467cb85b36e5d006cc7 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Wed, 18 Mar 2015 17:59:20 +0100 Subject: [PATCH 01/10] gnu: Add Shogun. * gnu/packages/bioinformatics.scm (shogun): New variable. --- gnu/packages/bioinformatics.scm | 109 ++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm index 9813d07e9c..b122b6d83d 100644 --- a/gnu/packages/bioinformatics.scm +++ b/gnu/packages/bioinformatics.scm @@ -30,13 +30,17 @@ #:use-module (gnu packages base) #:use-module (gnu packages compression) #:use-module (gnu packages java) + #:use-module (gnu packages maths) #:use-module (gnu packages ncurses) #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages popt) #:use-module (gnu packages python) + #:use-module (gnu packages statistics) + #:use-module (gnu packages swig) #:use-module (gnu packages tbb) #:use-module (gnu packages vim) + #:use-module (gnu packages xml) #:use-module (gnu packages zip)) (define-public bedops @@ -1001,6 +1005,111 @@ sequences.") ;; STAR is licensed under GPLv3 or later; htslib is MIT-licensed. (license license:gpl3+))) +(define-public shogun + (package + (name "shogun") + (version "4.0.0") + (source + (origin + (method url-fetch) + (uri (string-append + "ftp://shogun-toolbox.org/shogun/releases/" + (version-major+minor version) + "/sources/shogun-" version ".tar.bz2")) + (sha256 + (base32 + "159nlijnb7mnrv9za80wnm1shwvy45hgrqzn51hxy7gw4z6d6fdb")))) + (build-system cmake-build-system) + (arguments + '(#:tests? #f ;no check target + #:phases + (alist-cons-after + 'unpack 'delete-broken-symlinks + (lambda _ + (for-each delete-file '("applications/arts/data" + "applications/asp/data" + "applications/easysvm/data" + "applications/msplicer/data" + "applications/ocr/data" + "examples/documented/data" + "examples/documented/matlab_static" + "examples/documented/octave_static" + "examples/undocumented/data" + "examples/undocumented/matlab_static" + "examples/undocumented/octave_static" + "tests/integration/data" + "tests/integration/matlab_static" + "tests/integration/octave_static" + "tests/integration/python_modular/tests")) + #t) + (alist-cons-after + 'unpack 'change-R-target-path + (lambda* (#:key outputs #:allow-other-keys) + (substitute* '("src/interfaces/r_modular/CMakeLists.txt" + "src/interfaces/r_static/CMakeLists.txt" + "examples/undocumented/r_modular/CMakeLists.txt") + (("\\$\\{R_COMPONENT_LIB_PATH\\}") + (string-append (assoc-ref outputs "out") + "/lib/R/library/"))) + #t) + (alist-cons-after + 'unpack 'fix-octave-modules + (lambda* (#:key outputs #:allow-other-keys) + (substitute* '("src/interfaces/octave_modular/CMakeLists.txt" + "src/interfaces/octave_static/CMakeLists.txt") + (("^include_directories\\(\\$\\{OCTAVE_INCLUDE_DIRS\\}") + "include_directories(${OCTAVE_INCLUDE_DIRS} ${OCTAVE_INCLUDE_DIRS}/octave")) + + ;; change target directory + (substitute* "src/interfaces/octave_modular/CMakeLists.txt" + (("\\$\\{OCTAVE_OCT_LOCAL_API_FILE_DIR\\}") + (string-append (assoc-ref outputs "out") + "/share/octave/packages"))) + #t) + (alist-cons-before + 'build 'set-HOME + ;; $HOME needs to be set at some point during the build phase + (lambda _ (setenv "HOME" "/tmp") #t) + %standard-phases)))) + #:configure-flags + (list "-DUSE_SVMLIGHT=OFF" ;disable proprietary SVMLIGHT + ;;"-DJavaModular=ON" ;requires unpackaged jblas + ;;"-DRubyModular=ON" ;requires unpackaged ruby-narray + ;;"-DPerlModular=ON" ;"FindPerlLibs" does not exist + ;;"-DLuaModular=ON" ;fails because lua doesn't build pkgconfig file + "-DOctaveModular=ON" + "-DOctaveStatic=ON" + "-DPythonModular=ON" + "-DPythonStatic=ON" + "-DRModular=ON" + "-DRStatic=ON" + "-DCmdLineStatic=ON"))) + (inputs + `(("python" ,python) + ("numpy" ,python-numpy) + ("r" ,r) + ("octave" ,octave) + ("swig" ,swig) + ("hdf5" ,hdf5) + ("atlas" ,atlas) + ("arpack" ,arpack-ng) + ("lapack" ,lapack) + ("glpk" ,glpk) + ("libxml2" ,libxml2) + ("lzo" ,lzo) + ("zlib" ,zlib))) + (native-inputs + `(("pkg-config" ,pkg-config))) + (home-page "http://shogun-toolbox.org/") + (synopsis "Machine learning toolbox") + (description + "The Shogun Machine learning toolbox provides a wide range of unified and +efficient Machine Learning (ML) methods. The toolbox seamlessly allows to +combine multiple data representations, algorithm classes, and general purpose +tools. This enables both rapid prototyping of data pipelines and extensibility +in terms of new algorithms.") + (license license:gpl3+))) + (define-public vcftools (package (name "vcftools") From ee3e157dec3512778502f20538c581f5e28d63fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 9 Apr 2015 23:44:14 +0200 Subject: [PATCH 02/10] Add Bash completion file. * etc/completion/bash/guix: New file. * Makefile.am (dist_bashcompletion_DATA): New variable. * configure.ac: Add --with-bash-completion-dir. --- Makefile.am | 3 + configure.ac | 7 ++ etc/completion/bash/guix | 139 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 149 insertions(+) create mode 100644 etc/completion/bash/guix diff --git a/Makefile.am b/Makefile.am index d54e281163..51884b9221 100644 --- a/Makefile.am +++ b/Makefile.am @@ -240,6 +240,9 @@ tests/guix-gc.log: \ # Public key used to sign substitutes from hydra.gnu.org. dist_pkgdata_DATA = hydra.gnu.org.pub +# Bash completion file. +dist_bashcompletion_DATA = etc/completion/bash/guix + EXTRA_DIST = \ HACKING \ ROADMAP \ diff --git a/configure.ac b/configure.ac index 6f261cdb63..2227c71c1b 100644 --- a/configure.ac +++ b/configure.ac @@ -34,6 +34,13 @@ AC_ARG_WITH(store-dir, [storedir="/gnu/store"]) AC_SUBST(storedir) +AC_ARG_WITH([bash-completion-dir], + AC_HELP_STRING([--with-bash-completion-dir=DIR], + [name of the Bash completion directory]), + [bashcompletiondir="$withval"], + [bashcompletiondir='${sysconfdir}/bash_completion.d']) +AC_SUBST([bashcompletiondir]) + dnl Better be verbose. AC_MSG_CHECKING([for the store directory]) AC_MSG_RESULT([$storedir]) diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix new file mode 100644 index 0000000000..2a3fa1201e --- /dev/null +++ b/etc/completion/bash/guix @@ -0,0 +1,139 @@ +# GNU Guix --- Functional package management for GNU +# Copyright © 2015 Ludovic Courtès +# +# 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 . + +# Bash completion for Guix commands. + +_guix_complete_available_package () +{ + local prefix="$1" + local packages="$(${COMP_WORDS[0]} package -A "^$prefix" | cut -f1)" + COMPREPLY=($(compgen -W "$packages" -- "$prefix")) +} + +_guix_complete_installed_package () +{ + local prefix="$1" + local packages="$(${COMP_WORDS[0]} package -I "^$prefix" | cut -f1)" + COMPREPLY=($(compgen -W "$packages" -- "$prefix")) +} + +_guix_complete_option () +{ + local options="$(${COMP_WORDS[0]} ${COMP_WORDS[1]} --help \ + | grep '^ -' \ + | sed -e's/^.*--\([a-zA-Z0-9_-]\+\)\(=\?\).*/--\1\2/g' )" + compopt -o nospace + COMPREPLY=($(compgen -W "$options" -- "${COMP_WORDS[$word_count - 1]}")) +} + +_guix_is_command () +{ + local word + local result="false" + for word in ${COMP_WORDS[*]} + do + if [ "$word" = "$1" ] + then + result=true + break + fi + done + $result +} + +_guix_is_removing () +{ + local word + local result="false" + for word in ${COMP_WORDS[*]} + do + case "$word" in + --remove|--remove=*|-r) + result=true + break + ;; + esac + done + $result +} + +_guix_is_dash_L () +{ + [ "${COMP_WORDS[$COMP_CWORD - 1]}" = "-L" ] \ + || { case "${COMP_WORDS[$COMP_CWORD]}" in + --load-path=*) true;; + *) false;; + esac } +} + +_guix_complete_file () +{ + # Let Readline complete file names. + compopt -o default + COMPREPLY=() +} + +_guix_complete () +{ + local word_count=${#COMP_WORDS[*]} + local word_at_point="${COMP_WORDS[$COMP_CWORD]}" + + if [ "$COMP_CWORD" -gt 1 ] + then + case "$word_at_point" in + -*) + _guix_complete_option "$word_at_point" + return + ;; + esac + fi + + case $COMP_CWORD in + 1) + local subcommands="$(guix --help | grep '^ ' | cut -c 2-)" + COMPREPLY=($(compgen -W "$subcommands" -- "$word_at_point")) + ;; + *) + if _guix_is_command "package" + then + if _guix_is_dash_L + then + _guix_complete_file + elif _guix_is_removing + then + _guix_complete_installed_package "$word_at_point" + else + _guix_complete_available_package "$word_at_point" + fi + elif _guix_is_command "system" + then + _guix_complete_file # TODO: complete sub-commands + elif _guix_is_command "hash" + then + _guix_complete_file + elif _guix_is_command "import" # TODO: complete sub-commands + then + _guix_complete_file + else + _guix_complete_available_package "$word_at_point" + fi + ;; + esac +} + +complete -F _guix_complete guix From 5854f6858bc4ed61ebc03a0a887661eadcbea640 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Fri, 10 Apr 2015 11:05:45 +0200 Subject: [PATCH 03/10] gnu: Add GRIT. * gnu/packages/bioinformatics.scm (grit): New variable. --- gnu/packages/bioinformatics.scm | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm index b122b6d83d..e143fb2c55 100644 --- a/gnu/packages/bioinformatics.scm +++ b/gnu/packages/bioinformatics.scm @@ -511,6 +511,57 @@ supports next-generation sequencing data in fasta/q and csfasta/q format from Illumina, Roche 454, and the SOLiD platform.") (license license:gpl3))) +(define-public grit + (package + (name "grit") + (version "2.0.2") + (source (origin + (method url-fetch) + (uri (string-append + "https://github.com/nboley/grit/archive/" + version ".tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "157in84dj70wimbind3x7sy1whs3h57qfgcnj2s6lrd38fbrb7mj")))) + (build-system python-build-system) + (arguments + `(#:python ,python-2 + #:phases + (alist-cons-after + 'unpack 'generate-from-cython-sources + (lambda* (#:key inputs outputs #:allow-other-keys) + ;; Delete these C files to force fresh generation from pyx sources. + (delete-file "grit/sparsify_support_fns.c") + (delete-file "grit/call_peaks_support_fns.c") + (substitute* "setup.py" + (("Cython.Setup") "Cython.Build") + ;; Add numpy include path to fix compilation + (("pyx\", \\]") + (string-append "pyx\", ], include_dirs = ['" + (assoc-ref inputs "python-numpy") + "/lib/python2.7/site-packages/numpy/core/include/" + "']"))) #t) + %standard-phases))) + (inputs + `(("python-scipy" ,python2-scipy) + ("python-numpy" ,python2-numpy) + ("python-pysam" ,python2-pysam) + ("python-networkx" ,python2-networkx))) + (native-inputs + `(("python-cython" ,python2-cython) + ("python-setuptools" ,python2-setuptools))) + (home-page "http://grit-bio.org") + (synopsis "Tool for integrative analysis of RNA-seq type assays") + (description + "GRIT is designed to use RNA-seq, TES, and TSS data to build and quantify +full length transcript models. When none of these data sources are available, +GRIT can be run by providing a candidate set of TES or TSS sites. In +addition, GRIT can merge in reference junctions and gene boundaries. GRIT can +also be run in quantification mode, where it uses a provided GTF file and just +estimates transcript expression.") + (license license:gpl3+))) + (define-public hisat (package (name "hisat") From 1b922590d758e458ce4f9abd3d1694045bcccb58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Date: Fri, 10 Apr 2015 21:01:10 +0800 Subject: [PATCH 04/10] gnu: Add gst-libav. * gnu/packages/gstreamer.scm (gst-libav): New variable. --- gnu/packages/gstreamer.scm | 39 +++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/gnu/packages/gstreamer.scm b/gnu/packages/gstreamer.scm index ad0cfccca9..9758806cc5 100644 --- a/gnu/packages/gstreamer.scm +++ b/gnu/packages/gstreamer.scm @@ -20,7 +20,7 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu packages gstreamer) - #:use-module ((guix licenses) #:select (lgpl2.0+ bsd-2 bsd-3)) + #:use-module ((guix licenses) #:select (lgpl2.0+ bsd-2 bsd-3 gpl2+)) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix build-system gnu) @@ -39,6 +39,7 @@ #:use-module (gnu packages xiph) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) + #:use-module (gnu packages yasm) #:use-module (gnu packages xml)) (define-public orc @@ -247,6 +248,42 @@ GStreamer multimedia library. This set contains those plug-ins which the developers consider to have good quality code and correct functionality.") (license lgpl2.0+))) +(define-public gst-libav + (package + (name "gst-libav") + (version "1.4.5") + (source (origin + (method url-fetch) + (uri (string-append + "http://gstreamer.freedesktop.org/src/" name "/" + name "-" version ".tar.xz")) + (sha256 + (base32 + "1g7vg9amh3cc3nmc415h6g2rqxqi4wgwqi08hxfbpwq48ri64p30")))) + (build-system gnu-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + (add-before configure patch-/bin/sh + (lambda _ + (substitute* "gst-libs/ext/libav/configure" + (("#! /bin/sh") + (string-append "#! "(which "sh"))))))))) + (native-inputs + `(("pkg-config" ,pkg-config) + ("python" ,python) + ("yasm" ,yasm))) + (inputs + `(("gst-plugins-base" ,gst-plugins-base) + ("orc" ,orc) + ("zlib" ,zlib))) + (home-page "http://gstreamer.freedesktop.org/") + (synopsis "Plugins for the GStreamer multimedia library") + (description + "This GStreamer plugin supports a large number of audio and video +compression formats through the use of the libav library.") + (license gpl2+))) + (define-public gst-plugins-base-0.10 (package (inherit gst-plugins-base) (version "0.10.36") From 5e738ac224c7aea948773e89235dc1418bff448e Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Tue, 24 Feb 2015 23:54:29 -0500 Subject: [PATCH 05/10] system: Clean /tmp and /var/run during early boot. * gnu/system.scm (operating-system-boot-script): Clean out /tmp and /var/run before activating the system. --- gnu/system.scm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gnu/system.scm b/gnu/system.scm index ece61adb2b..a91c7136da 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès +;;; Copyright © 2015 Mark H Weaver ;;; ;;; This file is part of GNU Guix. ;;; @@ -695,6 +696,20 @@ we're running in the final root." (dmd-conf (dmd-configuration-file services))) (gexp->file "boot" #~(begin + (use-modules (guix build utils)) + + ;; Clean out /tmp and /var/run. + ;; + ;; XXX This needs to happen before service activations, so + ;; it has to be here, but this also implicitly assumes + ;; that /tmp and /var/run are on the root partition. + (false-if-exception (delete-file-recursively "/tmp")) + (false-if-exception (delete-file-recursively "/var/run")) + (false-if-exception (mkdir "/tmp")) + (false-if-exception (chmod "/tmp" #o1777)) + (false-if-exception (mkdir "/var/run")) + (false-if-exception (chmod "/var/run" #o755)) + ;; Activate the system. ;; TODO: Use 'load-compiled'. (primitive-load #$activate) From 4c2a38c25f65f7c069228ff923d0ef0785d5f47a Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Sun, 29 Mar 2015 00:23:48 -0400 Subject: [PATCH 06/10] gnu: emacs: Update to 24.5. * gnu/packages/emacs.scm (emacs): Update to 24.5. --- gnu/packages/emacs.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index f328cede28..d680f2b951 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -1,7 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014 Taylan Ulrich Bayirli/Kammer ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès -;;; Copyright © 2014 Mark H Weaver +;;; Copyright © 2014, 2015 Mark H Weaver ;;; Copyright © 2014 Alex Kost ;;; ;;; This file is part of GNU Guix. @@ -57,14 +57,14 @@ (define-public emacs (package (name "emacs") - (version "24.4") + (version "24.5") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/emacs/emacs-" version ".tar.xz")) (sha256 (base32 - "1zflm6ac34s6v166p58ilxrxbxjm0q2wfc25f8y0mjml1lbr3qs7")))) + "0kn3rzm91qiswi0cql89kbv6mqn27rwsyjfb8xmwy9m5s8fxfiyx")))) (build-system glib-or-gtk-build-system) (arguments '(#:phases (alist-cons-before From ce6fc7d6a5345fd1c28e1a59cca807e81244b3e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 12 Apr 2015 15:16:48 +0200 Subject: [PATCH 07/10] build: Build and install (guix build-system haskell). * Makefile.am (MODULES): Add guix/build-system/haskell.scm. --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 51884b9221..05ce9aa7b4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -51,6 +51,7 @@ MODULES = \ guix/build-system/cmake.scm \ guix/build-system/glib-or-gtk.scm \ guix/build-system/gnu.scm \ + guix/build-system/haskell.scm \ guix/build-system/perl.scm \ guix/build-system/python.scm \ guix/build-system/waf.scm \ From b158f1d751b17acc1700fce9777d2b85ffa8e914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 12 Apr 2015 15:33:42 +0200 Subject: [PATCH 08/10] system: Allow users to PTRACE_ATTACH to their own processes. * gnu/build/activation.scm (activate-ptrace-attach): New procedure. * gnu/system.scm (operating-system-activation-script): Use it. --- gnu/build/activation.scm | 13 +++++++++++++ gnu/system.scm | 3 +++ 2 files changed, 16 insertions(+) diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm index 64c3410baf..0c60355a1c 100644 --- a/gnu/build/activation.scm +++ b/gnu/build/activation.scm @@ -30,6 +30,7 @@ activate-/bin/sh activate-modprobe activate-firmware + activate-ptrace-attach activate-current-system)) ;;; Commentary: @@ -335,6 +336,18 @@ by itself, without having to resort to a \"user helper\"." (lambda (port) (display directory port)))) +(define (activate-ptrace-attach) + "Allow users to PTRACE_ATTACH their own processes. + +This works around a regression introduced in the default \"security\" policy +found in Linux 3.4 onward that prevents users from attaching to their own +processes--see Yama.txt in the Linux source tree for the rationale. This +sounds like an unacceptable restriction for little or no security +improvement." + (call-with-output-file "/proc/sys/kernel/yama/ptrace_scope" + (lambda (port) + (display 0 port)))) + (define %current-system ;; The system that is current (a symlink.) This is not necessarily the same diff --git a/gnu/system.scm b/gnu/system.scm index a91c7136da..6cf12df604 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -681,6 +681,9 @@ etc." (activate-firmware (string-append #$firmware "/lib/firmware")) + ;; Let users debug their own processes! + (activate-ptrace-attach) + ;; Run the services' activation snippets. ;; TODO: Use 'load-compiled'. (for-each primitive-load '#$actions) From 99af4996ea4822b2da884bd51539b8a6e9863f99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 12 Apr 2015 22:19:18 +0200 Subject: [PATCH 09/10] gnu: man-pages: Update to 3.82. * gnu/packages/man.scm (man-pages): Update to 3.82. --- gnu/packages/man.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gnu/packages/man.scm b/gnu/packages/man.scm index f5bd339100..a92c6dd132 100644 --- a/gnu/packages/man.scm +++ b/gnu/packages/man.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2014 Ludovic Courtès +;;; Copyright © 2012, 2014, 2015 Ludovic Courtès ;;; Copyright © 2014 David Thompson ;;; Copyright © 2015 Ricardo Wurmus ;;; @@ -119,7 +119,7 @@ the traditional flat-text whatis databases.") (define-public man-pages (package (name "man-pages") - (version "3.69") + (version "3.82") (source (origin (method url-fetch) (uri (string-append @@ -127,7 +127,7 @@ the traditional flat-text whatis databases.") version ".tar.xz")) (sha256 (base32 - "18zzmdzjihdnyg4vamk0jp6v6826vrsgal3kqqxvfq9bzyrh8xm2")))) + "1c8q618shf469nfp55qrwjv9630fgq5abfk946xya9hw1bfp6wjl")))) (build-system gnu-build-system) (arguments '(#:phases (alist-delete 'configure %standard-phases) From 4c9050c63d707222730fc6112415f4324e0c7c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 12 Apr 2015 22:34:47 +0200 Subject: [PATCH 10/10] doc: Add example showing how to customize 'nscd-service'. * doc/guix.texi (Name Service Switch): Add link to nss-mdns. Add example show how to pass #:name-services to 'nscd-service'. (Base Services): Add link from 'nscd-service' to the above. * gnu/services/base.scm (nscd-service): Update docstring accordingly. --- doc/guix.texi | 38 +++++++++++++++++++++++++++++++++++--- gnu/services/base.scm | 2 +- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index c0af4cb722..872caa8bf0 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4531,7 +4531,8 @@ the ``message of the day''. Return a service that runs libc's name service cache daemon (nscd) with the given @var{config}---an @code{} object. Optionally, @code{#:name-services} is a list of packages that provide -name service switch (NSS) modules needed by nscd. +name service switch (NSS) modules needed by nscd. @xref{Name Service +Switch}, for an example. @end deffn @defvr {Scheme Variable} %nscd-default-configuration @@ -4898,9 +4899,12 @@ next method in the list. The NSS configuration is given in the @code{name-service-switch} field of @code{operating-system} declarations (@pxref{operating-system Reference, @code{name-service-switch}}). -@c See . +@cindex nss-mdns +@cindex .local, host name lookup As an example, the declaration below configures the NSS to use the -@code{nss-mdns} back-end for host name lookups: +@uref{http://0pointer.de/lennart/projects/nss-mdns/, @code{nss-mdns} +back-end}, which supports host name lookups over multicast DNS (mDNS) +for host names ending in @code{.local}: @example (name-service-switch @@ -4926,6 +4930,34 @@ As an example, the declaration below configures the NSS to use the (name "mdns"))))) @end example +Note that, in this case, in addition to setting the +@code{name-service-switch} of the @code{operating-system} declaration, +@code{nscd-service} must be told where to find the @code{nss-mdns} +shared library (@pxref{Base Services, @code{nscd-service}}). Since the +@code{nscd} service is part of @var{%base-services}, you may want to +customize it by adding this snippet in the operating system +configuration file: + +@example +(use-modules (guix) (gnu)) + +(define %my-base-services + ;; Replace the default nscd service with one that knows + ;; about nss-mdns. + (map (lambda (mservice) + ;; "Bind" the MSERVICE monadic value to inspect it. + (mlet %store-monad ((service mservice)) + (if (member 'nscd (service-provision service)) + (nscd-service (nscd-configuration) + #:name-services (list nss-mdns)) + mservice))) + %base-services)) +@end example + +@noindent +@dots{} and then refer to @var{%my-base-services} instead of +@var{%base-services} in the @code{operating-system} declaration. + The reference for name service switch configuration is given below. It is a direct mapping of the C library's configuration file format, so please refer to the C library manual for more information (@pxref{NSS diff --git a/gnu/services/base.scm b/gnu/services/base.scm index cd1ba0b7b9..956fa7efa0 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -499,7 +499,7 @@ the ``message of the day''." "Return a service that runs libc's name service cache daemon (nscd) with the given @var{config}---an @code{} object. Optionally, @code{#:name-services} is a list of packages that provide name service switch - (NSS) modules needed by nscd." + (NSS) modules needed by nscd. @xref{Name Service Switch}, for an example." (mlet %store-monad ((nscd.conf (nscd.conf-file config))) (return (service (documentation "Run libc's name service cache daemon (nscd).")