aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/tools/misc/zoxide/default.nix
blob: c5ca2965e9dda3d7650312edbb4013b83bb33ec5 (plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{ lib
, stdenv
, fetchFromGitHub
, rustPlatform
, withFzf ? true
, fzf

  # checkInputs
, fish
, powershell
, shellcheck
, shfmt
, xonsh
, zsh
}:
let
  version = "0.5.0";
in
rustPlatform.buildRustPackage {
  pname = "zoxide";
  inherit version;

  src = fetchFromGitHub {
    owner = "ajeetdsouza";
    repo = "zoxide";
    rev = "v${version}";
    sha256 = "143lh94mw31pm9q7ib63h2k842g3h222mdabhf25hpb19lka2w5y";
  };

  # tests are broken on darwin
  doCheck = !stdenv.isDarwin;

  # fish needs a writable HOME for whatever reason
  preCheck = ''
    export HOME=$(mktemp -d)
  '';

  checkInputs = [
    fish
    powershell
    shellcheck
    shfmt
    xonsh
    zsh
  ];

  postPatch = lib.optionalString withFzf ''
    substituteInPlace src/fzf.rs \
      --replace '"fzf"' '"${fzf}/bin/fzf"'
  '';

  cargoSha256 = "05mp101yk1zkjj1gwbkldizq6f9f8089gqgvq42c4ngq88pc7v9a";

  meta = with lib; {
    description = "A fast cd command that learns your habits";
    homepage = "https://github.com/ajeetdsouza/zoxide";
    license = with licenses; [ mit ];
    maintainers = with maintainers; [ ysndr cole-h ];
  };
}