Unverified Commit 46ee895a authored by Vlad M.'s avatar Vlad M. Committed by GitHub
Browse files

skim: 0.10.4 -> 0.15.0 (#360665)

parents bd548065 1e658170
Loading
Loading
Loading
Loading
+50 −29
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchCrate
, rustPlatform
, installShellFiles
{
  lib,
  stdenv,
  fetchFromGitHub,
  installShellFiles,
  nix-update-script,
  runtimeShell,
  rustPlatform,
  skim,
  testers,
}:

rustPlatform.buildRustPackage rec {
  pname = "skim";
  version = "0.10.4";
  version = "0.15.0";

  src = fetchCrate {
    inherit pname version;
    hash = "sha256-C2yK+SO8Tpw3BxXXu1jeDzYJ2548RZa7NFWaE0SdNJ0=";
  };

  nativeBuildInputs = [ installShellFiles ];
  outputs = [
    "out"
    "man"
    "vim"
  ];

  outputs = [ "out" "vim" ];

  cargoHash = "sha256-jBcgoWbmBOgU7M71lr4OXOe2S6NAXl+I8D+ZtT45Vos=";
  src = fetchFromGitHub {
    owner = "skim-rs";
    repo = "skim";
    rev = "refs/tags/v${version}";
    hash = "sha256-Y/MVjwpNyYXjQWB3s8WRblCukBr0z81k3gf3bf58KGE=";
  };

  postPatch = ''
    sed -i -e "s|expand('<sfile>:h:h')|'$out'|" plugin/skim.vim
  '';

  postInstall = ''
    install -D -m 555 bin/sk-tmux -t $out/bin

    install -D -m 444 plugin/skim.vim -t $vim/plugin

    install -D -m 444 shell/* -t $out/share/skim
  cargoHash = "sha256-llpNnZdIFHCmyyVla+tZOgpMTavu/m3ZGFZaS5EbiVo=";

    installManPage man/man1/*
  nativeBuildInputs = [ installShellFiles ];

    cat <<SCRIPT > $out/bin/sk-share
    #! ${stdenv.shell}
  postBuild = ''
    cat <<SCRIPT > sk-share
    #! ${runtimeShell}
    # Run this script to find the skim shared folder where all the shell
    # integration scripts are living.
    echo $out/share/skim
    SCRIPT
    chmod +x $out/bin/sk-share
  '';

  postInstall = ''
    installBin bin/sk-tmux
    install -D -m 444 plugin/skim.vim -t $vim/plugin
    install -D -m 444 shell/* -t $out/share/skim

    installBin sk-share
    installManPage $(find man -type f)
  '';

  # Doc tests are broken on aarch64
  # https://github.com/lotabout/skim/issues/440
  doCheck = !stdenv.hostPlatform.isAarch64;
  cargoTestFlags = lib.optional stdenv.hostPlatform.isAarch64 "--all-targets";

  passthru = {
    tests.version = testers.testVersion { package = skim; };
    updateScript = nix-update-script { };
  };

  meta = with lib; {
  meta = {
    description = "Command-line fuzzy finder written in Rust";
    homepage = "https://github.com/lotabout/skim";
    license = licenses.mit;
    changelog = "https://github.com/skim-rs/skim/releases/tag/v${version}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [
      dywedir
      getchoo
    ];
    mainProgram = "sk";
    maintainers = with maintainers; [ dywedir ];
  };
}