diff options
author | linsui <linsui555@gmail.com> | 2024-02-18 23:24:18 +0800 |
---|---|---|
committer | linsui <linsui555@gmail.com> | 2024-02-19 00:21:06 +0800 |
commit | a446fd03009bff2c14dc61ed3137cc9ae09659e0 (patch) | |
tree | 11585de0e5aeb33ba3c6f6b877aebcdf4f9e45ce /pkgs/by-name/ya | |
parent | 6ecec40792e26697eb5c015e04084cea3ebe70cc (diff) |
yazi: use wrapper to avoid rebuild
Diffstat (limited to 'pkgs/by-name/ya')
-rw-r--r-- | pkgs/by-name/ya/yazi-unwrapped/package.nix | 46 | ||||
-rw-r--r-- | pkgs/by-name/ya/yazi/package.nix | 48 |
2 files changed, 94 insertions, 0 deletions
diff --git a/pkgs/by-name/ya/yazi-unwrapped/package.nix b/pkgs/by-name/ya/yazi-unwrapped/package.nix new file mode 100644 index 0000000000000..4c2d1065fad6a --- /dev/null +++ b/pkgs/by-name/ya/yazi-unwrapped/package.nix @@ -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"; + }; +} diff --git a/pkgs/by-name/ya/yazi/package.nix b/pkgs/by-name/ya/yazi/package.nix new file mode 100644 index 0000000000000..134db023edd96 --- /dev/null +++ b/pkgs/by-name/ya/yazi/package.nix @@ -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}" +'' |