Commit a446fd03 authored by linsui's avatar linsui
Browse files

yazi: use wrapper to avoid rebuild

parent 6ecec407
Loading
Loading
Loading
Loading
+46 −0
Original line number Diff line number Diff line
@@ -2,30 +2,10 @@
, 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
}:

@@ -44,25 +24,10 @@ rustPlatform.buildRustPackage rec {

  env.YAZI_GEN_COMPLETIONS = true;

  nativeBuildInputs = [ makeWrapper installShellFiles ];
  nativeBuildInputs = [ 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}"
  postInstall = ''
    installShellCompletion --cmd yazi \
      --bash ./yazi-config/completions/yazi.bash \
      --fish ./yazi-config/completions/yazi.fish \
+48 −0
Original line number Diff line number Diff line
{ 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}"
''
+1 −1
Original line number Diff line number Diff line
@@ -41889,7 +41889,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 { };