diff options
author | Ludovic Courtès <ludo@gnu.org> | 2018-03-23 15:36:12 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2018-04-08 17:41:08 +0200 |
commit | eaae07ec2878707744fed76029a28ab9a494fc2e (patch) | |
tree | 6c2cd2dfec1d1f2aa951dcc66907d0c1cbfac137 /gnu/packages.scm | |
parent | 278c16579dfe59833155b1e7678a727e60fa6540 (diff) | |
download | guix-eaae07ec2878707744fed76029a28ab9a494fc2e.tar guix-eaae07ec2878707744fed76029a28ab9a494fc2e.tar.gz |
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'.
Diffstat (limited to 'gnu/packages.scm')
-rw-r--r-- | gnu/packages.scm | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/gnu/packages.scm b/gnu/packages.scm index 97e6cb347f..44a56dfde0 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 |