nixpkgs/pkgs/tools/misc/skim/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

56 lines
1.3 KiB
Nix

{ lib
, stdenv
, fetchCrate
, rustPlatform
, installShellFiles
}:
rustPlatform.buildRustPackage rec {
pname = "skim";
version = "0.10.4";
src = fetchCrate {
inherit pname version;
hash = "sha256-C2yK+SO8Tpw3BxXXu1jeDzYJ2548RZa7NFWaE0SdNJ0=";
};
nativeBuildInputs = [ installShellFiles ];
outputs = [ "out" "vim" ];
cargoHash = "sha256-jBcgoWbmBOgU7M71lr4OXOe2S6NAXl+I8D+ZtT45Vos=";
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
installManPage man/man1/*
cat <<SCRIPT > $out/bin/sk-share
#! ${stdenv.shell}
# 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
'';
# https://github.com/lotabout/skim/issues/440
doCheck = !stdenv.hostPlatform.isAarch64;
meta = with lib; {
description = "Command-line fuzzy finder written in Rust";
homepage = "https://github.com/lotabout/skim";
license = licenses.mit;
mainProgram = "sk";
maintainers = with maintainers; [ dywedir ];
};
}