about summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorPeder Bergebakken Sundt <pbsds@hotmail.com>2023-12-09 02:36:23 +0100
committerGitHub <noreply@github.com>2023-12-09 02:36:23 +0100
commitec9940bc4f5361286a32c448ba0bdaad0159bef8 (patch)
tree3d226c2ed8bf0bb5a2f1a29c1324d2a9f7f209ab /pkgs/tools
parentcbef97d927154c450621249eab0bcef4e1bf440c (diff)
parentabc782ce27fdc19514171be09ea71f3899bb40ad (diff)
Merge pull request #217658 from poweredbypie/kak-lsp-14.2.0
kak-lsp: Fix missing Perl dependency
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/misc/kak-lsp/0001-Use-full-Perl-path.patch37
-rw-r--r--pkgs/tools/misc/kak-lsp/default.nix13
2 files changed, 47 insertions, 3 deletions
diff --git a/pkgs/tools/misc/kak-lsp/0001-Use-full-Perl-path.patch b/pkgs/tools/misc/kak-lsp/0001-Use-full-Perl-path.patch
new file mode 100644
index 0000000000000..38f0d38cb2156
--- /dev/null
+++ b/pkgs/tools/misc/kak-lsp/0001-Use-full-Perl-path.patch
@@ -0,0 +1,37 @@
+From b93660cfa8a80a5e5bf72e1f06fb7bf95272c7e4 Mon Sep 17 00:00:00 2001
+From: PoweredByPie <poweredbypie@users.noreply.github.com>
+Date: Fri, 8 Dec 2023 04:39:01 -0800
+Subject: [PATCH] Use full Perl path
+
+---
+ rc/lsp.kak | 7 +------
+ 1 file changed, 1 insertion(+), 6 deletions(-)
+
+diff --git a/rc/lsp.kak b/rc/lsp.kak
+index d695a2e..7c6a436 100644
+--- a/rc/lsp.kak
++++ b/rc/lsp.kak
+@@ -2339,11 +2339,6 @@ define-command -hidden lsp-snippets-insert-completion -params 1 %{ evaluate-comm
+ }}
+ 
+ define-command lsp-snippets-insert -hidden -params 1 %[
+-    evaluate-commands %sh{
+-        if ! command -v perl > /dev/null 2>&1; then
+-            printf "fail '''perl'' must be installed to use the ''snippets-insert'' command'"
+-        fi
+-    }
+     evaluate-commands -draft -save-regs '^"' %[
+         set-register '"' %arg{1}
+         execute-keys <a-P>
+@@ -2397,7 +2392,7 @@ define-command lsp-snippets-insert -hidden -params 1 %[
+ 
+ define-command -hidden lsp-snippets-insert-perl-impl %[
+     evaluate-commands %sh[ # $kak_quoted_selections
+-        perl -e '
++        @perlPath@/bin/perl -e '
+ use strict;
+ use warnings;
+ use Text::ParseWords();
+-- 
+2.42.0
+
diff --git a/pkgs/tools/misc/kak-lsp/default.nix b/pkgs/tools/misc/kak-lsp/default.nix
index 1f494dea84387..9a19d40bed235 100644
--- a/pkgs/tools/misc/kak-lsp/default.nix
+++ b/pkgs/tools/misc/kak-lsp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchFromGitHub, rustPlatform, CoreServices, Security, SystemConfiguration }:
+{ stdenv, lib, fetchFromGitHub, rustPlatform, perl, CoreServices, Security, SystemConfiguration }:
 
 rustPlatform.buildRustPackage rec {
   pname = "kak-lsp";
@@ -13,13 +13,20 @@ rustPlatform.buildRustPackage rec {
 
   cargoHash = "sha256-+3cpAL+8X8L833kmZapUoGSwHOj+hnDN6oDNJZ6y24Q=";
 
-  buildInputs = lib.optionals stdenv.isDarwin [ CoreServices Security SystemConfiguration ];
+  buildInputs = [ perl ] ++ lib.optionals stdenv.isDarwin [ CoreServices Security SystemConfiguration ];
+
+  patches = [ ./0001-Use-full-Perl-path.patch ];
+
+  postPatch = ''
+    substituteInPlace rc/lsp.kak \
+      --subst-var-by perlPath ${lib.getBin perl}
+  '';
 
   meta = with lib; {
     description = "Kakoune Language Server Protocol Client";
     homepage = "https://github.com/kak-lsp/kak-lsp";
     license = with licenses; [ unlicense /* or */ mit ];
-    maintainers = [ maintainers.spacekookie ];
+    maintainers = with maintainers; [ spacekookie poweredbypie ];
     mainProgram = "kak-lsp";
   };
 }