summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2025-01-02 22:25:39 +0900
committerJohn Kehayias <john.kehayias@protonmail.com>2025-01-04 19:48:35 -0500
commitd234d9fa94d0c51c9125472e8c46408fa3dc8e18 (patch)
tree41e2f881f6f79a9f77e6d5ac73d2d4e1483a91e3
parentfd5a852e774252b88f55840e6fdc47f21c9e0710 (diff)
nongnu: Add a new nongnu-patches syntax.
* nongnu/packages.scm: New file. Signed-off-by: John Kehayias <john.kehayias@protonmail.com>
-rw-r--r--nongnu/packages.scm66
1 files changed, 66 insertions, 0 deletions
diff --git a/nongnu/packages.scm b/nongnu/packages.scm
new file mode 100644
index 0000000..756f6cf
--- /dev/null
+++ b/nongnu/packages.scm
@@ -0,0 +1,66 @@
1;;; SPDX-License-Identifier: GPL-3.0-or-later
2;;; Copyright © 2015, 2018 Ludovic Courtès <ludo@gnu.org>
3;;; Copyright © 2025 Maxim Cournoyer <maxim.cournoyer@gmail.com>
4
5(define-module (nongnu packages)
6 #:use-module (gnu packages)
7 #:use-module (guix diagnostics)
8 #:use-module (guix i18n)
9 #:use-module (ice-9 match)
10 #:use-module (srfi srfi-34)
11 #:replace (%patch-path
12 search-patch)
13 #:export (nongnu-patches))
14
15;;; Commentary:
16;;;
17;;; This module refines the default value of some parameters from (gnu
18;;; packages) and the syntax/procedures using those. This allows
19;;; 'search-paths' and friends to work without any user intervention.
20;;;
21;;; Code:
22
23(define %nongnu-root-directory
24 ;; This is like %distro-root-directory from (gnu packages), with adjusted
25 ;; paths.
26 (letrec-syntax ((dirname* (syntax-rules ()
27 ((_ file)
28 (dirname file))
29 ((_ file head tail ...)
30 (dirname (dirname* file tail ...)))))
31 (try (syntax-rules ()
32 ((_ (file things ...) rest ...)
33 (match (search-path %load-path file)
34 (#f
35 (try rest ...))
36 (absolute
37 (dirname* absolute things ...))))
38 ((_)
39 #f))))
40 (try ("nongnu/packages/firmware.scm" nongnu/ packages/)
41 ("nongnu/ci.scm" nongnu/))))
42
43(define %patch-path
44 ;; Define it after '%package-module-path' so that '%load-path' contains user
45 ;; directories, allowing patches in $GUIX_PACKAGE_PATH to be found.
46 (make-parameter
47 (map (lambda (directory)
48 (if (string=? directory %nongnu-root-directory)
49 (string-append directory "/nongnu/packages/patches")
50 directory))
51 %load-path)))
52
53;;; XXX: The following must be redefined to make use of the overridden
54;;; %patch-path parameter above.
55(define (search-patch file-name)
56 "Search the patch FILE-NAME. Raise an error if not found."
57 (or (search-path (%patch-path) file-name)
58 (raise (formatted-message (G_ "~a: patch not found")
59 file-name))))
60
61;;; XXX: `search-patches' being syntax, it can't be overridden by the module
62;;; system, or so it seems, so we simply rename it.
63(define-syntax-rule (nongnu-patches file-name ...)
64 "Return the list of absolute file names corresponding to each
65FILE-NAME found in %PATCH-PATH."
66 (list (search-patch file-name) ...))