From 266785d21e9ed3fcbecebea302231cf35e303d66 Mon Sep 17 00:00:00 2001 From: Cyril Roelandt Date: Sun, 27 Dec 2015 03:26:11 +0100 Subject: import: pypi: read requirements from wheels. * doc/guix.tex (Invoking guix import): Mention that the pypi importer works better with "unzip". * guix/import/pypi.scm (latest-wheel-release, wheel-url->extracted-directory): New procedures. * tests/pypi.scm (("pypi->guix-package, wheels"): New test. --- doc/guix.texi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 46d9e77fe6..0a30b52fca 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4545,7 +4545,9 @@ Import metadata from the @uref{https://pypi.python.org/, Python Package Index}@footnote{This functionality requires Guile-JSON to be installed. @xref{Requirements}.}. Information is taken from the JSON-formatted description available at @code{pypi.python.org} and usually includes all -the relevant information, including package dependencies. +the relevant information, including package dependencies. For maximum +efficiency, it is recommended to install the @command{unzip} utility, so +that the importer can unzip Python wheels and gather data from them. The command below imports metadata for the @code{itsdangerous} Python package: -- cgit v1.2.3 From da675305ddf2ba574e309e515d18ae1f778297be Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 15 Jun 2016 10:38:46 +0200 Subject: packages: The 'source' can be any lowerable object. * guix/packages.scm (expand-input): Use 'struct?' instead of 'origin?' when matching SOURCE. (package-source-derivation): Use 'lower-object' instead of 'origin->derivation'. * tests/packages.scm ("package-source-derivation, local-file"): New test. * doc/guix.texi (package Reference): Update 'source' documentation accordingly. --- doc/guix.texi | 8 ++++++-- guix/packages.scm | 10 +++++----- tests/packages.scm | 15 +++++++++++++++ 3 files changed, 26 insertions(+), 7 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 0a30b52fca..18a1960cf7 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2503,8 +2503,12 @@ The name of the package, as a string. The version of the package, as a string. @item @code{source} -An origin object telling how the source code for the package should be -acquired (@pxref{origin Reference}). +An object telling how the source code for the package should be +acquired. Most of the time, this is an @code{origin} object, which +denotes a file fetched from the Internet (@pxref{origin Reference}). It +can also be any other ``file-like'' object such as a @code{local-file}, +which denotes a file from the local file system (@pxref{G-Expressions, +@code{local-file}}). @item @code{build-system} The build system that should be used to build the package (@pxref{Build diff --git a/guix/packages.scm b/guix/packages.scm index 1e816179a6..05a632cf05 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -792,7 +792,7 @@ (define derivation ;; store path, it needs to be added anyway, so it can be used as a ;; source. (list name (intern file))) - (((? string? name) (? origin? source)) + (((? string? name) (? struct? source)) (list name (package-source-derivation store source system))) (x (raise (condition (&package-input-error @@ -1161,12 +1161,12 @@ (define-gexp-compiler (origin-compiler (origin origin?) system target) (origin->derivation origin system)) (define package-source-derivation ;somewhat deprecated - (let ((lower (store-lower origin->derivation))) + (let ((lower (store-lower lower-object))) (lambda* (store source #:optional (system (%current-system))) "Return the derivation or file corresponding to SOURCE, which can be an - or a file name. When SOURCE is a file name, return either the -interned file name (if SOURCE is outside of the store) or SOURCE itself (if -SOURCE is already a store item.)" +a file name or any object handled by 'lower-object', such as an . +When SOURCE is a file name, return either the interned file name (if SOURCE is +outside of the store) or SOURCE itself (if SOURCE is already a store item.)" (match source ((and (? string?) (? direct-store-path?) file) file) diff --git a/tests/packages.scm b/tests/packages.scm index 94e8150b75..d3f432ada2 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -21,6 +21,7 @@ (define-module (test-packages) #:use-module (guix store) #:use-module (guix monads) #:use-module (guix grafts) + #:use-module ((guix gexp) #:select (local-file local-file-file)) #:use-module ((guix utils) ;; Rename the 'location' binding to allow proper syntax ;; matching when setting the 'location' field of a package. @@ -295,6 +296,20 @@ (define read-at (and (direct-store-path? source) (string-suffix? "utils.scm" source)))) +(test-assert "package-source-derivation, local-file" + (let* ((file (local-file "../guix/base32.scm")) + (package (package (inherit (dummy-package "p")) + (source file))) + (source (package-source-derivation %store + (package-source package)))) + (and (store-path? source) + (string-suffix? "base32.scm" source) + (valid-path? %store source) + (equal? (call-with-input-file source get-bytevector-all) + (call-with-input-file + (search-path %load-path "guix/base32.scm") + get-bytevector-all))))) + (unless (network-reachable?) (test-skip 1)) (test-equal "package-source-derivation, snippet" "OK" -- cgit v1.2.3 From 1ec32f4a9d35f235a9947f288370af1445f8ab8b Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 15 Jun 2016 11:51:16 +0200 Subject: store: Add #:select? parameter to 'add-to-store'. * guix/store.scm (write-arg): Remove 'file' case. (true): New procedure. (add-to-store): Add #:select? parameter and honor it. Use hand-coded stub instead of 'operation'. (interned-file): Add #:select? parameter and honor it. * doc/guix.texi (The Store Monad): Adjust 'interned-file' documentation accordingly. --- doc/guix.texi | 7 ++++++- guix/store.scm | 60 ++++++++++++++++++++++++++++++++++++++++------------------ 2 files changed, 48 insertions(+), 19 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 18a1960cf7..97c01be213 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3502,7 +3502,7 @@ resulting text file refers to; it defaults to the empty list. @end deffn @deffn {Monadic Procedure} interned-file @var{file} [@var{name}] @ - [#:recursive? #t] + [#:recursive? #t] [#:select? (const #t)] Return the name of @var{file} once interned in the store. Use @var{name} as its store name, or the basename of @var{file} if @var{name} is omitted. @@ -3511,6 +3511,11 @@ When @var{recursive?} is true, the contents of @var{file} are added recursively; if @var{file} designates a flat file and @var{recursive?} is true, its contents are added, and its permission bits are kept. +When @var{recursive?} is true, call @code{(@var{select?} @var{file} +@var{stat})} for each directory entry, where @var{file} is the entry's +absolute file name and @var{stat} is the result of @code{lstat}; exclude +entries for which @var{select?} does not return true. + The example below adds a file to the store, under two different names: @example diff --git a/guix/store.scm b/guix/store.scm index e3033ee61a..a64016611d 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -263,14 +263,12 @@ (define (read-path-info p) (path-info deriver hash refs registration-time nar-size))) (define-syntax write-arg - (syntax-rules (integer boolean file string string-list string-pairs + (syntax-rules (integer boolean string string-list string-pairs store-path store-path-list base16) ((_ integer arg p) (write-int arg p)) ((_ boolean arg p) (write-int (if arg 1 0) p)) - ((_ file arg p) - (write-file arg p)) ((_ string arg p) (write-string arg p)) ((_ string-list arg p) @@ -653,30 +651,51 @@ (define add-text-to-store (hash-set! cache args path) path)))))) +(define true + ;; Define it once and for all since we use it as a default value for + ;; 'add-to-store' and want to make sure two default values are 'eq?' for the + ;; purposes or memoization. + (lambda (file stat) + #t)) + (define add-to-store ;; A memoizing version of `add-to-store'. This is important because ;; `add-to-store' leads to huge data transfers to the server, and ;; because it's often called many times with the very same argument. - (let ((add-to-store (operation (add-to-store (string basename) - (boolean fixed?) ; obsolete, must be #t - (boolean recursive?) - (string hash-algo) - (file file-name)) - #f - store-path))) - (lambda (server basename recursive? hash-algo file-name) + (let ((add-to-store + (lambda* (server basename recursive? hash-algo file-name + #:key (select? true)) + ;; We don't use the 'operation' macro so we can pass SELECT? to + ;; 'write-file'. + (let ((port (nix-server-socket server))) + (write-int (operation-id add-to-store) port) + (write-string basename port) + (write-int 1 port) ;obsolete, must be #t + (write-int (if recursive? 1 0) port) + (write-string hash-algo port) + (write-file file-name port #:select? select?) + (let loop ((done? (process-stderr server))) + (or done? (loop (process-stderr server)))) + (read-store-path port))))) + (lambda* (server basename recursive? hash-algo file-name + #:key (select? true)) "Add the contents of FILE-NAME under BASENAME to the store. When RECURSIVE? is false, FILE-NAME must designate a regular file--not a directory nor a symlink. When RECURSIVE? is true and FILE-NAME designates a directory, the contents of FILE-NAME are added recursively; if FILE-NAME designates a flat file and RECURSIVE? is true, its contents are added, and its permission -bits are kept. HASH-ALGO must be a string such as \"sha256\"." +bits are kept. HASH-ALGO must be a string such as \"sha256\". + +When RECURSIVE? is true, call (SELECT? FILE STAT) for each directory entry, +where FILE is the entry's absolute file name and STAT is the result of +'lstat'; exclude entries for which SELECT? does not return true." (let* ((st (false-if-exception (lstat file-name))) - (args `(,st ,basename ,recursive? ,hash-algo)) + (args `(,st ,basename ,recursive? ,hash-algo ,select?)) (cache (nix-server-add-to-store-cache server))) (or (and st (hash-ref cache args)) - (let ((path (add-to-store server basename #t recursive? - hash-algo file-name))) + (let ((path (add-to-store server basename recursive? + hash-algo file-name + #:select? select?))) (hash-set! cache args path) path)))))) @@ -1111,16 +1130,21 @@ (define* (text-file name text store))) (define* (interned-file file #:optional name - #:key (recursive? #t)) + #:key (recursive? #t) (select? true)) "Return the name of FILE once interned in the store. Use NAME as its store name, or the basename of FILE if NAME is omitted. When RECURSIVE? is true, the contents of FILE are added recursively; if FILE designates a flat file and RECURSIVE? is true, its contents are added, and its -permission bits are kept." +permission bits are kept. + +When RECURSIVE? is true, call (SELECT? FILE STAT) for each directory entry, +where FILE is the entry's absolute file name and STAT is the result of +'lstat'; exclude entries for which SELECT? does not return true." (lambda (store) (values (add-to-store store (or name (basename file)) - recursive? "sha256" file) + recursive? "sha256" file + #:select? select?) store))) (define build -- cgit v1.2.3 From b78997495474e07083744c1f3ce506ee04488548 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 15 Jun 2016 22:34:20 +0200 Subject: doc: Fix typos. Reported by ozzloy on #guix. * doc/guix.texi (package Reference): Add missing space. (G-Expressions, Invoking guix build): (Common Build Options): Fix typos. --- doc/guix.texi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 97c01be213..f85221d065 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2561,7 +2561,7 @@ one @i{via} its @code{Requires} field. Another example where @code{propagated-inputs} is useful is for languages that lack a facility to record the run-time search path akin to the -@code{RUNPATH}of ELF files; this includes Guile, Python, Perl, GHC, and +@code{RUNPATH} of ELF files; this includes Guile, Python, Perl, GHC, and more. To ensure that libraries written in those languages can find library code they depend on at run time, run-time dependencies must be listed in @code{propagated-inputs} rather than @code{inputs}. @@ -3907,7 +3907,7 @@ like this: @end example In this example, the resulting @file{/gnu/store/@dots{}-profile.sh} file -will references @var{coreutils}, @var{grep}, and @var{sed}, thereby +will reference @var{coreutils}, @var{grep}, and @var{sed}, thereby preventing them from being garbage-collected during its lifetime. @end deffn @@ -4008,7 +4008,7 @@ for among the GNU distribution modules (@pxref{Package Modules}). Alternatively, the @code{--expression} option may be used to specify a Scheme expression that evaluates to a package; this is useful when -disambiguation among several same-named packages or package variants is +disambiguating among several same-named packages or package variants is needed. There may be zero or more @var{options}. The available options are @@ -4040,7 +4040,7 @@ the command-line tools. @item --keep-failed @itemx -K -Keep the build tree of failed builds. Thus, if a build fail, its build +Keep the build tree of failed builds. Thus, if a build fails, its build tree is kept under @file{/tmp}, in a directory whose name is shown at the end of the build log. This is useful when debugging build issues. -- cgit v1.2.3 From 0687fc9cd98e38feab80e2f9c8044e77ad52c7fd Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 16 Jun 2016 00:06:27 +0200 Subject: gexp: Add #:select? parameter to 'local-file'. * guix/gexp.scm ()[select?]: New field. (true): New procedure. (%local-file): Add #:select? and honor it. (local-file): Likewise. * tests/gexp.scm ("local-file, #:select?"): New test. * doc/guix.texi (G-Expressions): Adjust accordingly. --- doc/guix.texi | 7 ++++++- guix/gexp.scm | 20 ++++++++++++++------ tests/gexp.scm | 18 +++++++++++++++++- 3 files changed, 37 insertions(+), 8 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index f85221d065..227d861482 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3804,7 +3804,7 @@ does not have any effect on what the G-expression does. content is directly passed as a string. @deffn {Scheme Procedure} local-file @var{file} [@var{name}] @ - [#:recursive? #f] + [#:recursive? #f] [#:select? (const #t)] Return an object representing local file @var{file} to add to the store; this object can be used in a gexp. If @var{file} is a relative file name, it is looked up relative to the source file where this form appears. @var{file} will be added to @@ -3814,6 +3814,11 @@ When @var{recursive?} is true, the contents of @var{file} are added recursively; designates a flat file and @var{recursive?} is true, its contents are added, and its permission bits are kept. +When @var{recursive?} is true, call @code{(@var{select?} @var{file} +@var{stat})} for each directory entry, where @var{file} is the entry's +absolute file name and @var{stat} is the result of @code{lstat}; exclude +entries for which @var{select?} does not return true. + This is the declarative counterpart of the @code{interned-file} monadic procedure (@pxref{The Store Monad, @code{interned-file}}). @end deffn diff --git a/guix/gexp.scm b/guix/gexp.scm index 8e604ff7cf..2bf1013b3c 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -189,18 +189,21 @@ (define-gexp-compiler (derivation-compiler (drv derivation?) system target) ;; absolute file name. We keep it in a promise to compute it lazily and avoid ;; repeated 'stat' calls. (define-record-type - (%%local-file file absolute name recursive?) + (%%local-file file absolute name recursive? select?) local-file? (file local-file-file) ;string (absolute %local-file-absolute-file-name) ;promise string (name local-file-name) ;string - (recursive? local-file-recursive?)) ;Boolean + (recursive? local-file-recursive?) ;Boolean + (select? local-file-select?)) ;string stat -> Boolean + +(define (true file stat) #t) (define* (%local-file file promise #:optional (name (basename file)) - #:key recursive?) + #:key recursive? (select? true)) ;; This intermediate procedure is part of our ABI, but the underlying ;; %%LOCAL-FILE is not. - (%%local-file file promise name recursive?)) + (%%local-file file promise name recursive? select?)) (define (absolute-file-name file directory) "Return the canonical absolute file name for FILE, which lives in the @@ -222,6 +225,10 @@ (define-syntax-rule (local-file file rest ...) designates a flat file and RECURSIVE? is true, its contents are added, and its permission bits are kept. +When RECURSIVE? is true, call (SELECT? FILE STAT) for each directory entry, +where FILE is the entry's absolute file name and STAT is the result of +'lstat'; exclude entries for which SELECT? does not return true. + This is the declarative counterpart of the 'interned-file' monadic procedure." (%local-file file (delay (absolute-file-name file (current-source-directory))) @@ -235,12 +242,13 @@ (define (local-file-absolute-file-name file) (define-gexp-compiler (local-file-compiler (file local-file?) system target) ;; "Compile" FILE by adding it to the store. (match file - (($ file (= force absolute) name recursive?) + (($ file (= force absolute) name recursive? select?) ;; Canonicalize FILE so that if it's a symlink, it is resolved. Failing ;; to do that, when RECURSIVE? is #t, we could end up creating a dangling ;; symlink in the store, and when RECURSIVE? is #f 'add-to-store' would ;; just throw an error, both of which are inconvenient. - (interned-file absolute name #:recursive? recursive?)))) + (interned-file absolute name + #:recursive? recursive? #:select? select?)))) (define-record-type (%plain-file name content references) diff --git a/tests/gexp.scm b/tests/gexp.scm index db0ffd2fdd..f504b92d84 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -33,7 +33,8 @@ (define-module (test-gexp) #:use-module (rnrs io ports) #:use-module (ice-9 match) #:use-module (ice-9 regex) - #:use-module (ice-9 popen)) + #:use-module (ice-9 popen) + #:use-module (ice-9 ftw)) ;; Test the (guix gexp) module. @@ -132,6 +133,21 @@ (define-syntax-rule (test-assertm name exp) (lambda () (false-if-exception (delete-file link)))))) +(test-assertm "local-file, #:select?" + (mlet* %store-monad ((select? -> (lambda (file stat) + (member (basename file) + '("guix.scm" "tests" + "gexp.scm")))) + (file -> (local-file ".." "directory" + #:recursive? #t + #:select? select?)) + (dir (lower-object file))) + (return (and (store-path? dir) + (equal? (scandir dir) + '("." ".." "guix.scm" "tests")) + (equal? (scandir (string-append dir "/tests")) + '("." ".." "gexp.scm")))))) + (test-assert "one plain file" (let* ((file (plain-file "hi" "Hello, world!")) (exp (gexp (display (ungexp file)))) -- cgit v1.2.3 From 6575183b2c4764c94da6de034dbc432272db1ead Mon Sep 17 00:00:00 2001 From: 宋文武 Date: Tue, 14 Jun 2016 22:01:24 +0800 Subject: gnu: services: Add mysql-service. * gnu/services/database.scm (): New record type. (%mysql-accounts, mysql-service-type): New variables. (mysql-configuration-file, %mysql-activation, mysql-shepherd-services) (mysql-services): New procedures. * doc/guix.texi (Database Services): Document it. --- doc/guix.texi | 23 ++++++++- gnu/services/databases.scm | 119 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 140 insertions(+), 2 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 227d861482..cbecc3e96f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -8001,7 +8001,7 @@ web site} for more information. @node Database Services @subsubsection Database Services -The @code{(gnu services databases)} module provides the following service. +The @code{(gnu services databases)} module provides the following services. @deffn {Scheme Procedure} postgresql-service [#:postgresql postgresql] @ [#:config-file] [#:data-directory ``/var/lib/postgresql/data''] @@ -8013,6 +8013,27 @@ The PostgreSQL daemon loads its runtime configuration from @var{data-directory}. @end deffn +@deffn {Scheme Procedure} mysql-service [#:config (mysql-configuration)] +Return a service that runs @command{mysqld}, the MySQL or MariaDB +database server. + +The optional @var{config} argument specifies the configuration for +@command{mysqld}, which should be a @code{} object. +@end deffn + +@deftp {Data Type} mysql-configuration +Data type representing the configuration of @var{mysql-service}. + +@table @asis +@item @code{mysql} (default: @var{mariadb}) +Package object of the MySQL database server, can be either @var{mariadb} +or @var{mysql}. + +For MySQL, a temorary root password will be displayed at activation time. +For MariaDB, the root password is empty. +@end table +@end deftp + @node Mail Services @subsubsection Mail Services diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm index 690375eb09..e136d1e00b 100644 --- a/gnu/services/databases.scm +++ b/gnu/services/databases.scm @@ -27,7 +27,9 @@ (define-module (gnu services databases) #:use-module (guix records) #:use-module (guix gexp) #:use-module (ice-9 match) - #:export (postgresql-service)) + #:export (postgresql-service + mysql-service + mysql-configuration)) ;;; Commentary: ;;; @@ -143,3 +145,118 @@ (define* (postgresql-service #:key (postgresql postgresql) (postgresql postgresql) (config-file config-file) (data-directory data-directory)))) + + +;;; +;;; MySQL. +;;; + +(define-record-type* + mysql-configuration make-mysql-configuration + mysql-configuration? + (mysql mysql-configuration-mysql (default mariadb))) + +(define %mysql-accounts + (list (user-group + (name "mysql") + (system? #t)) + (user-account + (name "mysql") + (group "mysql") + (system? #t) + (home-directory "/var/empty") + (shell #~(string-append #$shadow "/sbin/nologin"))))) + +(define mysql-configuration-file + (match-lambda + (($ mysql) + (plain-file "my.cnf" "[mysqld] +datadir=/var/lib/mysql +socket=/run/mysqld/mysqld.sock +")))) + +(define (%mysql-activation config) + "Return an activation gexp for the MySQL or MariaDB database server." + (let ((mysql (mysql-configuration-mysql config)) + (my.cnf (mysql-configuration-file config))) + #~(begin + (use-modules (ice-9 popen) + (guix build utils)) + (let* ((mysqld (string-append #$mysql "/bin/mysqld")) + (user (getpwnam "mysql")) + (uid (passwd:uid user)) + (gid (passwd:gid user)) + (datadir "/var/lib/mysql") + (rundir "/run/mysqld")) + (mkdir-p datadir) + (chown datadir uid gid) + (mkdir-p rundir) + (chown rundir uid gid) + ;; Initialize the database when it doesn't exist. + (when (not (file-exists? (string-append datadir "/mysql"))) + (if (string-prefix? "mysql-" (strip-store-file-name #$mysql)) + ;; For MySQL. + (system* mysqld + (string-append "--defaults-file=" #$my.cnf) + "--initialize" + "--user=mysql") + ;; For MariaDB. + ;; XXX: The 'mysql_install_db' script doesn't work directly + ;; due to missing 'mkdir' in PATH. + (let ((p (open-pipe* OPEN_WRITE mysqld + (string-append + "--defaults-file=" #$my.cnf) + "--bootstrap" + "--user=mysql"))) + ;; Create the system database, as does by 'mysql_install_db'. + (display "create database mysql;\n" p) + (display "use mysql;\n" p) + (for-each + (lambda (sql) + (call-with-input-file + (string-append #$mysql "/share/mysql/" sql) + (lambda (in) (dump-port in p)))) + '("mysql_system_tables.sql" + "mysql_performance_tables.sql" + "mysql_system_tables_data.sql" + "fill_help_tables.sql")) + ;; Remove the anonymous user and disable root access from + ;; remote machines, as does by 'mysql_secure_installation'. + (display " +DELETE FROM user WHERE User=''; +DELETE FROM user WHERE User='root' AND + Host NOT IN ('localhost', '127.0.0.1', '::1'); +FLUSH PRIVILEGES; +" p) + (close-pipe p)))))))) + +(define (mysql-shepherd-service config) + (list (shepherd-service + (provision '(mysql)) + (documentation "Run the MySQL server.") + (start (let ((mysql (mysql-configuration-mysql config)) + (my.cnf (mysql-configuration-file config))) + #~(make-forkexec-constructor + (list (string-append #$mysql "/bin/mysqld") + (string-append "--defaults-file=" #$my.cnf)) + #:user "mysql" #:group "mysql"))) + (stop #~(make-kill-destructor))))) + +(define mysql-service-type + (service-type + (name 'mysql) + (extensions + (list (service-extension account-service-type + (const %mysql-accounts)) + (service-extension activation-service-type + %mysql-activation) + (service-extension shepherd-root-service-type + mysql-shepherd-service))))) + +(define* (mysql-service #:key (config (mysql-configuration))) + "Return a service that runs @command{mysqld}, the MySQL or MariaDB +database server. + +The optional @var{config} argument specifies the configuration for +@command{mysqld}, which should be a @code{} object." + (service mysql-service-type config)) -- cgit v1.2.3 From 762e54b7b476982c007c9da96b3b17476a6f1d93 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 16 Jun 2016 14:51:49 +0200 Subject: doc: Recommend against marketing phrases in descriptions. * doc/guix.texi (Synopses and Descriptions): Add note about marketing phrases. --- doc/guix.texi | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index cbecc3e96f..4c8dbd1888 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11172,9 +11172,15 @@ something like ``Manipulate nucleotide sequence alignments'', which hopefully gives the user a better idea of whether this is what they are looking for. -@cindex Texinfo markup, in package descriptions Descriptions should take between five and ten lines. Use full sentences, and avoid using acronyms without first introducing them. +Please avoid marketing phrases such as ``world-leading'', +``industrial-strength'', and ``next-generation'', and avoid superlatives +like ``the most advanced''---they are not helpful to users looking for a +package and may even sound suspicious. Instead, try to be factual, +mentioning use cases and features. + +@cindex Texinfo markup, in package descriptions Descriptions can include Texinfo markup, which is useful to introduce ornaments such as @code{@@code} or @code{@@dfn}, bullet lists, or hyperlinks (@pxref{Overview,,, texinfo, GNU Texinfo}). However you -- cgit v1.2.3 From a1b484654af07303813a215d4e04c0e4e7b199e5 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 17 Jun 2016 11:09:46 +0200 Subject: services: dicod: Add 'interfaces' configuration field. This makes 'dicod' listen on 'localhost' by default, whereas it was previously listening on all the interfaces, which is not a good default security-wise. * gnu/services/dict.scm ()[interfaces]: New field. (dicod-configuration-file)[database->text]: New procedure, with code formerly in 'dicod-configuration->text'. [dicod-configuration->text]: Rename to... [configuration->text]: ... this. Honor 'interfaces'. * doc/guix.texi (Various Services): Document 'interfaces'. --- doc/guix.texi | 5 +++++ gnu/services/dict.scm | 24 ++++++++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 4c8dbd1888..a47d37667e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -9465,6 +9465,11 @@ Data type representing the configuration of dicod. @item @code{dico} (default: @var{dico}) Package object of the GNU Dico dictionary server. +@item @code{interfaces} (default: @var{'("localhost")}) +This is the list of IP addresses and ports and possibly socket file +names to listen to (@pxref{Server Settings, @code{listen} directive,, +dico, GNU Dico Manual}). + @item @code{databases} (default: @var{(list %dicod-database:gcide)}) List of @code{} objects denoting dictionaries to be served. @end table diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm index abab6a3eba..9c06d5713a 100644 --- a/gnu/services/dict.scm +++ b/gnu/services/dict.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016 Sou Bunnbu +;;; Copyright © 2016 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -42,6 +43,8 @@ (define-record-type* dicod-configuration make-dicod-configuration dicod-configuration? (dico dicod-configuration-dico (default dico)) + (interfaces dicod-configuration-interfaces ;list of strings + (default '("localhost"))) (databases dicod-configuration-databases ;; list of (default (list %dicod-database:gcide)))) @@ -72,20 +75,25 @@ (define %dicod-accounts (shell #~(string-append #$shadow "/sbin/nologin"))))) (define (dicod-configuration-file config) - (define dicod-configuration->text + (define database->text (match-lambda - (($ dico databases) - (append-map (match-lambda - (($ name module options) - `(" + (($ name module options) + `(" load-module " ,module "; database { name \"" ,name "\"; handler \"" ,module (string-join (list ,@options) " " 'prefix) "\"; -}\n"))) - databases)))) - (apply mixed-text-file "dicod.conf" (dicod-configuration->text config))) +}\n")))) + + (define configuration->text + (match-lambda + (($ dico (interfaces ...) databases) + (append `("listen (" + ,(string-join interfaces ", ") ");\n") + (append-map database->text databases))))) + + (apply mixed-text-file "dicod.conf" (configuration->text config))) (define %dicod-activation #~(begin -- cgit v1.2.3