From 30d4848ffc1b6b1768d08d6e5061cab6bcfd7561 Mon Sep 17 00:00:00 2001 From: Seong Yong-ju Date: Thu, 20 Jan 2022 01:28:08 +0900 Subject: [PATCH] vimPlugins.sniprun: init at 1.1.2 --- pkgs/misc/vim-plugins/overrides.nix | 48 ++++++++++++++++++- .../patches/sniprun/fix-paths.patch | 36 ++++++++++++++ 2 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 pkgs/misc/vim-plugins/patches/sniprun/fix-paths.patch diff --git a/pkgs/misc/vim-plugins/overrides.nix b/pkgs/misc/vim-plugins/overrides.nix index db4f0057d684..948a39f271ca 100644 --- a/pkgs/misc/vim-plugins/overrides.nix +++ b/pkgs/misc/vim-plugins/overrides.nix @@ -65,8 +65,16 @@ , gobject-introspection , wrapGAppsHook - # vim-clap dependencies + # sniprun dependencies +, bashInteractive +, coreutils , curl +, gnugrep +, gnused +, makeWrapper +, procps + + # vim-clap dependencies , libgit2 , libiconv , openssl @@ -76,7 +84,6 @@ , asmfmt , delve , errcheck -, gnused , go-motion , go-tools , gocode @@ -536,6 +543,43 @@ self: super: { dependencies = with self; [ skim ]; }); + sniprun = + let + version = "1.1.2"; + src = fetchFromGitHub { + owner = "michaelb"; + repo = "sniprun"; + rev = "v${version}"; + sha256 = "sha256-WL0eXwiPhcndI74wtFox2tSnZn1siE86x2MLkfpxxT4="; + }; + sniprun-bin = rustPlatform.buildRustPackage { + pname = "sniprun-bin"; + inherit version src; + + cargoSha256 = "sha256-1WbgnsjoFdvko6VRKY+IjafMNqvJvyIZCDk8I9GV3GM="; + + nativeBuildInputs = [ makeWrapper ]; + + postInstall = '' + wrapProgram $out/bin/sniprun \ + --prefix PATH ${lib.makeBinPath [ bashInteractive coreutils curl gnugrep gnused procps ]} + ''; + + doCheck = false; + }; + in + buildVimPluginFrom2Nix { + pname = "sniprun"; + inherit version src; + + patches = [ ./patches/sniprun/fix-paths.patch ]; + postPatch = '' + substituteInPlace lua/sniprun.lua --replace '@sniprun_bin@' ${sniprun-bin} + ''; + + propagatedBuildInputs = [ sniprun-bin ]; + }; + sqlite-lua = super.sqlite-lua.overrideAttrs (old: { postPatch = let libsqlite = "${sqlite.out}/lib/libsqlite3${stdenv.hostPlatform.extensions.sharedLibrary}"; diff --git a/pkgs/misc/vim-plugins/patches/sniprun/fix-paths.patch b/pkgs/misc/vim-plugins/patches/sniprun/fix-paths.patch new file mode 100644 index 000000000000..f3203e007576 --- /dev/null +++ b/pkgs/misc/vim-plugins/patches/sniprun/fix-paths.patch @@ -0,0 +1,36 @@ +diff --git a/lua/sniprun.lua b/lua/sniprun.lua +index aa39e0b..188d54a 100644 +--- a/lua/sniprun.lua ++++ b/lua/sniprun.lua +@@ -4,9 +4,7 @@ M.custom_highlight=false + M.info_floatwin = {} + + -- See https://github.com/tjdevries/rofl.nvim/blob/632c10f2ec7c56882a3f7eda8849904bcac6e8af/lua/rofl.lua +-local binary_path = vim.fn.fnamemodify( +- vim.api.nvim_get_runtime_file("lua/sniprun.lua", false)[1], ":h:h") +- .. "/target/release/sniprun" ++local binary_path = "@sniprun_bin@/bin/sniprun" + + local sniprun_path = vim.fn.fnamemodify( vim.api.nvim_get_runtime_file("lua/sniprun.lua", false)[1], ":p:h") .. "/.." + +diff --git a/ressources/init_repl.sh b/ressources/init_repl.sh +index 2e6264d..0eab1c6 100644 +--- a/ressources/init_repl.sh ++++ b/ressources/init_repl.sh +@@ -23,7 +23,7 @@ mkfifo $working_dir/$pipe + touch $working_dir/$out + sleep 36000 > $working_dir/$pipe & + +-echo "/bin/cat " $working_dir/$pipe " | " $repl > $working_dir/real_launcher.sh ++echo "cat " $working_dir/$pipe " | " $repl > $working_dir/real_launcher.sh + chmod +x $working_dir/real_launcher.sh + + echo $repl " process started at $(date +"%F %T")." >> $working_dir/log +diff --git a/ressources/launcher_repl.sh b/ressources/launcher_repl.sh +index feaa91e..749c55e 100755 +--- a/ressources/launcher_repl.sh ++++ b/ressources/launcher_repl.sh +@@ -1,2 +1,2 @@ + #!/bin/bash +-/bin/cat $1 > $2 ++cat $1 > $2