aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2015, 2016, 2017, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015 Joshua S. Grant <jgrant@parenthetical.io>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;;
;;; 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 <http://www.gnu.org/licenses/>.

(define-module (gnu)
  #:use-module (guix i18n)
  #:use-module (guix diagnostics)
  #:use-module (srfi srfi-34)
  #:use-module (srfi srfi-35)
  #:use-module (ice-9 match)
  #:use-module (guix packages)
  #:use-module (gnu packages)
  #:use-module (gnu services)
  #:export (use-package-modules
            use-service-modules
            use-system-modules))

;;; Commentary:
;;;
;;; This composite module re-exports core parts the (gnu …) public modules.
;;;
;;; Code:

(eval-when (eval load compile)
  (begin
    (define %public-modules
      '((gnu system)
        (gnu system mapped-devices)
        (gnu system file-systems)
        (gnu bootloader)
        (gnu bootloader grub)
        (gnu system keyboard)
        (gnu system pam)
        (gnu system shadow)                       ; 'user-account'
        (gnu system linux-initrd)
        (gnu system nss)
        (gnu services)
        (gnu services base)
        (gnu packages)
        (gnu packages base)
        (guix gexp)))                             ; so gexps can be used

    (for-each (let ((i (module-public-interface (current-module))))
                (lambda (m)
                  (module-use! i (resolve-interface m))))
              %public-modules)))

(define (%try-use-modules modules location make-hint)
  "Attempt to load all of MODULES.  Report errors as coming from LOCATION, a
<location> record, and use MAKE-HINT to produce a fix hint."
  (define (location->string loc)
    (match loc
      (#f "")
      (($ <location> file line column)
       (format #f "~a:~a:~a: " file line column))))

  (for-each (lambda (module)
              (catch 'misc-error
                (lambda ()
                  (process-use-modules `((,module))))
                (lambda _
                  (raise
                   (apply
                    make-compound-condition
                    (formatted-message (G_ "module ~a not found")
                                       module)
                    (condition
                     (&error-location (location location)))
                    (or (and=> (make-hint module) list)
                        '()))))))
            modules))

(define (package-module-hint module)
  (define last-name
    (match module
      ((_ ... last)
       (symbol->string last))))

  (match (find-packages-by-name last-name)
    (()
     (condition
      (&fix-hint
       (hint (G_ "\
You may use @command{guix package --show=foo | grep location} to search
for the location of package @code{foo}.
If you get the line @code{location: gnu/packages/bar.scm:174:2},
add @code{bar} to the @code{use-package-modules} form.")))))
    ((package _ ...)
     (condition
      (&fix-hint
       (hint (format #f (G_ "\
Try adding @code{(use-package-modules ~a)}.")
                     (basename (location-file (package-location package))
                               ".scm"))))))))

(define (service-module-hint module)
  (define last-name
    (match module
      ((_ ... last)
       last)))

  (match (lookup-service-types last-name)
    (()
     (condition
      (&fix-hint
       (hint (format #f (G_ "\
You may use @command{guix system search ~a} to search for a service
matching @code{~a}.
If you get the line @code{location: gnu/services/foo.scm:188:2},
add @code{foo} to the @code{use-service-modules} form.")
                     last-name last-name)))))
    ((package _ ...)
     (condition
      (&fix-hint
       (hint (format #f (G_ "\
Try adding @code{(use-service-modules ~a)}.")
                     (basename (location-file (service-type-location package))
                               ".scm"))))))))

(define-syntax-rule (try-use-modules hint modules ...)
  (eval-when (expand load eval)
    (%try-use-modules '(modules ...)
                      (source-properties->location
                       (current-source-location))
                      hint)))

(define-syntax-rule (use-package-modules module ...)
  (try-use-modules package-module-hint
                   (gnu packages module) ...))

(define-syntax-rule (use-service-modules module ...)
  (try-use-modules service-module-hint
                   (gnu services module) ...))

(define-syntax-rule (use-system-modules module ...)
  (try-use-modules (const #f)                     ;no hint
                   (gnu system module) ...))

;;; gnu.scm ends here
l'>...* doc/contributing.texi (The Perfect Setup): Use HTTPS for ParEdit wiki page. * gnu/packages/emacs-xyz.scm (emacs-wget, emacs-iedit)[home-page]: Use HTTPS. (emacs-transpose-frame)[source]: Likewise. Tobias Geerinckx-Rice 2020-01-17Update email address for Amin Bandali....* .mailmap: Add name and email addresses for Amin Bandali. * gnu/local.mk, gnu/packages/emacs-xyz.scm, gnu/packages/emacs.scm, gnu/packages/fpga.scm, gnu/packages/lean.scm, gnu/packages/maths.scm: Update email address for Amin Bandali. Signed-off-by: Tobias Geerinckx-Rice <me@tobias.gr> Amin Bandali 2020-01-15gnu: emacs-telega: Update to 0.5.4-4....* gnu/packages/emacs-xyz.scm (emacs-telega): Update to 0.5.4-4. [propagated-inputs]: Add emacs-company to provide completions in telega-based buffers. Brett Gilio 2020-01-12gnu: emacs-telega: Update to 0.5.4-3....* gnu/packages/emacs-xyz.scm (emacs-telega): Update to 0.5.4-3. This change reflects several bug fixes that allows for better integration with the latest changes provided by `tdlib` 1.5.4 -- 1.6.0. Brett Gilio 2020-01-11gnu: Add emacs-metal-mercury-mode....* gnu/packages/emacs-xyz.scm (emacs-metal-mercury-mode): New variable. Brett Gilio 2020-01-11gnu: emacs-undo-tree: Update to 0.7.1....* gnu/packages/emacs-xyz.scm (emacs-undo-tree): Update to 0.7.1. Signed-off-by: David Wilson <david@daviwil.com> nixo 2020-01-09gnu: Add emacs-monky....* gnu/packages/emacs-xyz.scm (emacs-monky): New variable. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Joseph LaFreniere 2020-01-09gnu: Add emacs-ebib....* gnu/packages/emacs-xyz.scm (emacs-ebib): New variable. Paul Garlick 2020-01-09gnu: emacs-cyberpunk-theme: Update to 1.21....* gnu/packages/emacs-xyz.scm (emacs-cyberpunk-theme): Update to 1.21. Pierre Neidhardt 2020-01-09gnu: emacs-helm-org: Update to 20191229....* gnu/packages/emacs-xyz.scm (emacs-helm-org): Update to 20191229. Pierre Neidhardt 2020-01-09gnu: emacs-treemacs: Refactor "install-data" phase....* gnu/packages/emacs-xyz.scm (emacs-treemacs)[arguments]: Refactor "install-data" phase. Oleg Pykhalov 2020-01-08gnu: emacs-git-auto-commit-mode: Update to 4.5.0....* gnu/packages/emacs-xyz.scm (emacs-git-auto-commit-mode): Update to 4.5.0. David Wilson 2020-01-08gnu: emacs-undo-tree: Update to 0.7....* gnu/packages/emacs-xyz.scm (emacs-undo-tree): Update to 0.7. David Wilson 2020-01-07gnu: emacs-treemacs: Install icons and scripts....Reported by Christopher Howard <christopher@alaskasi.com>. * gnu/packages/emacs-xyz.scm (emacs-treemacs)[inputs]: Add 'python'. [arguments]: Add 'patch-paths' and 'install-data' phases. Oleg Pykhalov 2020-01-06gnu: Add emacs-helm-clojuredocs....* gnu/packages/emacs-xyz.scm (emacs-helm-clojuredocs): New variable. Pierre Neidhardt 2020-01-06gnu: Add emacs-edn....* gnu/packages/emacs-xyz.scm (emacs-edn): New variable. Pierre Neidhardt 2020-01-06gnu: Add emacs-helm-cider....* gnu/packages/emacs-xyz.scm (emacs-helm-cider): New variable. Pierre Neidhardt 2020-01-06gnu: Add emacs-lsp-lua-emmy....* gnu/packages/emacs-xyz.scm (emacs-lsp-lua-emmy): New variable. Oleg Pykhalov 2020-01-06gnu: Add emacs-lsp-java....* gnu/packages/emacs-xyz.scm (emacs-lsp-java): New variable. Oleg Pykhalov 2020-01-06gnu: Add emacs-treemacs-extra....* gnu/packages/emacs-xyz.scm (emacs-treemacs-extra): New variable. Oleg Pykhalov 2020-01-06gnu: Add emacs-treemacs....* gnu/packages/emacs-xyz.scm (emacs-treemacs): New variable. Oleg Pykhalov 2020-01-06gnu: Add emacs-pfuture....* gnu/packages/emacs-xyz.scm (emacs-pfuture): New variable. Oleg Pykhalov 2020-01-03gnu: Add emacs-company-posframe....* gnu/packages/emacs-xyz.scm (emacs-company-posframe): New variable. Signed-off-by: Brett Gilio <brettg@gnu.org> LaFreniere, Joseph 2020-01-03gnu: emacs-pyvenv: Update to 1.21....* gnu/packages/emacs-xyz.scm (emacs-pyvenv): Update to 1.21. Brett Gilio 2020-01-03gnu: emacs-request: Disable tests....* gnu/packages/emacs-xyz.scm (emacs-request)[arguments]: Disabling test phase as it checks for network access. Brett Gilio 2020-01-03gnu: emacs-request: Update to 0.3.2....* gnu/packages/emacs-xyz.scm (emacs-request): Update to 0.3.2. Brett Gilio 2020-01-03gnu: emacs-doom-themes: Add note about byte-compilation issue....* gnu/packages/emacs-xyz.scm (emacs-doom-themes): The byte-compilation issue has been worked around upstream, but arguably not as effective as the strategy we use in our package. Make a note about this issue, and mark the affecting commit number. Brett Gilio 2020-01-02gnu: emacs-orgalist: Update to 1.11....* gnu/packages/emacs-xyz.scm (emacs-orgalist): Update to 1.11. Nicolas Goaziou 2020-01-02gnu: emacs-doom-themes: Update to 2.1.6-4....* gnu/packages/emacs-xyz.scm (emacs-doom-themes): Update to 2.1.6-4. This commit revision carries several bug fixes. Brett Gilio 2020-01-02gnu: emacs-php-mode: Update to 1.22.2....* gnu/packages/emacs-xyz.scm (emacs-php-mode): Update to 1.22.2. Tobias Geerinckx-Rice 2020-01-01gnu: emacs-telega: Build with support for VoIP....* gnu/packages/emacs-xyz.scm (emacs-telega): Add support for VoIP calling. [arguments]: Add make-flag to build with VoIP. [native-inputs]: Add libtgvoip. Brett Gilio 2020-01-01gnu: emacs-orgalist: Update to 1.10....* gnu/packages/emacs-xyz.scm (emacs-orgalist): Update to 1.10. Nicolas Goaziou 2020-01-01gnu: emacs-magit-todos: Update to 1.4.1....* gnu/packages/emacs-xyz.scm (emacs-magit-todos): Update to 1.4.1. Oleg Pykhalov 2019-12-30gnu: emacs-modus-themes: Update to 0.3.0....* gnu/packages/emacs-xyz.scm (emacs-modus-themes): Update to 0.3.0. Nicolas Goaziou 2019-12-29gnu: emacs-auth-source-pass: Use upstream URL....* gnu/packages/emacs-xyz.scm (emacs-auth-source-pass): Use URL of upstream (rather than forked) repository. Signed-off-by: 宋文武 <iyzsong@member.fsf.org> Joseph LaFreniere 2019-12-28gnu: emacs-shroud: Update to 1.105....* gnu/packages/emacs-xyz.scm (emacs-shroud): Update to 1.105. [source]: Update to new source uri. [build-system]: Switch to gnu-build-system. [native-inputs]: Add autoconf, autotools, texinfo, perl, emacs-minimal. [home-page]: Update to new uri. Signed-off-by: Efraim Flashner <efraim@flashner.co.il> Amar Singh 2019-12-27gnu: emacs-ccls: Revise license....* gnu/packages/emacs-xyz.scm (emacs-ccls): Change license to reflect MIT/Expat-style license. Brett Gilio 2019-12-27gnu: emacs-ccls: Update to 0.1-4....* gnu/packages/emacs-xyz.scm (emacs-ccls): Update to 0.1-4. Adds support for interacting with library folders. Brett Gilio