[PATCH 0/4] vim: Detect plugins via search paths.

OpenSubmitted by SeerLite.
Details
3 participants
  • Ludovic Courtès
  • Maxime Devos
  • SeerLite
Owner
unassigned
Severity
normal
S
S
SeerLite wrote on 2 Mar 14:11 +0100
(address . guix-patches@gnu.org)
e2e60850-c335-48b6-bdc2-f6bfc7dbefb3@nixnet.email
Hi!

These patches make Vim use native-search-paths to search for plugins,
instead of manually searching for them in a set of hardcoded paths,
which is how it was done up till now.

I've added the same search paths to Neovim, which unlike Vim, wasn't
auto-detecting Vim plugins at all before.

Neovim also searches XDG_DATA_DIRS for Neovim-specific plugins, so I'd
appreciate if https://issues.guix.gnu.org/48112 was merged too.

Finally, I've updated the package definitions to use the new style with
gexps and label-less inputs.

SeerLite
S
S
SeerLite wrote on 2 Mar 14:17 +0100
[PATCH 1/4] gnu: vim: Use native-search-paths to search for plugins.
(address . 54221@debbugs.gnu.org)(name . SeerLite)(address . seerlite@nixnet.email)
f06b71a730f11b473963e3925d216bf30f7f307e.1646227054.git.seerlite@nixnet.email
Previously a hardcoded list of directories was used, which albeit quite
accurate during normal use, didn't fully respect the active Guix environment
and didn't make use of Guix's search-paths feature.

* gnu/packages/aux-files/guix.vim: Use 'GUIX_VIMRUNTIME' to set the runtimepath.
* gnu/packages/vim.scm (vim)[native-search-paths]: Add search path
specification for 'GUIX_VIMRUNTIME'.
---
gnu/packages/aux-files/guix.vim | 11 ++++-------
gnu/packages/vim.scm | 6 ++++++
2 files changed, 10 insertions(+), 7 deletions(-)

Toggle diff (45 lines)
diff --git a/gnu/packages/aux-files/guix.vim b/gnu/packages/aux-files/guix.vim
index 9397c53701..3c13a16b7d 100644
--- a/gnu/packages/aux-files/guix.vim
+++ b/gnu/packages/aux-files/guix.vim
@@ -1,10 +1,7 @@
-" This appends all of the vim plugins to the end of Vim's runtimepath.
-for directory in ["/run/current-system/profile", $HOME . "/.guix-profile", $HOME ."/.guix-home/profile", $GUIX_PROFILE, $GUIX_ENVIRONMENT]
-    let vimplugins = directory . "/share/vim/vimfiles"
-    if isdirectory(vimplugins)
-        let &rtp = join([&rtp,vimplugins], ',')
-    endif
-endfor
+if !empty($GUIX_VIMRUNTIME)
+    set rtp+=$GUIX_VIMRUNTIME
+endif
+
 " Unconditionally add */after directories last, as intended by upstream
 " TODO: Remove duplicate */after directories
 for directory in [$VIM . "/vimfiles", $HOME ."/.vim"]
diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index 28944dd640..7407ae71d7 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -12,6 +12,7 @@
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
 ;;; Copyright © 2021 Tissevert <tissevert+guix@marvid.fr>
 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
+;;; Copyright © 2022 SeerLite <seerlite@nixnet.email>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -150,6 +151,11 @@ (define-public vim
                (mkdir-p vimdir)
                (copy-file (assoc-ref inputs "guix.vim")
                           (string-append vimdir "/vimrc"))))))))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "GUIX_VIMRUNTIME")
+            (separator ",")
+            (files (list "share/vim/vimfiles")))))
     (inputs
      (list gawk ncurses perl tcsh))                 ; For runtime/tools/vim32
     (native-inputs
-- 
2.34.0
S
S
SeerLite wrote on 2 Mar 14:17 +0100
[PATCH 2/4] gnu: neovim: Search and use installed plugins, like vim.
(address . 54221@debbugs.gnu.org)(name . SeerLite)(address . seerlite@nixnet.email)
39a5e8f9c8f4e3fee5f36824780296f55995ae33.1646227054.git.seerlite@nixnet.email
* gnu/packages/vim.scm (neovim)[phases]{install-guix.vim}: New phase.
[native-search-paths]: Add search path specification for 'GUIX_VIMRUNTIME'.
---
gnu/packages/vim.scm | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

Toggle diff (36 lines)
diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index 7407ae71d7..3997797201 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -714,7 +714,18 @@ (define-public neovim
              ;; doubles its size.  We remove the refirence here.
              (substitute* "cmake/GetCompileFlags.cmake"
                (("\\$\\{CMAKE_C_COMPILER\\}") "/gnu/store/.../bin/gcc"))
-             #t)))))
+             #t))
+         (add-after 'install 'install-guix.vim
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((nvimdir (string-append (assoc-ref outputs "out") "/share/nvim")))
+               (mkdir-p nvimdir)
+               (copy-file (assoc-ref inputs "guix.vim")
+                          (string-append nvimdir "/sysinit.vim"))))))))
+    (native-search-paths
+      (list (search-path-specification
+             (variable "GUIX_VIMRUNTIME")
+             (separator ",")
+             (files (list "share/vim/vimfiles")))))
     (inputs
      `(("libuv" ,libuv)
        ("msgpack" ,msgpack)
@@ -730,7 +741,8 @@ (define-public neovim
     (native-inputs
      `(("pkg-config" ,pkg-config)
        ("gettext" ,gettext-minimal)
-       ("gperf" ,gperf)))
+       ("gperf" ,gperf)
+       ("guix.vim" ,(search-auxiliary-file "guix.vim"))))
     (home-page "https://neovim.io")
     (synopsis "Fork of vim focused on extensibility and agility")
     (description "Neovim is a project that seeks to aggressively
-- 
2.34.0
S
S
SeerLite wrote on 2 Mar 14:17 +0100
[PATCH 3/4] gnu: vim: Update package style.
(address . 54221@debbugs.gnu.org)(name . SeerLite)(address . seerlite@nixnet.email)
da08c31cbea9bc194bf1eea68c3c532e28628310.1646227054.git.seerlite@nixnet.email
* gnu/packages/vim.scm (vim)[native-inputs]: Remove "guix.vim" gexp and remove
labels.
[arguments]: Convert to list of gexps and inline the "guix.vim" gexp.
---
gnu/packages/vim.scm | 127 +++++++++++++++++++++----------------------
1 file changed, 62 insertions(+), 65 deletions(-)

Toggle diff (149 lines)
diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index 3997797201..d5d8b412f7 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -89,68 +89,69 @@ (define-public vim
                "1jppzgmngcdd7jfb5rnkkvf5d47svnjbn7qj4mvjacd9az3c7s9r"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:test-target "test"
-       #:parallel-tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'configure 'patch-absolute-paths
-           (lambda _
-             (substitute* "runtime/tools/mve.awk"
-               (("/usr/bin/nawk") (which "gawk")))
-             (substitute* '("src/testdir/Makefile"
-                            "src/testdir/test_normal.vim"
-                            "src/testdir/test_popupwin.vim"
-                            "src/testdir/test_shell.vim"
-                            "src/testdir/test_system.vim"
-                            "src/testdir/test_terminal.vim"
-                            "src/testdir/test_terminal2.vim")
-               (("/bin/sh") (which "sh")))
-             (substitute* "src/testdir/test_autocmd.vim"
-               (("/bin/kill") (which "kill")))))
-         (add-before 'check 'set-environment-variables
-           (lambda* (#:key inputs #:allow-other-keys)
-             ;; One of the tests tests timezone-dependent functions.
-             (setenv "TZDIR"
-                     (search-input-directory inputs "share/zoneinfo"))
+     (list
+      #:test-target "test"
+      #:parallel-tests? #f
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'configure 'patch-absolute-paths
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "runtime/tools/mve.awk"
+                (("/usr/bin/nawk") (search-input-file inputs "bin/gawk")))
+              (substitute* '("src/testdir/Makefile"
+                             "src/testdir/test_normal.vim"
+                             "src/testdir/test_popupwin.vim"
+                             "src/testdir/test_shell.vim"
+                             "src/testdir/test_system.vim"
+                             "src/testdir/test_terminal.vim"
+                             "src/testdir/test_terminal2.vim")
+                (("/bin/sh") (search-input-file inputs "bin/sh")))
+              (substitute* "src/testdir/test_autocmd.vim"
+                (("/bin/kill") (search-input-file inputs "bin/kill")))))
+          (add-before 'check 'set-environment-variables
+            (lambda* (#:key inputs #:allow-other-keys)
+              ;; One of the tests tests timezone-dependent functions.
+              (setenv "TZDIR"
+                      (search-input-directory inputs "share/zoneinfo"))
 
-             ;; Make sure the TERM environment variable is set for the tests
-             (setenv "TERM" "xterm")))
-         (add-before 'check 'skip-or-fix-failing-tests
-           (lambda _
-             ;; This test assumes that PID 1 is run as root and that the user
-             ;; running the test suite does not have permission to kill(1, 0)
-             ;; it.  This is not true in the build container, where both PID 1
-             ;; and the test suite are run as the same user.  Skip the test.
-             ;; An alternative fix would be to patch the PID used to a random
-             ;; 32-bit value and hope it never shows up in the test environment.
-             (substitute* "src/testdir/test_swap.vim"
-               (("if !IsRoot\\(\\)") "if 0"))
+              ;; Make sure the TERM environment variable is set for the tests
+              (setenv "TERM" "xterm")))
+          (add-before 'check 'skip-or-fix-failing-tests
+            (lambda _
+              ;; This test assumes that PID 1 is run as root and that the user
+              ;; running the test suite does not have permission to kill(1, 0)
+              ;; it.  This is not true in the build container, where both PID 1
+              ;; and the test suite are run as the same user.  Skip the test.
+              ;; An alternative fix would be to patch the PID used to a random
+              ;; 32-bit value and hope it never shows up in the test environment.
+              (substitute* "src/testdir/test_swap.vim"
+                (("if !IsRoot\\(\\)") "if 0"))
 
-             ;; These tests check how the terminal looks after executing some
-             ;; actions.  The path of the bash binary is shown, which results in
-             ;; a difference being detected.  Patching the expected result is
-             ;; non-trivial due to the special format used, so skip the test.
-             (substitute* "src/testdir/test_terminal.vim"
-               ((".*Test_open_term_from_cmd.*" line)
-                (string-append line "return\n"))
-               ((".*Test_terminal_postponed_scrollback.*" line)
-                (string-append line "return\n"))
-               ((".*Test_combining_double_width.*" line)
-                (string-append line "return\n")))
-             (substitute* "src/testdir/test_popupwin.vim"
-               ((".*Test_popup_drag_termwin.*" line)
-                (string-append line "return\n")))))
-         (add-before 'install 'fix-installman.sh
-           (lambda _
-             (substitute* "src/installman.sh"
-               (("/bin/sh")
-                (which "sh")))))
-         (add-after 'install 'install-guix.vim
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let ((vimdir (string-append (assoc-ref outputs "out") "/share/vim")))
-               (mkdir-p vimdir)
-               (copy-file (assoc-ref inputs "guix.vim")
-                          (string-append vimdir "/vimrc"))))))))
+              ;; These tests check how the terminal looks after executing some
+              ;; actions.  The path of the bash binary is shown, which results in
+              ;; a difference being detected.  Patching the expected result is
+              ;; non-trivial due to the special format used, so skip the test.
+              (substitute* "src/testdir/test_terminal.vim"
+                ((".*Test_open_term_from_cmd.*" line)
+                 (string-append line "return\n"))
+                ((".*Test_terminal_postponed_scrollback.*" line)
+                 (string-append line "return\n"))
+                ((".*Test_combining_double_width.*" line)
+                 (string-append line "return\n")))
+              (substitute* "src/testdir/test_popupwin.vim"
+                ((".*Test_popup_drag_termwin.*" line)
+                 (string-append line "return\n")))))
+          (add-before 'install 'fix-installman.sh
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "src/installman.sh"
+                (("/bin/sh")
+                 (search-input-file inputs "bin/sh")))))
+          (add-after 'install 'install-guix.vim
+            (lambda _
+              (let ((vimdir (string-append #$output "/share/vim"))
+                    (vimrc #$(local-file (search-auxiliary-file "guix.vim"))))
+                (mkdir-p vimdir)
+                (copy-file vimrc (string-append vimdir "/vimrc"))))))))
     (native-search-paths
      (list (search-path-specification
             (variable "GUIX_VIMRUNTIME")
@@ -159,11 +160,7 @@ (define-public vim
     (inputs
      (list gawk ncurses perl tcsh))                 ; For runtime/tools/vim32
     (native-inputs
-     `(("libtool" ,libtool)
-       ("guix.vim" ,(search-auxiliary-file "guix.vim"))
-
-       ;; For tests.
-       ("tzdata" ,tzdata-for-tests)))
+     (list libtool tzdata-for-tests))
     (home-page "https://www.vim.org/")
     (synopsis "Text editor based on vi")
     ;; The description shares language with the vim-full package. When making
-- 
2.34.0
S
S
SeerLite wrote on 2 Mar 14:17 +0100
[PATCH 4/4] gnu: neovim: Update package style.
(address . 54221@debbugs.gnu.org)(name . SeerLite)(address . seerlite@nixnet.email)
0ee8ec7a501cf53dc1b70b0ba21f72c0f3dc2d58.1646227054.git.seerlite@nixnet.email
* gnu/packages/vim.scm (neovim)[inputs]: Remove labels.
[native-inputs]: Remove "guix.vim" gexp and remove labels.
[arguments]: Convert to list of gexps, inline the "guix.vim" gexp, adjust lua
input names and remove trailing #t's.
---
gnu/packages/vim.scm | 114 +++++++++++++++++++++----------------------
1 file changed, 55 insertions(+), 59 deletions(-)

Toggle diff (132 lines)
diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index d5d8b412f7..5e6439ed00 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -676,70 +676,66 @@ (define-public neovim
         (base32 "11zyj6jvkwas3n6w1ckj3pk6jf81z1g7ngg4smmwm7c27y2a6f2m"))))
     (build-system cmake-build-system)
     (arguments
-     `(#:modules ((srfi srfi-26)
+     (list
+      #:modules `((srfi srfi-26)
                   (guix build cmake-build-system)
                   (guix build utils))
-       #:configure-flags '("-DPREFER_LUA:BOOL=YES")
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'set-lua-paths
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let* ((lua-version "5.1")
-                    (lua-cpath-spec
-                     (lambda (prefix)
-                       (let ((path (string-append prefix "/lib/lua/" lua-version)))
-                         (string-append path "/?.so;" path "/?/?.so"))))
-                    (lua-path-spec
-                     (lambda (prefix)
-                       (let ((path (string-append prefix "/share/lua/" lua-version)))
-                         (string-append path "/?.lua;" path "/?/?.lua"))))
-                    (lua-inputs (map (cute assoc-ref inputs <>)
-                                     '("lua"
-                                       "lua-luv"
-                                       "lua-lpeg"
-                                       "lua-bitop"
-                                       "lua-libmpack"))))
-               (setenv "LUA_PATH"
-                       (string-join (map lua-path-spec lua-inputs) ";"))
-               (setenv "LUA_CPATH"
-                       (string-join (map lua-cpath-spec lua-inputs) ";"))
-               #t)))
-         (add-after 'unpack 'prevent-embedding-gcc-store-path
-           (lambda _
-             ;; nvim remembers its build options, including the compiler with
-             ;; its complete path.  This adds gcc to the closure of nvim, which
-             ;; doubles its size.  We remove the refirence here.
-             (substitute* "cmake/GetCompileFlags.cmake"
-               (("\\$\\{CMAKE_C_COMPILER\\}") "/gnu/store/.../bin/gcc"))
-             #t))
-         (add-after 'install 'install-guix.vim
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let ((nvimdir (string-append (assoc-ref outputs "out") "/share/nvim")))
-               (mkdir-p nvimdir)
-               (copy-file (assoc-ref inputs "guix.vim")
-                          (string-append nvimdir "/sysinit.vim"))))))))
+      #:configure-flags #~(list "-DPREFER_LUA:BOOL=YES")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'set-lua-paths
+            (lambda* (#:key inputs #:allow-other-keys)
+              (let* ((lua-version "5.1")
+                     (lua-cpath-spec
+                      (lambda (prefix)
+                        (let ((path (string-append prefix "/lib/lua/" lua-version)))
+                          (string-append path "/?.so;" path "/?/?.so"))))
+                     (lua-path-spec
+                      (lambda (prefix)
+                        (let ((path (string-append prefix "/share/lua/" lua-version)))
+                          (string-append path "/?.lua;" path "/?/?.lua"))))
+                     (lua-inputs (map (cute assoc-ref inputs <>)
+                                      '("lua"
+                                        "lua5.1-luv"
+                                        "lua5.1-lpeg"
+                                        "lua5.1-bitop"
+                                        "lua5.1-libmpack"))))
+                (setenv "LUA_PATH"
+                        (string-join (map lua-path-spec lua-inputs) ";"))
+                (setenv "LUA_CPATH"
+                        (string-join (map lua-cpath-spec lua-inputs) ";")))))
+          (add-after 'unpack 'prevent-embedding-gcc-store-path
+            (lambda _
+              ;; nvim remembers its build options, including the compiler with
+              ;; its complete path.  This adds gcc to the closure of nvim, which
+              ;; doubles its size.  We remove the refirence here.
+              (substitute* "cmake/GetCompileFlags.cmake"
+                (("\\$\\{CMAKE_C_COMPILER\\}") "/gnu/store/.../bin/gcc"))))
+          (add-after 'install 'install-guix.vim
+             (lambda _
+               (let ((vimdir (string-append #$output "/share/nvim"))
+                     (vimrc #$(local-file (search-auxiliary-file "guix.vim"))))
+                 (mkdir-p vimdir)
+                 (copy-file vimrc (string-append vimdir "/sysinit.vim"))))))))
     (native-search-paths
-      (list (search-path-specification
-             (variable "GUIX_VIMRUNTIME")
-             (separator ",")
-             (files (list "share/vim/vimfiles")))))
+     (list (search-path-specification
+            (variable "GUIX_VIMRUNTIME")
+            (separator ",")
+            (files (list "share/vim/vimfiles")))))
     (inputs
-     `(("libuv" ,libuv)
-       ("msgpack" ,msgpack)
-       ("libtermkey" ,libtermkey)
-       ("libvterm" ,libvterm)
-       ("unibilium" ,unibilium)
-       ("jemalloc" ,jemalloc)
-       ("lua" ,lua-5.1)
-       ("lua-luv" ,lua5.1-luv)
-       ("lua-lpeg" ,lua5.1-lpeg)
-       ("lua-bitop" ,lua5.1-bitop)
-       ("lua-libmpack" ,lua5.1-libmpack)))
+     (list libuv
+           msgpack
+           libtermkey
+           libvterm
+           unibilium
+           jemalloc
+           lua-5.1
+           lua5.1-luv
+           lua5.1-lpeg
+           lua5.1-bitop
+           lua5.1-libmpack))
     (native-inputs
-     `(("pkg-config" ,pkg-config)
-       ("gettext" ,gettext-minimal)
-       ("gperf" ,gperf)
-       ("guix.vim" ,(search-auxiliary-file "guix.vim"))))
+     (list pkg-config gettext-minimal gperf))
     (home-page "https://neovim.io")
     (synopsis "Fork of vim focused on extensibility and agility")
     (description "Neovim is a project that seeks to aggressively
-- 
2.34.0
M
M
Maxime Devos wrote on 2 Mar 19:25 +0100
Re: [bug#54221] [PATCH 3/4] gnu: vim: Update package style.
e47d69bec06b731cf11c5fddd1f91819ab9920a6.camel@telenet.be
SeerLite via Guix-patches via schreef op wo 02-03-2022 om 10:17 [-
0300]:
Toggle quote (9 lines)
> +          (add-before 'check 'set-environment-variables
> +            (lambda* (#:key inputs #:allow-other-keys)
> +              ;; One of the tests tests timezone-dependent functions.
> +              (setenv "TZDIR"
> +                      (search-input-directory inputs "share/zoneinfo"))
>  
> -             ;; Make sure the TERM environment variable is set for the tests
> -             (setenv "TERM" "xterm")))

The tzdata in in 'native-inputs', not 'inputs', so this code needs to
look in '(or native-inputs inputs)', not 'inputs', otherwise this code
will fail with a '&search-path' exception from 'search-input-directory'
when cross-compiling (untested).

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYh+2jBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7kwkAP9G3w8yY1vDsRJMyliQdr9lH1hX
fDcel4jA65juJAV6cgEA+bmQlr2ZWEwuWKPze++75I50/Xg8355xhgqbHs2PwwI=
=EV5m
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 2 Mar 19:29 +0100
6002b969ed2f353fef0e8fa87d4fc7d01d3344fa.camel@telenet.be
SeerLite via Guix-patches via schreef op wo 02-03-2022 om 10:17 [-
0300]:
Toggle quote (13 lines)
> +            (lambda* (#:key inputs #:allow-other-keys)
> +              [this [bracketed line] seems irrelevant for my comment]
> +              (substitute* '("src/testdir/Makefile"
> +                             "src/testdir/test_normal.vim"
> +                             "src/testdir/test_popupwin.vim"
> +                             "src/testdir/test_shell.vim"
> +                             "src/testdir/test_system.vim"
> +                             "src/testdir/test_terminal.vim"
> +                             "src/testdir/test_terminal2.vim")
> +                (("/bin/sh") (search-input-file inputs "bin/sh")))
> +              (substitute* "src/testdir/test_autocmd.vim"
> +                (("/bin/kill") (search-input-file inputs "bin/kill")))))

This is test stuff, and these binaries do not seem to be present in
'inputs', they would be in the implicit 'native-inputs', so these would
need to search in '(or native-inputs inputs)' instead of 'inputs' to
avoid &search-path exceptions when cross-compiling:

(substitute* '("src/testdir/...")
(("/bin/sh") (search-input-file (or native-inputs inputs) "bin/sh")))

Or simpler, there's a procedure for looking for 'bin/TOOL' in native-
inputs: 'which'!

;; the original code!
(substitute* '("src/testdir/...")
(("/bin/sh") (which "sh")))

Why the change from 'which' to 'search-input-file'?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYh+3mxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7iImAQCExhQsoJf1cYwAYPzKi8OwgAWn
QAKjSAktZX7Fyvm6XwD+PhVlkHCd4zVUhhXZ2uAxto1sZ4/RZgPfLK7mu/F9ug0=
=i+g4
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 2 Mar 19:30 +0100
Re: [bug#54221] [PATCH 2/4] gnu: neovim: Search and use installed plugins, like vim.
fc93bbf1d7bbf2008850002c62344f1dd0bba37c.camel@telenet.be
SeerLite via Guix-patches via schreef op wo 02-03-2022 om 10:17 [-
0300]:
Toggle quote (6 lines)
> +    (native-search-paths
> +      (list (search-path-specification
> +             (variable "GUIX_VIMRUNTIME")
> +             (separator ",")
> +             (files (list "share/vim/vimfiles")))))

this can be simplified:

(native-search-paths (package-native-search-paths vim))

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYh+3yRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7qGaAP93MeIsVVFvd0zphBwq4dE3KMwS
JhJ7zkYltYz6XQ28+QD/SF9nhYDOS2kRqAdVQnwoXlnp3cESmqGqxY9ty8mLTgM=
=wu8X
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 2 Mar 19:33 +0100
Re: [bug#54221] [PATCH 1/4] gnu: vim: Use native-search-paths to search for plugins.
1acd5a1f1b0c8ecdd001f93ca236933de0ea9c23.camel@telenet.be
SeerLite via Guix-patches via schreef op wo 02-03-2022 om 10:17 [-
0300]:
Toggle quote (11 lines)
> -" This appends all of the vim plugins to the end of Vim's runtimepath.
> -for directory in ["/run/current-system/profile", $HOME . "/.guix-profile", $HOME ."/.guix-home/profile", $GUIX_PROFILE, $GUIX_ENVIRONMENT]
> -    let vimplugins = directory . "/share/vim/vimfiles"
> -    if isdirectory(vimplugins)
> -        let &rtp = join([&rtp,vimplugins], ',')
> -    endif
> -endfor
> +if !empty($GUIX_VIMRUNTIME)
> +    set rtp+=$GUIX_VIMRUNTIME
> +endif

Nice! That would make the "--pure" option in
"guix shell --pure vim perhaps-some-vim-plugins ... -- vim" actually
work! (untested, I'm just _looking_ at the patches, not actually
testing them)

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYh+4dxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7pkqAP98Da0Lw+znYLFCBpMM6LG2Wo+S
a8yHpaLPxvu5E3tsbgEAmBm8obMebXzXjeUCNljxUCrvRji5JNYZ8K4iAWJMTgw=
=GaZ2
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 2 Mar 19:35 +0100
Re: [bug#54221] [PATCH 3/4] gnu: vim: Update package style.
588f885b9a2ea8c7533dac470462e7ea0783de73.camel@telenet.be
SeerLite via Guix-patches via schreef op wo 02-03-2022 om 10:17 [-
0300]:
Toggle quote (6 lines)
> +          (add-before 'install 'fix-installman.sh
> +            (lambda* (#:key inputs #:allow-other-keys)
> +              (substitute* "src/installman.sh"
> +                (("/bin/sh")
> +                 (search-input-file inputs "bin/sh")))))

Is "installman.sh" used during the build, or when vim is run?
In the former case, this should look into (or native-inputs
inputs) instead for cross-compilation reasons, and could be simplified
to:

(("/bin/sh") (which "sh"))

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYh+49RccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7rr5AP9l4nQxTD7sGCel0HbUXkwOWeCr
RwrW9mrktDNagW0huwD/V3scM0VU7HDIXw3SsWg5wjbgkGTEqiA6mvHi+zqoUA4=
=lPL1
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 2 Mar 19:40 +0100
Re: [bug#54221] [PATCH 4/4] gnu: neovim: Update package style.
af3ef6fd78174b8eca82aaa81bdf79bb5f038522.camel@telenet.be
SeerLite via Guix-patches via schreef op wo 02-03-2022 om 10:17 [-
0300]:
Toggle quote (2 lines)
> +                     (vimrc #$(local-file (search-auxiliary-file "guix.vim"))))

This stops package transformations from being able to change the
guix.vim used. WDYT of using a variant of 'search-input-file', that
strips the /gnu/store/HASH- part of the store item names and tests
if the remainder equals the string "guix.vim"? Such a procedure does
not currently exist to my knowledge, but it could be written and would
be useful outside the neovim definition.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYh+6GhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7qJmAP95u4leQG1sJfKvlsIqiFgMoHih
5rU+xvbf8a1B6ur87QD+M1IcJH61Rp/cn4cAtFTz6QFIw01ViZyzQierHVL2tgc=
=rUUI
-----END PGP SIGNATURE-----


S
S
SeerLite wrote on 3 Mar 17:49 +0100
Re: [bug#54221] [PATCH 3/4] gnu: vim: Update package style.
dddd6d04-d69a-919b-1d92-e154fc5e1ce2@nixnet.email
Hi, thanks for the review!

On 3/2/22 14:29, Maxime Devos wrote:
Toggle quote (15 lines)
> This is test stuff, and these binaries do not seem to be present in
> 'inputs', they would be in the implicit 'native-inputs', so these would
> need to search in '(or native-inputs inputs)' instead of 'inputs' to
> avoid &search-path exceptions when cross-compiling:
>
> (substitute* '("src/testdir/...")
> (("/bin/sh") (search-input-file (or native-inputs inputs) "bin/sh")))
>
> Or simpler, there's a procedure for looking for 'bin/TOOL' in native-
> inputs: 'which'!
>
> ;; the original code!
> (substitute* '("src/testdir/...")
> (("/bin/sh") (which "sh")))

Whoops, I forgot I made this change.

Toggle quote (2 lines)
> Why the change from 'which' to 'search-input-file'?

The blog post that introduces label-less inputs also introduces
'search-input-file', which made me think they were both part of the
"package definition modernization process".

I asked on IRC if that was the case, and although I didn't get a clear
answer for that, someone told me they preferred using
'search-input-file' because it raises an exception when no file is found.

What do you think about that? Should I stick with 'search-input-file' or
is 'which' alright?

It makes sense that I'd have to use native-inputs though. My bad!
S
S
SeerLite wrote on 3 Mar 18:36 +0100
Re: [bug#54221] [PATCH 4/4] gnu: neovim: Update package style.
f377e4ae-b84c-a88e-ff8e-60a45fd86aaf@nixnet.email
On 3/2/22 14:40, Maxime Devos wrote:
Toggle quote (12 lines)
> SeerLite via Guix-patches via schreef op wo 02-03-2022 om 10:17 [-
> 0300]:
>> +                     (vimrc #$(local-file (search-auxiliary-file "guix.vim"))))
>
> This stops package transformations from being able to change the
> guix.vim used. WDYT of using a variant of 'search-input-file', that
> strips the /gnu/store/HASH- part of the store item names and tests
> if the remainder equals the string "guix.vim"? Such a procedure does
> not currently exist to my knowledge, but it could be written and would
> be useful outside the neovim definition.


Ah, is this also why package inputs are specified explicitly instead of
using gexps?

Is there any benefit to being able to change such a file via a
transformation? Editing the vimrc feels like editing the default
configuration of the package, rather than swapping a dependency. And
that looks odd to me, maybe because I'm more used to package
dependencies as inputs.

The procedure sounds like a good idea, but wouldn't it be easier to just
make `local-file` not prepend the hash to the filename by storing it
inside a parent directory with said hash instead? Is something like that
possible?
S
S
SeerLite wrote on 3 Mar 18:40 +0100
Re: [bug#54221] [PATCH 3/4] gnu: vim: Update package style.
049b8019-cd8a-59c6-f33f-426c5ac2fa3d@nixnet.email
Thank you again for the corrections. Should I send the entire patch
series again or only the patches I want to correct? I'm new to the whole
debbugs/email patch workflow.
M
M
Maxime Devos wrote on 3 Mar 18:46 +0100
fa8ef866b860576a369c3978ee5c7c315bae223c.camel@telenet.be
SeerLite schreef op do 03-03-2022 om 13:49 [-0300]:
Toggle quote (4 lines)
> The blog post that introduces label-less inputs also introduces
> 'search-input-file', which made me think they were both part of the
> "package definition modernization process".

The problem with 'which' was that it looks in 'native-inputs' (+ inputs
when compiling natively), even when we need 'inputs'. To fix this,
adding an 'inputs/native-inputs' argument was proposed
(https://issues.guix.gnu.org/47869). That interface was considered
a bit weird, so then (string-append (assoc-ref ...) "bin/...") was
proposed. That's rather verbose though, so 'search-input-file' was
introduced.

In short, 'search-input-file' was introduced to help with locating
binaries from 'inputs' (at least from my POV, shortly after ludo began
using 'search-input-file' for delabelification).

For looking in native-inputs (compilation tools etc.), I would prefer
'which' above the 'search-input-file' because it's a lot more concise,
though I suppose there is an argument to be made for using 'search-
input-file' for consistency.

There's the downside of not raising an exception in case the file is
not found though. However, there appears to be very few code that
actually relies on the 'return #f' behaviour (search for
'(or (which' and '(if (which'), so I think the behaviour can
be changed without much trouble (on 'core-updates').

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYiD++RccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7rurAP4mpUFtsiTZUpCfqF0YJTcX50Jd
i5qX/4fMw8NF6gQ4DgEAjOs9O1WJ+cUc85zD7Ymy9GSmObdkpZjKvr+roOOZ4QI=
=7vmX
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 16 Mar 15:16 +0100
Re: bug#54221: [PATCH 0/4] vim: Detect plugins via search paths.
(name . SeerLite)(address . seerlite@nixnet.email)
87ilsedltb.fsf_-_@gnu.org
Hi Seerlite,

SeerLite <seerlite@nixnet.email> skribis:

Toggle quote (4 lines)
> Thank you again for the corrections. Should I send the entire patch
> series again or only the patches I want to correct? I'm new to the
> whole debbugs/email patch workflow.

To avoid confusion, it’s more convenient if you resend the entire patch
series; make sure to use ‘git format-patch --subject-prefix="PATCH v2"’.

Thank you!

Ludo’.
S
S
SeerLite wrote on 13 May 04:17 +0200
[PATCH v2 1/2] gnu: vim: Use native-search-paths to search for plugins.
(address . 54221@debbugs.gnu.org)(name . SeerLite)(address . seerlite@nixnet.email)
84af4a68a12d4838fa88e99e6c654930e33694fa.1652408245.git.seerlite@nixnet.email
Previously a hardcoded list of directories was used, which albeit quite
accurate during normal use, didn't fully respect the active Guix environment
and didn't make use of Guix's search-paths feature.

* gnu/packages/aux-files/guix.vim: Use 'GUIX_VIMRUNTIME' to set the runtimepath.
* gnu/packages/vim.scm (vim)[native-search-paths]: Add search path
specification for 'GUIX_VIMRUNTIME'.
---
gnu/packages/aux-files/guix.vim | 11 ++++-------
gnu/packages/vim.scm | 6 ++++++
2 files changed, 10 insertions(+), 7 deletions(-)

Toggle diff (45 lines)
diff --git a/gnu/packages/aux-files/guix.vim b/gnu/packages/aux-files/guix.vim
index 9397c53701..3c13a16b7d 100644
--- a/gnu/packages/aux-files/guix.vim
+++ b/gnu/packages/aux-files/guix.vim
@@ -1,10 +1,7 @@
-" This appends all of the vim plugins to the end of Vim's runtimepath.
-for directory in ["/run/current-system/profile", $HOME . "/.guix-profile", $HOME ."/.guix-home/profile", $GUIX_PROFILE, $GUIX_ENVIRONMENT]
-    let vimplugins = directory . "/share/vim/vimfiles"
-    if isdirectory(vimplugins)
-        let &rtp = join([&rtp,vimplugins], ',')
-    endif
-endfor
+if !empty($GUIX_VIMRUNTIME)
+    set rtp+=$GUIX_VIMRUNTIME
+endif
+
 " Unconditionally add */after directories last, as intended by upstream
 " TODO: Remove duplicate */after directories
 for directory in [$VIM . "/vimfiles", $HOME ."/.vim"]
diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index bb459933b0..0c8e689b5a 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2021 Tissevert <tissevert+guix@marvid.fr>
 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
 ;;; Copyright © 2022 Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com>
+;;; Copyright © 2022 SeerLite <seerlite@nixnet.email>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -147,6 +148,11 @@ (define-public vim
                (mkdir-p vimdir)
                (copy-file (assoc-ref inputs "guix.vim")
                           (string-append vimdir "/vimrc"))))))))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "GUIX_VIMRUNTIME")
+            (separator ",")
+            (files (list "share/vim/vimfiles")))))
     (inputs
      (list gawk ncurses perl tcsh))                 ; For runtime/tools/vim32
     (native-inputs
-- 
2.36.0
S
S
SeerLite wrote on 13 May 04:17 +0200
[PATCH v2 2/2] gnu: neovim: Search and use installed plugins, like vim.
(address . 54221@debbugs.gnu.org)(name . SeerLite)(address . seerlite@nixnet.email)
2d93d3dd08699c95c26aa59783a17d8c5cf8635c.1652408245.git.seerlite@nixnet.email
* gnu/packages/vim.scm (neovim)[phases]{install-guix.vim}: New phase.
[native-search-paths]: Add search path specification for 'GUIX_VIMRUNTIME'.
---
gnu/packages/vim.scm | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

Toggle diff (36 lines)
diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index 0c8e689b5a..530303a318 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -717,7 +717,18 @@ (define-public neovim
              ;; doubles its size.  We remove the refirence here.
              (substitute* "cmake/GetCompileFlags.cmake"
                (("\\$\\{CMAKE_C_COMPILER\\}") "/gnu/store/.../bin/gcc"))
-             #t)))))
+             #t))
+         (add-after 'install 'install-guix.vim
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((nvimdir (string-append (assoc-ref outputs "out") "/share/nvim")))
+               (mkdir-p nvimdir)
+               (copy-file (assoc-ref inputs "guix.vim")
+                          (string-append nvimdir "/sysinit.vim"))))))))
+    (native-search-paths
+      (list (search-path-specification
+             (variable "GUIX_VIMRUNTIME")
+             (separator ",")
+             (files (list "share/vim/vimfiles")))))
     (inputs
      `(("libuv" ,libuv)
        ("msgpack" ,msgpack)
@@ -739,7 +750,8 @@ (define-public neovim
     (native-inputs
      `(("pkg-config" ,pkg-config)
        ("gettext" ,gettext-minimal)
-       ("gperf" ,gperf)))
+       ("gperf" ,gperf)
+       ("guix.vim" ,(search-auxiliary-file "guix.vim"))))
     (home-page "https://neovim.io")
     (synopsis "Fork of vim focused on extensibility and agility")
     (description "Neovim is a project that seeks to aggressively
-- 
2.36.0
S
S
seerlite wrote on 13 May 04:34 +0200
Re: bug#54221: [PATCH 0/4] vim: Detect plugins via search paths.
fec30207-6fbb-4672-2b70-355bb6cfe1c1@nixnet.email
Hi! Sorry for the delay, I've been very busy.

I sent the rebased patches but only the bits that added search paths. There were some updates to both Vim and Neovim since I sent the first patch and I didn't want to deal with fixing the conflicts and re-understanding the style changes I had even forgotten I made. So I'm sending just the functional parts of the patch and hopefully someone else can update the package styles if necessary :)

Oh and I'd like to remind you of this patch: https://issues.guix.gnu.org/48112 which along with my patch would make it so Neovim can finally use both Vim and Neovim-exclusive plugins. I'd appreciate if it got merged too.

SeerLite
S
S
SeerLite wrote on 19 May 02:50 +0200
[PATCH v3 1/2] gnu: vim: Use native-search-paths to search for plugins.
(address . 54221@debbugs.gnu.org)(name . SeerLite)(address . seerlite@nixnet.email)
4736ca5df2bf710fc082eed4f08c1f2ccaf6984f.1652921451.git.seerlite@nixnet.email
Previously a hardcoded list of directories was used, which albeit quite
accurate during normal use, didn't fully respect the active Guix environment
and didn't make use of Guix's search-paths feature.

* gnu/packages/aux-files/guix.vim: Use 'GUIX_VIMRUNTIME' to set the runtimepath.
* gnu/packages/vim.scm (vim)[native-search-paths]: Add search path
specification for 'GUIX_VIMRUNTIME'.
---
gnu/packages/aux-files/guix.vim | 11 ++++-------
gnu/packages/vim.scm | 6 ++++++
2 files changed, 10 insertions(+), 7 deletions(-)

Toggle diff (45 lines)
diff --git a/gnu/packages/aux-files/guix.vim b/gnu/packages/aux-files/guix.vim
index 9397c53701..3c13a16b7d 100644
--- a/gnu/packages/aux-files/guix.vim
+++ b/gnu/packages/aux-files/guix.vim
@@ -1,10 +1,7 @@
-" This appends all of the vim plugins to the end of Vim's runtimepath.
-for directory in ["/run/current-system/profile", $HOME . "/.guix-profile", $HOME ."/.guix-home/profile", $GUIX_PROFILE, $GUIX_ENVIRONMENT]
-    let vimplugins = directory . "/share/vim/vimfiles"
-    if isdirectory(vimplugins)
-        let &rtp = join([&rtp,vimplugins], ',')
-    endif
-endfor
+if !empty($GUIX_VIMRUNTIME)
+    set rtp+=$GUIX_VIMRUNTIME
+endif
+
 " Unconditionally add */after directories last, as intended by upstream
 " TODO: Remove duplicate */after directories
 for directory in [$VIM . "/vimfiles", $HOME ."/.vim"]
diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index caf9ea85b3..222827e539 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2021 Tissevert <tissevert+guix@marvid.fr>
 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
 ;;; Copyright © 2022 Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com>
+;;; Copyright © 2022 SeerLite <seerlite@nixnet.email>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -147,6 +148,11 @@ (define-public vim
                (mkdir-p vimdir)
                (copy-file (assoc-ref inputs "guix.vim")
                           (string-append vimdir "/vimrc"))))))))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "GUIX_VIMRUNTIME")
+            (separator ",")
+            (files (list "share/vim/vimfiles")))))
     (inputs
      (list gawk ncurses perl tcsh))                 ; For runtime/tools/vim32
     (native-inputs
-- 
2.36.0
S
S
SeerLite wrote on 19 May 02:50 +0200
[PATCH v3 2/2] gnu: neovim: Search and use installed plugins, like vim.
(address . 54221@debbugs.gnu.org)(name . SeerLite)(address . seerlite@nixnet.email)
9337edb149eb9234b17f6c00d5cb7d1be4321bae.1652921451.git.seerlite@nixnet.email
* gnu/packages/vim.scm (neovim)[phases]: Add 'install-guix.vim phase
and remove trailing #t's.
[native-search-paths]: Add search path specification for 'GUIX_VIMRUNTIME'.
---
gnu/packages/vim.scm | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)

Toggle diff (36 lines)
diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index 222827e539..18f19c0eba 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -716,16 +716,25 @@ (define-public neovim
                      (setenv "LUA_PATH"
                              (string-join (map lua-path-spec lua-inputs) ";"))
                      (setenv "LUA_CPATH"
-                             (string-join (map lua-cpath-spec lua-inputs) ";"))
-                     #t)))
+                             (string-join (map lua-cpath-spec lua-inputs) ";")))))
                (add-after 'unpack 'prevent-embedding-gcc-store-path
                  (lambda _
                    ;; nvim remembers its build options, including the compiler with
                    ;; its complete path.  This adds gcc to the closure of nvim, which
                    ;; doubles its size.  We remove the refirence here.
                    (substitute* "cmake/GetCompileFlags.cmake"
-                     (("\\$\\{CMAKE_C_COMPILER\\}") "/gnu/store/.../bin/gcc"))
-                   #t)))))
+                     (("\\$\\{CMAKE_C_COMPILER\\}") "/gnu/store/.../bin/gcc"))))
+               (add-after 'install 'install-guix.vim
+                 (lambda* (#:key inputs outputs #:allow-other-keys)
+                   (let ((vimdir (string-append (assoc-ref outputs "out") "/share/nvim"))
+                         (vimrc #$(local-file (search-auxiliary-file "guix.vim"))))
+                     (mkdir-p vimdir)
+                     (copy-file vimrc (string-append nvimdir "/sysinit.vim")))))))
+    (native-search-paths
+      (list (search-path-specification
+             (variable "GUIX_VIMRUNTIME")
+             (separator ",")
+             (files (list "share/vim/vimfiles")))))
     (inputs (list libuv-for-luv
                   msgpack
                   libtermkey
-- 
2.36.0
S
S
SeerLite wrote on 19 May 03:08 +0200
[PATCH v4 1/2] gnu: vim: Use native-search-paths to search for plugins.
(address . 54221@debbugs.gnu.org)(name . SeerLite)(address . seerlite@nixnet.email)
afc30d91028b3b67f52fa7ec83b27b5ca6c3b24d.1652922494.git.seerlite@nixnet.email
Previously a hardcoded list of directories was used, which albeit quite
accurate during normal use, didn't fully respect the active Guix environment
and didn't make use of Guix's search-paths feature.

* gnu/packages/aux-files/guix.vim: Use 'GUIX_VIMRUNTIME' to set the runtimepath.
* gnu/packages/vim.scm (vim)[native-search-paths]: Add search path
specification for 'GUIX_VIMRUNTIME'.
[phases]: Search for tzdata files in the correct input fields.
---
gnu/packages/aux-files/guix.vim | 11 ++++-------
gnu/packages/vim.scm | 8 +++++++-
2 files changed, 11 insertions(+), 8 deletions(-)

Toggle diff (54 lines)
diff --git a/gnu/packages/aux-files/guix.vim b/gnu/packages/aux-files/guix.vim
index 9397c53701..3c13a16b7d 100644
--- a/gnu/packages/aux-files/guix.vim
+++ b/gnu/packages/aux-files/guix.vim
@@ -1,10 +1,7 @@
-" This appends all of the vim plugins to the end of Vim's runtimepath.
-for directory in ["/run/current-system/profile", $HOME . "/.guix-profile", $HOME ."/.guix-home/profile", $GUIX_PROFILE, $GUIX_ENVIRONMENT]
-    let vimplugins = directory . "/share/vim/vimfiles"
-    if isdirectory(vimplugins)
-        let &rtp = join([&rtp,vimplugins], ',')
-    endif
-endfor
+if !empty($GUIX_VIMRUNTIME)
+    set rtp+=$GUIX_VIMRUNTIME
+endif
+
 " Unconditionally add */after directories last, as intended by upstream
 " TODO: Remove duplicate */after directories
 for directory in [$VIM . "/vimfiles", $HOME ."/.vim"]
diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index caf9ea85b3..011521babd 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2021 Tissevert <tissevert+guix@marvid.fr>
 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
 ;;; Copyright © 2022 Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com>
+;;; Copyright © 2022 SeerLite <seerlite@nixnet.email>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -111,7 +112,7 @@ (define-public vim
            (lambda* (#:key inputs #:allow-other-keys)
              ;; One of the tests tests timezone-dependent functions.
              (setenv "TZDIR"
-                     (search-input-directory inputs "share/zoneinfo"))
+                     (search-input-directory (or native-inputs inputs) "share/zoneinfo"))
 
              ;; Make sure the TERM environment variable is set for the tests
              (setenv "TERM" "xterm")))
@@ -147,6 +148,11 @@ (define-public vim
                (mkdir-p vimdir)
                (copy-file (assoc-ref inputs "guix.vim")
                           (string-append vimdir "/vimrc"))))))))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "GUIX_VIMRUNTIME")
+            (separator ",")
+            (files (list "share/vim/vimfiles")))))
     (inputs
      (list gawk ncurses perl tcsh))                 ; For runtime/tools/vim32
     (native-inputs
-- 
2.36.0
S
S
SeerLite wrote on 19 May 03:08 +0200
[PATCH v4 2/2] gnu: neovim: Search and use installed plugins, like vim.
(address . 54221@debbugs.gnu.org)(name . SeerLite)(address . seerlite@nixnet.email)
1548e2407322432808e83389d07cfc6b92379cae.1652922494.git.seerlite@nixnet.email
* gnu/packages/vim.scm (neovim)[phases]: Add 'install-guix.vim phase
and remove trailing #t's.
[native-search-paths]: Add search path specification for 'GUIX_VIMRUNTIME'.
---
gnu/packages/vim.scm | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)

Toggle diff (36 lines)
diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index 011521babd..7697a03ef6 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -716,16 +716,25 @@ (define-public neovim
                      (setenv "LUA_PATH"
                              (string-join (map lua-path-spec lua-inputs) ";"))
                      (setenv "LUA_CPATH"
-                             (string-join (map lua-cpath-spec lua-inputs) ";"))
-                     #t)))
+                             (string-join (map lua-cpath-spec lua-inputs) ";")))))
                (add-after 'unpack 'prevent-embedding-gcc-store-path
                  (lambda _
                    ;; nvim remembers its build options, including the compiler with
                    ;; its complete path.  This adds gcc to the closure of nvim, which
                    ;; doubles its size.  We remove the refirence here.
                    (substitute* "cmake/GetCompileFlags.cmake"
-                     (("\\$\\{CMAKE_C_COMPILER\\}") "/gnu/store/.../bin/gcc"))
-                   #t)))))
+                     (("\\$\\{CMAKE_C_COMPILER\\}") "/gnu/store/.../bin/gcc"))))
+               (add-after 'install 'install-guix.vim
+                 (lambda* (#:key inputs outputs #:allow-other-keys)
+                   (let ((vimdir (string-append (assoc-ref outputs "out") "/share/nvim"))
+                         (vimrc #$(local-file (search-auxiliary-file "guix.vim"))))
+                     (mkdir-p vimdir)
+                     (copy-file vimrc (string-append nvimdir "/sysinit.vim")))))))
+    (native-search-paths
+      (list (search-path-specification
+             (variable "GUIX_VIMRUNTIME")
+             (separator ",")
+             (files (list "share/vim/vimfiles")))))
     (inputs (list libuv-for-luv
                   msgpack
                   libtermkey
-- 
2.36.0
S
S
SeerLite wrote on 19 May 03:11 +0200
d9b7e0bc-4b3f-2319-fa91-ec7d3994176c@nixnet.email
Rebased on top of 182b25fb (https://issues.guix.gnu.org/55045) and
fixed the wrong lookup for tzdata files in inputs instead of
native-inputs again, as Maxime had pointed out (something I thought was
caused by my previous style/gexp patch when it was not). I wasn't able
to figure out how to test it though.

SeerLite
S
S
SeerLite wrote on 19 May 03:14 +0200
[PATCH v5 1/2] gnu: vim: Use native-search-paths to search for plugins.
(address . 54221@debbugs.gnu.org)(name . SeerLite)(address . seerlite@nixnet.email)
afc30d91028b3b67f52fa7ec83b27b5ca6c3b24d.1652922844.git.seerlite@nixnet.email
Previously a hardcoded list of directories was used, which albeit quite
accurate during normal use, didn't fully respect the active Guix environment
and didn't make use of Guix's search-paths feature.

* gnu/packages/aux-files/guix.vim: Use 'GUIX_VIMRUNTIME' to set the runtimepath.
* gnu/packages/vim.scm (vim)[native-search-paths]: Add search path
specification for 'GUIX_VIMRUNTIME'.
[phases]: Search for tzdata files in the correct input fields.
---
gnu/packages/aux-files/guix.vim | 11 ++++-------
gnu/packages/vim.scm | 8 +++++++-
2 files changed, 11 insertions(+), 8 deletions(-)

Toggle diff (54 lines)
diff --git a/gnu/packages/aux-files/guix.vim b/gnu/packages/aux-files/guix.vim
index 9397c53701..3c13a16b7d 100644
--- a/gnu/packages/aux-files/guix.vim
+++ b/gnu/packages/aux-files/guix.vim
@@ -1,10 +1,7 @@
-" This appends all of the vim plugins to the end of Vim's runtimepath.
-for directory in ["/run/current-system/profile", $HOME . "/.guix-profile", $HOME ."/.guix-home/profile", $GUIX_PROFILE, $GUIX_ENVIRONMENT]
-    let vimplugins = directory . "/share/vim/vimfiles"
-    if isdirectory(vimplugins)
-        let &rtp = join([&rtp,vimplugins], ',')
-    endif
-endfor
+if !empty($GUIX_VIMRUNTIME)
+    set rtp+=$GUIX_VIMRUNTIME
+endif
+
 " Unconditionally add */after directories last, as intended by upstream
 " TODO: Remove duplicate */after directories
 for directory in [$VIM . "/vimfiles", $HOME ."/.vim"]
diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index caf9ea85b3..011521babd 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2021 Tissevert <tissevert+guix@marvid.fr>
 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
 ;;; Copyright © 2022 Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com>
+;;; Copyright © 2022 SeerLite <seerlite@nixnet.email>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -111,7 +112,7 @@ (define-public vim
            (lambda* (#:key inputs #:allow-other-keys)
              ;; One of the tests tests timezone-dependent functions.
              (setenv "TZDIR"
-                     (search-input-directory inputs "share/zoneinfo"))
+                     (search-input-directory (or native-inputs inputs) "share/zoneinfo"))
 
              ;; Make sure the TERM environment variable is set for the tests
              (setenv "TERM" "xterm")))
@@ -147,6 +148,11 @@ (define-public vim
                (mkdir-p vimdir)
                (copy-file (assoc-ref inputs "guix.vim")
                           (string-append vimdir "/vimrc"))))))))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "GUIX_VIMRUNTIME")
+            (separator ",")
+            (files (list "share/vim/vimfiles")))))
     (inputs
      (list gawk ncurses perl tcsh))                 ; For runtime/tools/vim32
     (native-inputs
-- 
2.36.0
S
S
SeerLite wrote on 19 May 03:14 +0200
[PATCH v5 2/2] gnu: neovim: Search and use installed plugins, like vim.
(address . 54221@debbugs.gnu.org)(name . SeerLite)(address . seerlite@nixnet.email)
82f09ad897560b759cd3b86ef7a2d3449fd0100f.1652922844.git.seerlite@nixnet.email
* gnu/packages/vim.scm (neovim)[phases]: Add 'install-guix.vim phase
and remove trailing #t's.
[native-search-paths]: Add search path specification for 'GUIX_VIMRUNTIME'.
---
gnu/packages/vim.scm | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)

Toggle diff (36 lines)
diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index 011521babd..14e6f86544 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -716,16 +716,25 @@ (define-public neovim
                      (setenv "LUA_PATH"
                              (string-join (map lua-path-spec lua-inputs) ";"))
                      (setenv "LUA_CPATH"
-                             (string-join (map lua-cpath-spec lua-inputs) ";"))
-                     #t)))
+                             (string-join (map lua-cpath-spec lua-inputs) ";")))))
                (add-after 'unpack 'prevent-embedding-gcc-store-path
                  (lambda _
                    ;; nvim remembers its build options, including the compiler with
                    ;; its complete path.  This adds gcc to the closure of nvim, which
                    ;; doubles its size.  We remove the refirence here.
                    (substitute* "cmake/GetCompileFlags.cmake"
-                     (("\\$\\{CMAKE_C_COMPILER\\}") "/gnu/store/.../bin/gcc"))
-                   #t)))))
+                     (("\\$\\{CMAKE_C_COMPILER\\}") "/gnu/store/.../bin/gcc"))))
+               (add-after 'install 'install-guix.vim
+                 (lambda* (#:key inputs outputs #:allow-other-keys)
+                   (let ((vimdir (string-append (assoc-ref outputs "out") "/share/nvim"))
+                         (vimrc #$(local-file (search-auxiliary-file "guix.vim"))))
+                     (mkdir-p vimdir)
+                     (copy-file vimrc (string-append nvimdir "/sysinit.vim"))))))))
+    (native-search-paths
+      (list (search-path-specification
+             (variable "GUIX_VIMRUNTIME")
+             (separator ",")
+             (files (list "share/vim/vimfiles")))))
     (inputs (list libuv-for-luv
                   msgpack
                   libtermkey
-- 
2.36.0
S
S
SeerLite wrote on 19 May 03:15 +0200
(address . 54221@debbugs.gnu.org)
9be1ffe3-0455-0995-f91d-7c6c8d68a39d@nixnet.email
Fixed missing ')'. Whoops.

SeerLite
S
S
SeerLite wrote on 24 May 02:41 +0200
[PATCH v6 1/2] gnu: vim: Use native-search-paths to search for plugins.
(address . 54221@debbugs.gnu.org)(name . SeerLite)(address . seerlite@nixnet.email)
81321483b3ea03870a94a5fce3931ba176269f73.1653352914.git.seerlite@nixnet.email
Previously a hardcoded list of directories was used, which albeit quite
accurate during normal use, didn't fully respect the active Guix environment
and didn't make use of Guix's search-paths feature.

* gnu/packages/aux-files/guix.vim: Use 'GUIX_VIMRUNTIME' to set the runtimepath.
* gnu/packages/vim.scm (vim)[native-search-paths]: Add search path
specification for 'GUIX_VIMRUNTIME'.
[phases]: Search for tzdata files in the correct input fields.
---
gnu/packages/aux-files/guix.vim | 11 ++++-------
gnu/packages/vim.scm | 10 ++++++++--
2 files changed, 12 insertions(+), 9 deletions(-)

Toggle diff (58 lines)
diff --git a/gnu/packages/aux-files/guix.vim b/gnu/packages/aux-files/guix.vim
index 9397c53701..3c13a16b7d 100644
--- a/gnu/packages/aux-files/guix.vim
+++ b/gnu/packages/aux-files/guix.vim
@@ -1,10 +1,7 @@
-" This appends all of the vim plugins to the end of Vim's runtimepath.
-for directory in ["/run/current-system/profile", $HOME . "/.guix-profile", $HOME ."/.guix-home/profile", $GUIX_PROFILE, $GUIX_ENVIRONMENT]
-    let vimplugins = directory . "/share/vim/vimfiles"
-    if isdirectory(vimplugins)
-        let &rtp = join([&rtp,vimplugins], ',')
-    endif
-endfor
+if !empty($GUIX_VIMRUNTIME)
+    set rtp+=$GUIX_VIMRUNTIME
+endif
+
 " Unconditionally add */after directories last, as intended by upstream
 " TODO: Remove duplicate */after directories
 for directory in [$VIM . "/vimfiles", $HOME ."/.vim"]
diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index caf9ea85b3..791aecbb83 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2021 Tissevert <tissevert+guix@marvid.fr>
 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
 ;;; Copyright © 2022 Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com>
+;;; Copyright © 2022 SeerLite <seerlite@nixnet.email>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -108,10 +109,10 @@ (define-public vim
              (substitute* "src/testdir/test_autocmd.vim"
                (("/bin/kill") (which "kill")))))
          (add-before 'check 'set-environment-variables
-           (lambda* (#:key inputs #:allow-other-keys)
+           (lambda* (#:key native-inputs inputs #:allow-other-keys)
              ;; One of the tests tests timezone-dependent functions.
              (setenv "TZDIR"
-                     (search-input-directory inputs "share/zoneinfo"))
+                     (search-input-directory (or native-inputs inputs) "share/zoneinfo"))
 
              ;; Make sure the TERM environment variable is set for the tests
              (setenv "TERM" "xterm")))
@@ -147,6 +148,11 @@ (define-public vim
                (mkdir-p vimdir)
                (copy-file (assoc-ref inputs "guix.vim")
                           (string-append vimdir "/vimrc"))))))))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "GUIX_VIMRUNTIME")
+            (separator ",")
+            (files (list "share/vim/vimfiles")))))
     (inputs
      (list gawk ncurses perl tcsh))                 ; For runtime/tools/vim32
     (native-inputs
-- 
2.36.0
S
S
SeerLite wrote on 24 May 02:41 +0200
[PATCH v6 2/2] gnu: neovim: Search and use installed plugins, like vim.
(address . 54221@debbugs.gnu.org)(name . SeerLite)(address . seerlite@nixnet.email)
81b3246dc028d82086a94bef402cb539a5b7184a.1653352914.git.seerlite@nixnet.email
* gnu/packages/vim.scm (neovim)[phases]: Add 'install-guix.vim phase
and remove trailing #t's.
[native-search-paths]: Add search path specification for 'GUIX_VIMRUNTIME'.
---
gnu/packages/vim.scm | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)

Toggle diff (36 lines)
diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index 791aecbb83..5e3cb4484d 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -716,16 +716,25 @@ (define-public neovim
                      (setenv "LUA_PATH"
                              (string-join (map lua-path-spec lua-inputs) ";"))
                      (setenv "LUA_CPATH"
-                             (string-join (map lua-cpath-spec lua-inputs) ";"))
-                     #t)))
+                             (string-join (map lua-cpath-spec lua-inputs) ";")))))
                (add-after 'unpack 'prevent-embedding-gcc-store-path
                  (lambda _
                    ;; nvim remembers its build options, including the compiler with
                    ;; its complete path.  This adds gcc to the closure of nvim, which
                    ;; doubles its size.  We remove the refirence here.
                    (substitute* "cmake/GetCompileFlags.cmake"
-                     (("\\$\\{CMAKE_C_COMPILER\\}") "/gnu/store/.../bin/gcc"))
-                   #t)))))
+                     (("\\$\\{CMAKE_C_COMPILER\\}") "/gnu/store/.../bin/gcc"))))
+               (add-after 'install 'install-guix.vim
+                 (lambda* (#:key inputs outputs #:allow-other-keys)
+                   (let ((vimdir (string-append (assoc-ref outputs "out") "/share/nvim"))
+                         (vimrc #$(local-file (search-auxiliary-file "guix.vim"))))
+                     (mkdir-p vimdir)
+                     (copy-file vimrc (string-append vimdir "/sysinit.vim"))))))))
+    (native-search-paths
+      (list (search-path-specification
+             (variable "GUIX_VIMRUNTIME")
+             (separator ",")
+             (files (list "share/vim/vimfiles")))))
     (inputs (list libuv-for-luv
                   msgpack
                   libtermkey
-- 
2.36.0
S
S
SeerLite wrote on 24 May 03:52 +0200
Re: [PATCH v6 1/2] gnu: vim: Use native-search-paths to search for plugins.
(address . 54221@debbugs.gnu.org)
1afb9a6e-a1b3-c09d-be35-d6376707a24d@nixnet.email
The last patches were broken. I did not realize I had done a "make
clean" inside my Guix repo and that made ./pre-inst-env guix use my
profile channel instead of the repo. Sorry about that:)

Now both build fine and work correctly. I also tested cross-compilation
(guix build --target=x86_64-linux-gnu and also
--target=aarch64-linux-gnu) but both fail. Note however that that was
also the case before my patches, and I've got no idea how to get it
working myself.

SeerLite
?