yazi: append .yazi to plugin folders automatically

This commit is contained in:
linsui 2025-06-03 17:06:16 +08:00
parent 8d3fffc313
commit c4f3c2c742
2 changed files with 10 additions and 4 deletions

View file

@ -76,7 +76,7 @@ in
example = lib.literalExpression '' example = lib.literalExpression ''
{ {
foo = ./foo; foo = ./foo;
bar = pkgs.bar; inherit (pkgs.yaziPlugins) bar;
} }
''; '';
}; };
@ -97,7 +97,7 @@ in
example = lib.literalExpression '' example = lib.literalExpression ''
{ {
foo = ./foo; foo = ./foo;
bar = pkgs.bar; inherit (pkgs.yaziPlugins) bar;
} }
''; '';
}; };

View file

@ -69,14 +69,20 @@ let
mkdir $out/plugins mkdir $out/plugins
${lib.optionalString (plugins != { }) '' ${lib.optionalString (plugins != { }) ''
${lib.concatStringsSep "\n" ( ${lib.concatStringsSep "\n" (
lib.mapAttrsToList (name: value: "ln -s ${value} $out/plugins/${name}") plugins lib.mapAttrsToList (
name: value:
"ln -s ${value} $out/plugins/${if lib.hasSuffix ".yazi" name then name else "${name}.yazi"}"
) plugins
)} )}
''} ''}
mkdir $out/flavors mkdir $out/flavors
${lib.optionalString (flavors != { }) '' ${lib.optionalString (flavors != { }) ''
${lib.concatStringsSep "\n" ( ${lib.concatStringsSep "\n" (
lib.mapAttrsToList (name: value: "ln -s ${value} $out/flavors/${name}") flavors lib.mapAttrsToList (
name: value:
"ln -s ${value} $out/flavors/${if lib.hasSuffix ".yazi" name then name else "${name}.yazi"}"
) flavors
)} )}
''} ''}