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
+0200'>2023-06-28gnu: nyxt: Update to 3.3.0....* gnu/packages/web-browsers.scm (nyxt): Update to 3.3.0. Signed-off-by: Guillaume Le Vaillant <glv@posteo.net> Andre A. Gomes 2023-06-14gnu: nyxt: Update to 3.2.0....* gnu/packages/web-browsers.scm (nyxt): Update to 3.2.0. Signed-off-by: Pierre Neidhardt <mail@ambrevar.xyz> Andre A. Gomes 2023-06-04gnu: lagrange: Update to 1.16.3....* gnu/packages/web-browsers.scm (lagrange): Update to 1.16.3. Efraim Flashner 2023-05-30gnu: nyxt: Update to 3.1.0....* gnu/packages/web-browsers.scm (nyxt): Update to 3.1.0. Signed-off-by: Guillaume Le Vaillant <glv@posteo.net> Andre A. Gomes 2023-05-24gnu: nyxt: Update to 3.0.0....* gnu/packages/web-browsers.scm (nyxt): Update to 3.0.0. Signed-off-by: Pierre Neidhardt <mail@ambrevar.xyz> Andre A. Gomes 2023-05-11gnu: lagrange: Update to 1.15.9....* gnu/packages/web-browsers.scm (lagrange): Update to 1.15.9. Efraim Flashner 2023-04-25Merge remote-tracking branch 'origin/master' into core-updatesAndreas Enge 2023-04-25gnu: lagrange: Update to 1.15.8....* gnu/packages/web-browsers.scm (lagrange): Update to 1.15.8. Nicolas Goaziou 2023-04-22Merge remote-tracking branch 'origin/master' into core-updatesAndreas Enge 2023-04-21gnu: luakit: Further improve style....This is a followup to d3bc56da0475bc643ccb065483c53c6d28cf8e39. * gnu/packages/web-browsers.scm (luakit)[arguments]<#:phases>: Remove unnecessary INPUTS key. [inputs]: Sort alphabetically. Nicolas Goaziou 2023-04-21gnu: luakit: Improve package style....* gnu/packages/web-browsers.scm (luakit)[arguments]<#:tests?>: Properly disable tests instead of deleting CHECK phase. <#:make-flags, #:phases>: Use G-expressions. Remove trailing #T. <#:test-targes>: Add it, for the record. [inputs]: Remove labels. Nicolas Goaziou 2023-04-21gnu: luakit: Update to 2.3.3....* gnu/packages/web-browsers.scm (luakit): Update to 2.3.3 Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr> Raphaël Mélotte 2023-04-14Merge branch 'master' into core-updates....Conflicts: gnu/local.mk gnu/packages/build-tools.scm gnu/packages/certs.scm gnu/packages/check.scm gnu/packages/compression.scm gnu/packages/cups.scm gnu/packages/fontutils.scm gnu/packages/gnuzilla.scm gnu/packages/guile.scm gnu/packages/ibus.scm gnu/packages/image-processing.scm gnu/packages/linux.scm gnu/packages/music.scm gnu/packages/nss.scm gnu/packages/pdf.scm gnu/packages/python-xyz.scm gnu/packages/qt.scm gnu/packages/ruby.scm gnu/packages/shells.scm gnu/packages/tex.scm gnu/packages/video.scm gnu/packages/vulkan.scm gnu/packages/web.scm gnu/packages/webkit.scm gnu/packages/wm.scm Maxim Cournoyer 2023-03-22gnu: lagrange: Update to 1.15.5....* gnu/packages/web-browsers.scm (lagrange): Update to 1.15.5. Efraim Flashner 2023-03-22gnu: qutebrowser: Update to 2.5.4....* gnu/packages/web-browsers.scm (qutebrowser): Update to 2.5.4. Efraim Flashner 2023-03-22gnu: links: Update to 2.29....* gnu/packages/web-browsers.scm (links): Update to 2.29. Efraim Flashner 2023-03-20Merge remote-tracking branch 'origin/master' into core-updatesAndreas Enge 2023-03-16gnu: lagrange: Update to 1.15.4....* gnu/packages/web-browsers.scm (lagrange): Update to 1.15.4. [native-search-paths]: Add share to XDG_DATA_DIRS. Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr> Parnikkapore via Guix-patches via 2023-03-08gnu: lagrange: Update to 1.15.3....* gnu/packages/web-browsers.scm (lagrange): Update to 1.15.3. Efraim Flashner 2023-03-02Merge remote-tracking branch 'savannah/master' into core-updates...Conflicts: gnu/local.mk gnu/packages/autotools.scm gnu/packages/cmake.scm gnu/packages/gnuzilla.scm gnu/packages/haskell.scm gnu/packages/pdf.scm gnu/packages/python-xyz.scm gnu/packages/samba.scm gnu/packages/tex.scm gnu/packages/tls.scm gnu/packages/wxwidgets.scm Christopher Baines 2023-02-28gnu: qutebrowser: Update to 2.5.3....* gnu/packages/web-browsers.scm (qutebrowser): Update to 2.5.3. Efraim Flashner 2023-02-17gnu: Make nothing depend on QtWebKit....This is required for <https://issues.guix.gnu.org/53289>. * gnu/packages/qt.scm (python-pyqt)[inputs]: Remove qtwebkit. (python-pyqt-without-qtwebkit): Remove variable. (python-pyqtwebengine)[inputs]: Replace python-pyqt-without-qtwebkit with python-pyqt. * gnu/packages/backup.scm (vorta)[inputs]: Likewise. * gnu/packages/ebook.scm (calibre)[inputs]: Likewise. [arguments]: Adjust accordingly. * gnu/packages/education.scm (anki)[inputs]: Replace python-pyqt-without-qtwebkit with python-pyqt. * gnu/packages/kde-games.scm (kajongg)[inputs]: Likewise. * gnu/packages/maths.scm (veusz)[inputs]: Likewise. * gnu/packages/music.scm (frescobaldi)[inputs]: Likewise. (picard)[inputs]: Likewise. * gnu/packages/orange.scm (orange)[inputs]: Likewise. * gnu/packages/pdf.scm (flyer-composer)[inputs]: Likewise. * gnu/packages/python-check.scm (python-pytest-qt)[propagated-inputs]: Likewise. * gnu/packages/python-xyz.scm (python-qtconsole)[propagated-inputs]: Likewise. (python-pyqtgraph)[propagated-inputs]: Likewise. * gnu/packages/radio.scm (gnuradio)[inputs]: Likewise. * gnu/packages/video.scm (openshot)[inputs]: Likewise. * gnu/packages/vpn.scm (openconnect-sso)[inputs]: Likewise. * gnu/packages/web-browsers.scm (qutebrowser)[inputs]: Likewise. Leo Famulari 2023-02-17gnu: tinmop: Update to 0.9.9.141....* gnu/packages/web-browsers.scm (tinmop): Update to 0.9.9.141. Signed-off-by: Guillaume Le Vaillant <glv@posteo.net> Sharlatan Hellseher 2023-02-16gnu: Remove unneeded module imports....* gnu/packages/abiword.scm, * gnu/packages/ada.scm, * gnu/packages/agda.scm, * gnu/packages/backup.scm, * gnu/packages/barrier.scm, * gnu/packages/bioinformatics.scm, * gnu/packages/bootstrap.scm, * gnu/packages/bqn.scm, * gnu/packages/c.scm, * gnu/packages/chemistry.scm, * gnu/packages/coq.scm, * gnu/packages/cross-base.scm, * gnu/packages/databases.scm, * gnu/packages/emacs-xyz.scm, * gnu/packages/enlightenment.scm, * gnu/packages/games.scm, * gnu/packages/geo.scm, * gnu/packages/ghostscript.scm, * gnu/packages/gl.scm, * gnu/packages/golang.scm, * gnu/packages/jami.scm, * gnu/packages/java-maths.scm, * gnu/packages/kde-frameworks.scm, * gnu/packages/kde-plasma.scm, * gnu/packages/language.scm, * gnu/packages/libreoffice.scm, * gnu/packages/linphone.scm, * gnu/packages/lisp.scm, * gnu/packages/llvm.scm, * gnu/packages/machine-learning.scm, * gnu/packages/minetest.scm, * gnu/packages/monitoring.scm, * gnu/packages/nfs.scm, * gnu/packages/ocr.scm, * gnu/packages/opencl.scm, * gnu/packages/pdf.scm, * gnu/packages/python-xyz.scm, * gnu/packages/racket.scm, * gnu/packages/rust.scm, * gnu/packages/syncthing.scm, * gnu/packages/syndication.scm, * gnu/packages/telegram.scm, * gnu/packages/vulkan.scm, * gnu/packages/web-browsers.scm, * gnu/packages/web.scm, * gnu/packages/webkit.scm: Remove some unecessary module imports. Efraim Flashner 2023-02-11gnu: lagrange: Update to 1.15.2....* gnu/packages/web-browsers.scm (lagrange): Update to 1.15.2. Nicolas Goaziou 2023-02-04gnu: lagrange: Update to 1.15.1....* gnu/packages/web-browsers.scm (lagrange): Update to 1.15.1. Nicolas Goaziou 2023-01-30Merge remote-tracking branch 'origin/master' into core-updates... Conflicts: doc/guix.texi gnu/local.mk gnu/packages/admin.scm gnu/packages/base.scm gnu/packages/chromium.scm gnu/packages/compression.scm gnu/packages/databases.scm gnu/packages/diffoscope.scm gnu/packages/freedesktop.scm gnu/packages/gnome.scm gnu/packages/gnupg.scm gnu/packages/guile.scm gnu/packages/inkscape.scm gnu/packages/llvm.scm gnu/packages/openldap.scm gnu/packages/pciutils.scm gnu/packages/ruby.scm gnu/packages/samba.scm gnu/packages/sqlite.scm gnu/packages/statistics.scm gnu/packages/syndication.scm gnu/packages/tex.scm gnu/packages/tls.scm gnu/packages/version-control.scm gnu/packages/xml.scm guix/build-system/copy.scm guix/scripts/home.scm Efraim Flashner 2023-01-15gnu: lagrange: Update to 1.14.2....* gnu/packages/web-browsers.scm (lagrange): Update to 1.14.2. Tobias Geerinckx-Rice 2022-12-19gnu: tinmop: Update to 0.9.9.14....* gnu/packages/web-browsers.scm (tinmop): Update to 0.9.9.14. [inputs]: Add imagemagick. Signed-off-by: Guillaume Le Vaillant <glv@posteo.net> cage