Merge pull request #289765 from linsui/yazi-wrapper

yazi: use wrapper to avoid rebuild
This commit is contained in:
Pascal Bach 2024-02-19 20:39:50 +01:00 committed by GitHub
commit 3f3d631ae2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 95 additions and 82 deletions

View File

@ -1,81 +0,0 @@
{ rustPlatform
, fetchFromGitHub
, lib
, makeWrapper
, installShellFiles
, stdenv
, Foundation
, withFile ? true
, file
, withJq ? true
, jq
, withPoppler ? true
, poppler_utils
, withUnar ? true
, unar
, withFfmpegthumbnailer ? true
, ffmpegthumbnailer
, withFd ? true
, fd
, withRipgrep ? true
, ripgrep
, withFzf ? true
, fzf
, withZoxide ? true
, zoxide
, nix-update-script
}:
rustPlatform.buildRustPackage rec {
pname = "yazi";
version = "0.2.3";
src = fetchFromGitHub {
owner = "sxyazi";
repo = pname;
rev = "v${version}";
hash = "sha256-2AiaJs6xY8hsB1DBxpPwdZtc8IZvsoCGWBOFVMf4dvk=";
};
cargoHash = "sha256-fRUmXv27sHYz8z0cc795JCPLHDQGgTV4wAWAtQ/pbg4=";
env.YAZI_GEN_COMPLETIONS = true;
nativeBuildInputs = [ makeWrapper installShellFiles ];
buildInputs = lib.optionals stdenv.isDarwin [ Foundation ];
postInstall = with lib;
let
runtimePaths = [ ]
++ optional withFile file
++ optional withJq jq
++ optional withPoppler poppler_utils
++ optional withUnar unar
++ optional withFfmpegthumbnailer ffmpegthumbnailer
++ optional withFd fd
++ optional withRipgrep ripgrep
++ optional withFzf fzf
++ optional withZoxide zoxide;
in
''
wrapProgram $out/bin/yazi \
--prefix PATH : "${makeBinPath runtimePaths}"
installShellCompletion --cmd yazi \
--bash ./yazi-config/completions/yazi.bash \
--fish ./yazi-config/completions/yazi.fish \
--zsh ./yazi-config/completions/_yazi
'';
passthru.updateScript = nix-update-script { };
meta = with lib; {
description = "Blazing fast terminal file manager written in Rust, based on async I/O";
homepage = "https://github.com/sxyazi/yazi";
license = licenses.mit;
maintainers = with maintainers; [ xyenon matthiasbeyer ];
mainProgram = "yazi";
};
}

View File

@ -0,0 +1,46 @@
{ rustPlatform
, fetchFromGitHub
, lib
, installShellFiles
, stdenv
, Foundation
, nix-update-script
}:
rustPlatform.buildRustPackage rec {
pname = "yazi";
version = "0.2.3";
src = fetchFromGitHub {
owner = "sxyazi";
repo = pname;
rev = "v${version}";
hash = "sha256-2AiaJs6xY8hsB1DBxpPwdZtc8IZvsoCGWBOFVMf4dvk=";
};
cargoHash = "sha256-fRUmXv27sHYz8z0cc795JCPLHDQGgTV4wAWAtQ/pbg4=";
env.YAZI_GEN_COMPLETIONS = true;
nativeBuildInputs = [ installShellFiles ];
buildInputs = lib.optionals stdenv.isDarwin [ Foundation ];
postInstall = ''
installShellCompletion --cmd yazi \
--bash ./yazi-config/completions/yazi.bash \
--fish ./yazi-config/completions/yazi.fish \
--zsh ./yazi-config/completions/_yazi
'';
passthru.updateScript = nix-update-script { };
meta = with lib; {
description = "Blazing fast terminal file manager written in Rust, based on async I/O";
homepage = "https://github.com/sxyazi/yazi";
license = licenses.mit;
maintainers = with maintainers; [ xyenon matthiasbeyer ];
mainProgram = "yazi";
};
}

View File

@ -0,0 +1,48 @@
{ lib
, runCommand
, makeWrapper
, yazi-unwrapped
, withFile ? true
, file
, withJq ? true
, jq
, withPoppler ? true
, poppler_utils
, withUnar ? true
, unar
, withFfmpegthumbnailer ? true
, ffmpegthumbnailer
, withFd ? true
, fd
, withRipgrep ? true
, ripgrep
, withFzf ? true
, fzf
, withZoxide ? true
, zoxide
}:
let
runtimePaths = with lib; [ ]
++ optional withFile file
++ optional withJq jq
++ optional withPoppler poppler_utils
++ optional withUnar unar
++ optional withFfmpegthumbnailer ffmpegthumbnailer
++ optional withFd fd
++ optional withRipgrep ripgrep
++ optional withFzf fzf
++ optional withZoxide zoxide;
in
runCommand yazi-unwrapped.name
{
inherit (yazi-unwrapped) pname version meta;
nativeBuildInputs = [ makeWrapper ];
} ''
mkdir -p $out/bin
ln -s ${yazi-unwrapped}/share $out/share
makeWrapper ${yazi-unwrapped}/bin/yazi $out/bin/yazi \
--prefix PATH : "${lib.makeBinPath runtimePaths}"
''

View File

@ -41891,7 +41891,7 @@ with pkgs;
weggli = callPackage ../tools/security/weggli { };
yazi = callPackage ../applications/file-managers/yazi { inherit (darwin.apple_sdk.frameworks) Foundation; };
yazi-unwrapped = callPackage ../by-name/ya/yazi-unwrapped/package.nix { inherit (darwin.apple_sdk.frameworks) Foundation; };
ssl-proxy = callPackage ../tools/networking/ssl-proxy { };