01/08: Add (guix self).

2018-04-07 Thread Ludovic Court�s
civodul pushed a commit to branch wip-pull-multiple-derivations
in repository guix.

commit f5b6c6028977377c423b9580e300b3a1de0deffb
Author: Ludovic Courtès 
Date:   Fri Mar 23 15:36:12 2018 +0100

Add (guix self).

* guix/self.scm: New file.
* Makefile.am (MODULES): Add it.
* gnu/packages.scm (%distro-root-directory): Rewrite to try different
directories.
* guix/discovery.scm (guix): Export 'scheme-files'.
---
 Makefile.am|   1 +
 gnu/packages.scm   |  21 +-
 guix/discovery.scm |   3 +-
 guix/self.scm  | 594 +
 4 files changed, 616 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 244069b..e4edd05 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -81,6 +81,7 @@ MODULES = \
   guix/derivations.scm \
   guix/grafts.scm  \
   guix/gnu-maintenance.scm \
+  guix/self.scm\
   guix/upstream.scm\
   guix/licenses.scm\
   guix/glob.scm\
diff --git a/gnu/packages.scm b/gnu/packages.scm
index 97e6cb3..44a56df 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -110,8 +110,25 @@ for system '~a'")
 file-name system)))
 
 (define %distro-root-directory
-  ;; Absolute file name of the module hierarchy.
-  (dirname (search-path %load-path "guix.scm")))
+  ;; Absolute file name of the module hierarchy.  Since (gnu packages …) might
+  ;; live in a directory different from (guix), try to get the best match.
+  (letrec-syntax ((dirname* (syntax-rules ()
+  ((_ file)
+   (dirname file))
+  ((_ file head tail ...)
+   (dirname (dirname* file tail ...)
+  (try  (syntax-rules ()
+  ((_ (file things ...) rest ...)
+   (match (search-path %load-path file)
+ (#f
+  (try rest ...))
+ (absolute
+  (dirname* absolute things ...
+  ((_)
+   #f
+(try ("gnu/packages/base.scm" gnu/ packages/)
+ ("gnu/packages.scm"  gnu/)
+ ("guix.scm"
 
 (define %package-module-path
   ;; Search path for package modules.  Each item must be either a directory
diff --git a/guix/discovery.scm b/guix/discovery.scm
index 7b57579..8ffcf7c 100644
--- a/guix/discovery.scm
+++ b/guix/discovery.scm
@@ -25,7 +25,8 @@
   #:use-module (ice-9 match)
   #:use-module (ice-9 vlist)
   #:use-module (ice-9 ftw)
-  #:export (scheme-modules
+  #:export (scheme-files
+scheme-modules
 fold-modules
 all-modules
 fold-module-public-variables))
diff --git a/guix/self.scm b/guix/self.scm
new file mode 100644
index 000..c7c78e7
--- /dev/null
+++ b/guix/self.scm
@@ -0,0 +1,594 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017, 2018 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 .
+
+(define-module (guix self)
+  #:use-module (guix config)
+  #:use-module (guix i18n)
+  #:use-module (guix modules)
+  #:use-module (guix gexp)
+  #:use-module (guix store)
+  #:use-module (guix monads)
+  #:use-module (guix discovery)
+  #:use-module (guix packages)
+  #:use-module (guix sets)
+  #:use-module (guix utils)
+  #:use-module (guix modules)
+  #:use-module (guix build utils)
+  #:use-module ((guix build compile) #:select (%lightweight-optimizations))
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-9)
+  #:use-module (ice-9 match)
+  #:export (make-config.scm
+compiled-guix
+guix-derivation
+reload-guix))
+
+
+;;;
+;;; Dependency handling.
+;;;
+
+(define* (false-if-wrong-guile package
+   #:optional (guile-version (effective-version)))
+  "Return #f if PACKAGE depends on the \"wrong\" major version of Guile (e.g.,
+2.0 instead of 2.2), otherwise return PACKAGE."
+ 

01/08: Add (guix self).

2018-04-06 Thread Ludovic Court�s
civodul pushed a commit to branch wip-pull-multiple-derivations
in repository guix.

commit f5b6c6028977377c423b9580e300b3a1de0deffb
Author: Ludovic Courtès 
Date:   Fri Mar 23 15:36:12 2018 +0100

Add (guix self).

* guix/self.scm: New file.
* Makefile.am (MODULES): Add it.
* gnu/packages.scm (%distro-root-directory): Rewrite to try different
directories.
* guix/discovery.scm (guix): Export 'scheme-files'.
---
 Makefile.am|   1 +
 gnu/packages.scm   |  21 +-
 guix/discovery.scm |   3 +-
 guix/self.scm  | 594 +
 4 files changed, 616 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 244069b..e4edd05 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -81,6 +81,7 @@ MODULES = \
   guix/derivations.scm \
   guix/grafts.scm  \
   guix/gnu-maintenance.scm \
+  guix/self.scm\
   guix/upstream.scm\
   guix/licenses.scm\
   guix/glob.scm\
diff --git a/gnu/packages.scm b/gnu/packages.scm
index 97e6cb3..44a56df 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -110,8 +110,25 @@ for system '~a'")
 file-name system)))
 
 (define %distro-root-directory
-  ;; Absolute file name of the module hierarchy.
-  (dirname (search-path %load-path "guix.scm")))
+  ;; Absolute file name of the module hierarchy.  Since (gnu packages …) might
+  ;; live in a directory different from (guix), try to get the best match.
+  (letrec-syntax ((dirname* (syntax-rules ()
+  ((_ file)
+   (dirname file))
+  ((_ file head tail ...)
+   (dirname (dirname* file tail ...)
+  (try  (syntax-rules ()
+  ((_ (file things ...) rest ...)
+   (match (search-path %load-path file)
+ (#f
+  (try rest ...))
+ (absolute
+  (dirname* absolute things ...
+  ((_)
+   #f
+(try ("gnu/packages/base.scm" gnu/ packages/)
+ ("gnu/packages.scm"  gnu/)
+ ("guix.scm"
 
 (define %package-module-path
   ;; Search path for package modules.  Each item must be either a directory
diff --git a/guix/discovery.scm b/guix/discovery.scm
index 7b57579..8ffcf7c 100644
--- a/guix/discovery.scm
+++ b/guix/discovery.scm
@@ -25,7 +25,8 @@
   #:use-module (ice-9 match)
   #:use-module (ice-9 vlist)
   #:use-module (ice-9 ftw)
-  #:export (scheme-modules
+  #:export (scheme-files
+scheme-modules
 fold-modules
 all-modules
 fold-module-public-variables))
diff --git a/guix/self.scm b/guix/self.scm
new file mode 100644
index 000..c7c78e7
--- /dev/null
+++ b/guix/self.scm
@@ -0,0 +1,594 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017, 2018 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 .
+
+(define-module (guix self)
+  #:use-module (guix config)
+  #:use-module (guix i18n)
+  #:use-module (guix modules)
+  #:use-module (guix gexp)
+  #:use-module (guix store)
+  #:use-module (guix monads)
+  #:use-module (guix discovery)
+  #:use-module (guix packages)
+  #:use-module (guix sets)
+  #:use-module (guix utils)
+  #:use-module (guix modules)
+  #:use-module (guix build utils)
+  #:use-module ((guix build compile) #:select (%lightweight-optimizations))
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-9)
+  #:use-module (ice-9 match)
+  #:export (make-config.scm
+compiled-guix
+guix-derivation
+reload-guix))
+
+
+;;;
+;;; Dependency handling.
+;;;
+
+(define* (false-if-wrong-guile package
+   #:optional (guile-version (effective-version)))
+  "Return #f if PACKAGE depends on the \"wrong\" major version of Guile (e.g.,
+2.0 instead of 2.2), otherwise return PACKAGE."
+ 

01/08: Add (guix self).

2018-04-06 Thread Ludovic Court�s
civodul pushed a commit to branch wip-pull-multiple-derivations
in repository guix.

commit f5b6c6028977377c423b9580e300b3a1de0deffb
Author: Ludovic Courtès 
Date:   Fri Mar 23 15:36:12 2018 +0100

Add (guix self).

* guix/self.scm: New file.
* Makefile.am (MODULES): Add it.
* gnu/packages.scm (%distro-root-directory): Rewrite to try different
directories.
* guix/discovery.scm (guix): Export 'scheme-files'.
---
 Makefile.am|   1 +
 gnu/packages.scm   |  21 +-
 guix/discovery.scm |   3 +-
 guix/self.scm  | 594 +
 4 files changed, 616 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 244069b..e4edd05 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -81,6 +81,7 @@ MODULES = \
   guix/derivations.scm \
   guix/grafts.scm  \
   guix/gnu-maintenance.scm \
+  guix/self.scm\
   guix/upstream.scm\
   guix/licenses.scm\
   guix/glob.scm\
diff --git a/gnu/packages.scm b/gnu/packages.scm
index 97e6cb3..44a56df 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -110,8 +110,25 @@ for system '~a'")
 file-name system)))
 
 (define %distro-root-directory
-  ;; Absolute file name of the module hierarchy.
-  (dirname (search-path %load-path "guix.scm")))
+  ;; Absolute file name of the module hierarchy.  Since (gnu packages …) might
+  ;; live in a directory different from (guix), try to get the best match.
+  (letrec-syntax ((dirname* (syntax-rules ()
+  ((_ file)
+   (dirname file))
+  ((_ file head tail ...)
+   (dirname (dirname* file tail ...)
+  (try  (syntax-rules ()
+  ((_ (file things ...) rest ...)
+   (match (search-path %load-path file)
+ (#f
+  (try rest ...))
+ (absolute
+  (dirname* absolute things ...
+  ((_)
+   #f
+(try ("gnu/packages/base.scm" gnu/ packages/)
+ ("gnu/packages.scm"  gnu/)
+ ("guix.scm"
 
 (define %package-module-path
   ;; Search path for package modules.  Each item must be either a directory
diff --git a/guix/discovery.scm b/guix/discovery.scm
index 7b57579..8ffcf7c 100644
--- a/guix/discovery.scm
+++ b/guix/discovery.scm
@@ -25,7 +25,8 @@
   #:use-module (ice-9 match)
   #:use-module (ice-9 vlist)
   #:use-module (ice-9 ftw)
-  #:export (scheme-modules
+  #:export (scheme-files
+scheme-modules
 fold-modules
 all-modules
 fold-module-public-variables))
diff --git a/guix/self.scm b/guix/self.scm
new file mode 100644
index 000..c7c78e7
--- /dev/null
+++ b/guix/self.scm
@@ -0,0 +1,594 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017, 2018 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 .
+
+(define-module (guix self)
+  #:use-module (guix config)
+  #:use-module (guix i18n)
+  #:use-module (guix modules)
+  #:use-module (guix gexp)
+  #:use-module (guix store)
+  #:use-module (guix monads)
+  #:use-module (guix discovery)
+  #:use-module (guix packages)
+  #:use-module (guix sets)
+  #:use-module (guix utils)
+  #:use-module (guix modules)
+  #:use-module (guix build utils)
+  #:use-module ((guix build compile) #:select (%lightweight-optimizations))
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-9)
+  #:use-module (ice-9 match)
+  #:export (make-config.scm
+compiled-guix
+guix-derivation
+reload-guix))
+
+
+;;;
+;;; Dependency handling.
+;;;
+
+(define* (false-if-wrong-guile package
+   #:optional (guile-version (effective-version)))
+  "Return #f if PACKAGE depends on the \"wrong\" major version of Guile (e.g.,
+2.0 instead of 2.2), otherwise return PACKAGE."
+ 

01/08: Add (guix self).

2018-04-05 Thread Ludovic Court�s
civodul pushed a commit to branch wip-pull-multiple-derivations
in repository guix.

commit f5b6c6028977377c423b9580e300b3a1de0deffb
Author: Ludovic Courtès 
Date:   Fri Mar 23 15:36:12 2018 +0100

Add (guix self).

* guix/self.scm: New file.
* Makefile.am (MODULES): Add it.
* gnu/packages.scm (%distro-root-directory): Rewrite to try different
directories.
* guix/discovery.scm (guix): Export 'scheme-files'.
---
 Makefile.am|   1 +
 gnu/packages.scm   |  21 +-
 guix/discovery.scm |   3 +-
 guix/self.scm  | 594 +
 4 files changed, 616 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 244069b..e4edd05 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -81,6 +81,7 @@ MODULES = \
   guix/derivations.scm \
   guix/grafts.scm  \
   guix/gnu-maintenance.scm \
+  guix/self.scm\
   guix/upstream.scm\
   guix/licenses.scm\
   guix/glob.scm\
diff --git a/gnu/packages.scm b/gnu/packages.scm
index 97e6cb3..44a56df 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -110,8 +110,25 @@ for system '~a'")
 file-name system)))
 
 (define %distro-root-directory
-  ;; Absolute file name of the module hierarchy.
-  (dirname (search-path %load-path "guix.scm")))
+  ;; Absolute file name of the module hierarchy.  Since (gnu packages …) might
+  ;; live in a directory different from (guix), try to get the best match.
+  (letrec-syntax ((dirname* (syntax-rules ()
+  ((_ file)
+   (dirname file))
+  ((_ file head tail ...)
+   (dirname (dirname* file tail ...)
+  (try  (syntax-rules ()
+  ((_ (file things ...) rest ...)
+   (match (search-path %load-path file)
+ (#f
+  (try rest ...))
+ (absolute
+  (dirname* absolute things ...
+  ((_)
+   #f
+(try ("gnu/packages/base.scm" gnu/ packages/)
+ ("gnu/packages.scm"  gnu/)
+ ("guix.scm"
 
 (define %package-module-path
   ;; Search path for package modules.  Each item must be either a directory
diff --git a/guix/discovery.scm b/guix/discovery.scm
index 7b57579..8ffcf7c 100644
--- a/guix/discovery.scm
+++ b/guix/discovery.scm
@@ -25,7 +25,8 @@
   #:use-module (ice-9 match)
   #:use-module (ice-9 vlist)
   #:use-module (ice-9 ftw)
-  #:export (scheme-modules
+  #:export (scheme-files
+scheme-modules
 fold-modules
 all-modules
 fold-module-public-variables))
diff --git a/guix/self.scm b/guix/self.scm
new file mode 100644
index 000..c7c78e7
--- /dev/null
+++ b/guix/self.scm
@@ -0,0 +1,594 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017, 2018 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 .
+
+(define-module (guix self)
+  #:use-module (guix config)
+  #:use-module (guix i18n)
+  #:use-module (guix modules)
+  #:use-module (guix gexp)
+  #:use-module (guix store)
+  #:use-module (guix monads)
+  #:use-module (guix discovery)
+  #:use-module (guix packages)
+  #:use-module (guix sets)
+  #:use-module (guix utils)
+  #:use-module (guix modules)
+  #:use-module (guix build utils)
+  #:use-module ((guix build compile) #:select (%lightweight-optimizations))
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-9)
+  #:use-module (ice-9 match)
+  #:export (make-config.scm
+compiled-guix
+guix-derivation
+reload-guix))
+
+
+;;;
+;;; Dependency handling.
+;;;
+
+(define* (false-if-wrong-guile package
+   #:optional (guile-version (effective-version)))
+  "Return #f if PACKAGE depends on the \"wrong\" major version of Guile (e.g.,
+2.0 instead of 2.2), otherwise return PACKAGE."
+ 

01/08: Add (guix self).

2018-04-04 Thread Ludovic Court�s
civodul pushed a commit to branch wip-pull-multiple-derivations
in repository guix.

commit bf62a9271048cb43b8bf580f8225e293336aeecf
Author: Ludovic Courtès 
Date:   Fri Mar 23 15:36:12 2018 +0100

Add (guix self).

* guix/self.scm: New file.
* Makefile.am (MODULES): Add it.
* gnu/packages.scm (%distro-root-directory): Rewrite to try different
directories.
* guix/discovery.scm (guix): Export 'scheme-files'.
---
 Makefile.am|   1 +
 gnu/packages.scm   |  21 +-
 guix/discovery.scm |   3 +-
 guix/self.scm  | 590 +
 4 files changed, 612 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 244069b..e4edd05 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -81,6 +81,7 @@ MODULES = \
   guix/derivations.scm \
   guix/grafts.scm  \
   guix/gnu-maintenance.scm \
+  guix/self.scm\
   guix/upstream.scm\
   guix/licenses.scm\
   guix/glob.scm\
diff --git a/gnu/packages.scm b/gnu/packages.scm
index 97e6cb3..44a56df 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -110,8 +110,25 @@ for system '~a'")
 file-name system)))
 
 (define %distro-root-directory
-  ;; Absolute file name of the module hierarchy.
-  (dirname (search-path %load-path "guix.scm")))
+  ;; Absolute file name of the module hierarchy.  Since (gnu packages …) might
+  ;; live in a directory different from (guix), try to get the best match.
+  (letrec-syntax ((dirname* (syntax-rules ()
+  ((_ file)
+   (dirname file))
+  ((_ file head tail ...)
+   (dirname (dirname* file tail ...)
+  (try  (syntax-rules ()
+  ((_ (file things ...) rest ...)
+   (match (search-path %load-path file)
+ (#f
+  (try rest ...))
+ (absolute
+  (dirname* absolute things ...
+  ((_)
+   #f
+(try ("gnu/packages/base.scm" gnu/ packages/)
+ ("gnu/packages.scm"  gnu/)
+ ("guix.scm"
 
 (define %package-module-path
   ;; Search path for package modules.  Each item must be either a directory
diff --git a/guix/discovery.scm b/guix/discovery.scm
index 7b57579..8ffcf7c 100644
--- a/guix/discovery.scm
+++ b/guix/discovery.scm
@@ -25,7 +25,8 @@
   #:use-module (ice-9 match)
   #:use-module (ice-9 vlist)
   #:use-module (ice-9 ftw)
-  #:export (scheme-modules
+  #:export (scheme-files
+scheme-modules
 fold-modules
 all-modules
 fold-module-public-variables))
diff --git a/guix/self.scm b/guix/self.scm
new file mode 100644
index 000..db19522
--- /dev/null
+++ b/guix/self.scm
@@ -0,0 +1,590 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017, 2018 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 .
+
+(define-module (guix self)
+  #:use-module (guix config)
+  #:use-module (guix i18n)
+  #:use-module (guix modules)
+  #:use-module (guix gexp)
+  #:use-module (guix store)
+  #:use-module (guix monads)
+  #:use-module (guix discovery)
+  #:use-module (guix packages)
+  #:use-module (guix sets)
+  #:use-module (guix utils)
+  #:use-module (guix modules)
+  #:use-module (guix build utils)
+  #:use-module ((guix build compile) #:select (%lightweight-optimizations))
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-9)
+  #:use-module (ice-9 match)
+  #:export (make-config.scm
+compiled-guix
+guix-derivation
+reload-guix))
+
+
+;;;
+;;; Dependency handling.
+;;;
+
+(define* (false-if-wrong-guile package
+   #:optional (guile-version (effective-version)))
+  "Return #f if PACKAGE depends on the \"wrong\" major version of Guile (e.g.,
+2.0 instead of 2.2), otherwise return PACKAGE."
+