unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob 918f3ecb50fddc8553e8dd1d401602e060140c48 1445 bytes (raw)
name: gnu/packages/patches/janet-guix-janet-path.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
author: Jack Hill <jackhill@jackhill.us>
Upstream discussion: https://github.com/janet-lang/janet/discussions/695
diff --git a/src/boot/boot.janet b/src/boot/boot.janet
index 59e0a016..f9174916 100644
--- a/src/boot/boot.janet
+++ b/src/boot/boot.janet
@@ -3328,6 +3328,30 @@
   (if-let [jp (getenv-alias "JANET_HEADERPATH")] (setdyn :headerpath jp))
   (if-let [jprofile (getenv-alias "JANET_PROFILE")] (setdyn :profilepath jprofile))
 
+  # Guix customization to make Janet respect GUIX_JANET_PATH
+  # environment variable.  GUIX_JANET_PATH is a native search path
+  # added by Guix to tell Janet where to find modules install in the
+  # same profile via Guix packages.  This is done by augmenting
+  # Janet's module/paths array.
+  (def- guix-janet-path (os/getenv "GUIX_JANET_PATH"))
+
+  # The Janet standard extensions and loaders.  List copied from
+  # the calls to module/add-paths in src/boot/boot.janet.
+  (def- default-janet-loaders
+    [[":native:" :native]
+     ["/init.janet" :source]
+     [".janet" :source]
+     [".jimage" :image]])
+
+  (defn- add-guix-path [p]
+    (each [ext loader] default-janet-loaders
+      (array/push module/paths [(string p "/:all:" ext) loader check-is-dep])))
+
+  (if guix-janet-path
+    (each elem (string/split ":" guix-janet-path)
+      (add-guix-path elem)))
+  # End of Guix customization
+
   # Flag handlers
   (def handlers
     {"h" (fn [&]

debug log:

solving 5082beb378 ...
found 5082beb378 in https://yhetil.org/guix-devel/alpine.DEB.2.21.2105150054190.2109@marsh.hcoop.net/

applying [1/1] https://yhetil.org/guix-devel/alpine.DEB.2.21.2105150054190.2109@marsh.hcoop.net/
diff --git a/gnu/packages/patches/janet-guix-janet-path.patch b/gnu/packages/patches/janet-guix-janet-path.patch\r
new file mode 100644\r
index 0000000000..5082beb378\r

1:7: trailing whitespace.
author: Jack Hill <jackhill@jackhill.us>\r
1:8: trailing whitespace.
Upstream discussion: https://github.com/janet-lang/janet/discussions/695\r
1:9: trailing whitespace.
diff --git a/src/boot/boot.janet b/src/boot/boot.janet\r
1:10: trailing whitespace.
index 59e0a016..f9174916 100644\r
1:11: trailing whitespace.
--- a/src/boot/boot.janet\r
Checking patch gnu/packages/patches/janet-guix-janet-path.patch...
Applied patch gnu/packages/patches/janet-guix-janet-path.patch cleanly.
warning: squelched 32 whitespace errors
warning: 37 lines add whitespace errors.

index at:
100644 918f3ecb50fddc8553e8dd1d401602e060140c48	gnu/packages/patches/janet-guix-janet-path.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).