Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
107 lines
2.3 KiB
Nix
107 lines
2.3 KiB
Nix
{
|
|
lib,
|
|
formats,
|
|
runCommand,
|
|
makeWrapper,
|
|
|
|
extraPackages ? [ ],
|
|
optionalDeps ? [
|
|
jq
|
|
poppler-utils
|
|
_7zz
|
|
ffmpeg
|
|
fd
|
|
ripgrep
|
|
fzf
|
|
zoxide
|
|
imagemagick
|
|
chafa
|
|
resvg
|
|
],
|
|
|
|
# deps
|
|
file,
|
|
yazi-unwrapped,
|
|
|
|
# optional deps
|
|
jq,
|
|
poppler-utils,
|
|
_7zz,
|
|
ffmpeg,
|
|
fd,
|
|
ripgrep,
|
|
fzf,
|
|
zoxide,
|
|
imagemagick,
|
|
chafa,
|
|
resvg,
|
|
|
|
settings ? { },
|
|
plugins ? { },
|
|
flavors ? { },
|
|
initLua ? null,
|
|
}:
|
|
|
|
let
|
|
runtimePaths = [ file ] ++ optionalDeps ++ extraPackages;
|
|
|
|
settingsFormat = formats.toml { };
|
|
|
|
files = [
|
|
"yazi"
|
|
"theme"
|
|
"keymap"
|
|
];
|
|
|
|
configHome =
|
|
if (settings == { } && initLua == null && plugins == { } && flavors == { }) then
|
|
null
|
|
else
|
|
runCommand "YAZI_CONFIG_HOME" { } ''
|
|
mkdir -p "$out"
|
|
${lib.concatMapStringsSep "\n" (
|
|
name:
|
|
lib.optionalString (settings ? ${name} && settings.${name} != { }) ''
|
|
ln -s ${settingsFormat.generate "${name}.toml" settings.${name}} "$out/${name}.toml"
|
|
''
|
|
) files}
|
|
|
|
mkdir "$out/plugins"
|
|
${lib.optionalString (plugins != { }) ''
|
|
${lib.concatStringsSep "\n" (
|
|
lib.mapAttrsToList (
|
|
name: value:
|
|
''ln -s ${value} "$out/plugins/${if lib.hasSuffix ".yazi" name then name else "${name}.yazi"}"''
|
|
) plugins
|
|
)}
|
|
''}
|
|
|
|
mkdir "$out/flavors"
|
|
${lib.optionalString (flavors != { }) ''
|
|
${lib.concatStringsSep "\n" (
|
|
lib.mapAttrsToList (
|
|
name: value:
|
|
''ln -s ${value} "$out/flavors/${if lib.hasSuffix ".yazi" name then name else "${name}.yazi"}"''
|
|
) flavors
|
|
)}
|
|
''}
|
|
|
|
|
|
${lib.optionalString (initLua != null) ''ln -s "${initLua}" "$out/init.lua"''}
|
|
'';
|
|
in
|
|
runCommand yazi-unwrapped.name
|
|
{
|
|
inherit (yazi-unwrapped) pname version meta;
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
}
|
|
''
|
|
mkdir -p "$out/bin"
|
|
ln -s "${yazi-unwrapped}/share" "$out/share"
|
|
ln -s ${lib.getExe' yazi-unwrapped "ya"} "$out/bin/ya"
|
|
makeWrapper ${lib.getExe' yazi-unwrapped "yazi"} "$out/bin/yazi" \
|
|
--prefix PATH : ${lib.makeBinPath runtimePaths} \
|
|
${lib.optionalString (configHome != null) "--set YAZI_CONFIG_HOME ${configHome}"}
|
|
''
|