1{
2 lib,
3 fetchFromGitHub,
4
5 # sniprun-bin
6 rustPlatform,
7 makeWrapper,
8 bashInteractive,
9 coreutils,
10 curl,
11 gnugrep,
12 gnused,
13 procps,
14
15 # sniprun
16 vimUtils,
17 replaceVars,
18 nix-update-script,
19}:
20let
21 version = "1.3.18";
22 src = fetchFromGitHub {
23 owner = "michaelb";
24 repo = "sniprun";
25 tag = "v${version}";
26 hash = "sha256-2Q7Jnt7pVCuNne442KPh2cSjA6V6WSZkgUj99UpmnOM=";
27 };
28 sniprun-bin = rustPlatform.buildRustPackage {
29 pname = "sniprun-bin";
30 inherit version src;
31
32 cargoHash = "sha256-cu7wn75rQcwPLjFl4v05kVMsiCD0mAlIBt49mvIaPPU=";
33
34 nativeBuildInputs = [ makeWrapper ];
35
36 postInstall = ''
37 wrapProgram $out/bin/sniprun \
38 --prefix PATH ${
39 lib.makeBinPath [
40 bashInteractive
41 coreutils
42 curl
43 gnugrep
44 gnused
45 procps
46 ]
47 }
48 '';
49
50 doCheck = false;
51
52 meta.mainProgram = "sniprun";
53 };
54in
55vimUtils.buildVimPlugin {
56 pname = "sniprun";
57 inherit version src;
58
59 patches = [
60 (replaceVars ./fix-paths.patch {
61 sniprun = lib.getExe sniprun-bin;
62 })
63 ];
64
65 propagatedBuildInputs = [ sniprun-bin ];
66
67 passthru = {
68 updateScript = nix-update-script {
69 attrPath = "vimPlugins.sniprun.sniprun-bin";
70 };
71
72 # needed for the update script
73 inherit sniprun-bin;
74 };
75
76 meta = {
77 homepage = "https://github.com/michaelb/sniprun/";
78 changelog = "https://github.com/michaelb/sniprun/blob/v${version}/CHANGELOG.md";
79 maintainers = with lib.maintainers; [ GaetanLepage ];
80 license = lib.licenses.mit;
81 };
82}