Commit | Line | Data |
---|---|---|
6f774d48 ML |
1 | #!@GUILE@ \ |
2 | --no-auto-compile -e main -s | |
e49951eb MW |
3 | -*- scheme -*- |
4 | !# | |
5 | ;;; GNU Guix --- Functional package management for GNU | |
6 | ;;; Copyright © 2013 Mark H Weaver <mhw@netris.org> | |
cba386c1 | 7 | ;;; Copyright © 2018 Mathieu Lirzin <mthl@gnu.org> |
e49951eb MW |
8 | ;;; |
9 | ;;; This file is part of GNU Guix. | |
10 | ;;; | |
11 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
12 | ;;; under the terms of the GNU General Public License as published by | |
13 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
14 | ;;; your option) any later version. | |
15 | ;;; | |
16 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
17 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | ;;; GNU General Public License for more details. | |
20 | ;;; | |
21 | ;;; You should have received a copy of the GNU General Public License | |
22 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
23 | ||
24 | ;; IMPORTANT: We must avoid loading any modules from Guix here, | |
25 | ;; because we need to adjust the guile load paths first. | |
26 | ;; It's okay to import modules from core Guile though. | |
cba386c1 | 27 | (use-modules (srfi srfi-26)) |
e49951eb | 28 | |
6f774d48 | 29 | (define-syntax-rule (push! elt v) (set! v (cons elt v))) |
e49951eb | 30 | |
6f774d48 ML |
31 | (define (augment-load-paths!) |
32 | ;; Add installed modules to load-path. | |
33 | (push! "@guilemoduledir@" %load-path) | |
34 | (push! "@guileobjectdir@" %load-compiled-path) | |
e49951eb | 35 | |
6f774d48 ML |
36 | ;; Add modules fetched by 'guix pull' to load-path. |
37 | (let ((updates-dir (and=> (or (getenv "XDG_CONFIG_HOME") | |
38 | (and=> (getenv "HOME") | |
39 | (cut string-append <> "/.config"))) | |
40 | (cut string-append <> "/guix/latest")))) | |
41 | (when (and=> updates-dir file-exists?) | |
42 | ;; XXX: Currently 'guix pull' puts both .scm and .go files in | |
43 | ;; UPDATES-DIR. | |
44 | (push! updates-dir %load-path) | |
45 | (push! updates-dir %load-compiled-path)))) | |
e49951eb | 46 | |
6f774d48 ML |
47 | (define* (main #:optional (args (command-line))) |
48 | (unless (getenv "GUIX_UNINSTALLED") | |
49 | (augment-load-paths!)) | |
7cffaeb6 | 50 | |
6f774d48 ML |
51 | (let ((guix-main (module-ref (resolve-interface '(guix ui)) |
52 | 'guix-main))) | |
53 | (bindtextdomain "guix" "@localedir@") | |
54 | (bindtextdomain "guix-packages" "@localedir@") | |
55 | ;; XXX: It would be more convenient to change it to: | |
56 | ;; (exit (apply guix-main (command-line))) | |
57 | ;; but since the 'guix' command is not updated by 'guix pull', we cannot | |
58 | ;; really do it now. | |
59 | (apply guix-main args))) |