diff options
author(unmatched-parenthesis <>2022-03-12 21:09:40 +0000
committerGuix Patches Tester <>2022-03-12 21:12:07 +0000
commitea3b3352b837536bd1bc9d915162d599afd54640 (patch)
parent662f1f7bbac54d5762a06862b6174977003f46b9 (diff)
gnu: kakoune: Clean up, and add a search path that makes it possible to package kak plugins in guix. (Plugins incoming soon.)series-11595
* gnu/packages/text-editors.scm(kakoune): Remove the redundant `#t`s, and add a $GUIX_KAKOUNE_CONFIG_DIRS search path. While trying to package a kak plugin, I realized that the kak package itself was missing a search path. However, kak appears to allow only one config path, so I inject a for loop into the default kakrc (with a hacky substitute* because i cannot be bothered preparing a path :) which enumerates the paths in $GUIX_KAKOUNE_CONFIG_DIRS and sources all their kakfiles. I'll send in a few plugins in a moment. These will act as both examples of the search path working and of course useful packages in themselves. I also took the opportunity to clean the package up a little, removing the now unneccesary `#t`s returned at the end of each phase. I was going to change it to use git instead of github release tarballs too (I'm told that git clones are better because of Software Heritage), but I'm hesitant to make that change without checking first.
1 files changed, 23 insertions, 3 deletions
diff --git a/gnu/packages/text-editors.scm b/gnu/packages/text-editors.scm
index 45cc61765a..6d562d0e4a 100644
--- a/gnu/packages/text-editors.scm
+++ b/gnu/packages/text-editors.scm
@@ -17,6 +17,7 @@
;;; Copyright © 2021 Leo Famulari <>
;;; Copyright © 2021 Pierre Langlois <>
;;; Copyright © 2021 Calum Irwin <>
+;;; Copyright © 2022 (unmatched parenthesis <>
;;; This file is part of GNU Guix.
@@ -187,14 +188,33 @@ based command language.")
(substitute* "src/"
(("if \\(m_shell.empty\\(\\)\\)" line)
(string-append "m_shell = \"" (which "sh")
- "\";\n " line)))
- #t))
+ "\";\n " line)))))
(delete 'configure) ; no configure script
;; kakoune requires us to be in the src/ directory to build.
(add-before 'build 'chdir
- (lambda _ (chdir "src") #t)))))
+ (lambda _ (chdir "src")))
+ (add-before 'install 'patch-kakrc
+ (lambda _
+ (chdir "..")
+ ;; here, we modify the default kakrc to source all the $pkg/share/kak/autoload/*.kak
+ ;; files automatically.
+ (substitute* "share/kak/kakrc"
+ (("echo \"colorscheme default\"" colorscheme-default)
+ (string-append colorscheme-default "
+for dir in $(echo ${GUIX_KAKOUNE_CONFIG_DIRS} | sed 's/:/\\/autoload /g'); do
+ if [ -d ${dir} ]; then
+ autoload_directory ${dir}
+ fi
(list asciidoc pkg-config ruby))
+ (native-search-paths
+ (list (search-path-specification
+ ;; kakoune only supports one config dir, so we use this instead, so that we can
+ ;; modify the default kakrc to source all the autoloads.
+ (files '("share/kak/")))))
(synopsis "Vim-inspired code editor")
"Kakoune is a code editor heavily inspired by Vim, as such most of its