about summary refs log tree commit diff
path: root/pkgs/by-name/jq/jq-zsh-plugin/package.nix
blob: 3e06f6d58872f979302849c3feacc0a3664615e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
  lib,
  stdenv,
  fetchFromGitHub,
  fzf,
  jq,
  nix-update-script,
}:

stdenv.mkDerivation rec {
  pname = "jq-zsh-plugin";
  version = "0.6.1";

  src = fetchFromGitHub {
    owner = "reegnz";
    repo = "jq-zsh-plugin";
    rev = "refs/tags/v${version}";
    hash = "sha256-q/xQZ850kifmd8rCMW+aAEhuA43vB9ZAW22sss9e4SE=";
  };

  strictDeps = true;
  dontConfigure = true;
  dontBuild = true;
  installPhase = ''
    mkdir -p $out/share/jq-zsh-plugin/
    cp jq.plugin.zsh $out/share/jq-zsh-plugin
    cp -r bin/ $out/share/jq-zsh-plugin
    substituteInPlace $out/share/jq-zsh-plugin/bin/jq-repl --replace-fail "fzf \\" "${fzf}/bin/fzf \\"
    substituteInPlace $out/share/jq-zsh-plugin/jq.plugin.zsh --replace-fail ":-jq" ":-${jq}/bin/jq"
    substituteInPlace $out/share/jq-zsh-plugin/bin/jq-paths --replace-fail ":-jq" ":-${jq}/bin/jq"
    substituteInPlace $out/share/jq-zsh-plugin/bin/jq-repl --replace-fail ":-jq" ":-${jq}/bin/jq"
    substituteInPlace $out/share/jq-zsh-plugin/bin/jq-repl-preview --replace-fail ":-jq" ":-${jq}/bin/jq"
  '';

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "Interactively build jq expressions in Zsh";
    homepage = "https://github.com/reegnz/jq-zsh-plugin";
    license = lib.licenses.mit;
    platforms = lib.platforms.unix;
    maintainers = [ lib.maintainers.vinnymeller ];
  };
}