Unverified Commit 07111a68 authored by Austin Horstman's avatar Austin Horstman Committed by GitHub
Browse files

yaziPlugins: init (#396196)

parents 733d5565 581cdfc6
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
{
  lib,
  fetchFromGitHub,
  mkYaziPlugin,
}:
mkYaziPlugin {
  pname = "bypass.yazi";
  version = "0-unstable-2025-02-16";

  src = fetchFromGitHub {
    owner = "Rolv-Apneseth";
    repo = "bypass.yazi";
    rev = "ecb1f7f6fd305ff4ffff548fa955595af6b26e60";
    hash = "sha256-XXp4XflrVrs8FrUCRUbSxWZTSGPrIGrpqvB1pARerKQ=";
  };

  meta = {
    description = "Yazi plugin for skipping directories with only a single sub-directory.";
    homepage = "https://github.com/Rolv-Apneseth/bypass.yazi";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ khaneliman ];
  };
}
+23 −0
Original line number Diff line number Diff line
{
  lib,
  fetchFromGitHub,
  mkYaziPlugin,
}:
mkYaziPlugin {
  pname = "chmod.yazi";
  version = "25.2.26-unstable-2025-03-02";

  src = fetchFromGitHub {
    owner = "yazi-rs";
    repo = "plugins";
    rev = "b44c245500b34e713732a9130bf436b13b4777e9";
    hash = "sha256-nZ8yfnKvNLM5aA+mmQ3PkfM5lwSKwWnkQewcg9GwseI=";
  };

  meta = {
    description = "Execute chmod on the selected files to change their mode";
    homepage = "https://yazi-rs.github.io";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ khaneliman ];
  };
}
+76 −0
Original line number Diff line number Diff line
{
  lib,
  callPackage,
  stdenvNoCC,
  writeShellScript,
}:
let
  root = ./.;
  updateScript = ./update.py;

  mkYaziPlugin =
    args@{
      pname,
      src,
      meta ? { },
      installPhase ? null,
      ...
    }:
    let
      # Extract the plugin name from pname (removing .yazi suffix if present)
      pluginName = lib.removeSuffix ".yazi" pname;
    in
    stdenvNoCC.mkDerivation (
      args
      // {
        installPhase =
          if installPhase != null then
            installPhase
          else if (src ? owner && src.owner == "yazi-rs") then
            # NOTE: License is a relative symbolic link
            # We remove the link and copy the true license
            ''
              runHook preInstall

              cp -r ${pname} $out
              rm $out/LICENSE
              cp LICENSE $out

              runHook postInstall
            ''
          else
            # Normal plugins don't require special installation other than to copy their contents.
            ''
              runHook preInstall

              cp -r . $out

              runHook postInstall
            '';
        meta = meta // {
          description = meta.description or "";
          platforms = meta.platforms or lib.platforms.all;
        };
        passthru = (args.passthru or { }) // {
          updateScript = {
            command = writeShellScript "update-${pluginName}" ''
              export PLUGIN_NAME="${pluginName}"
              export PLUGIN_PNAME="${pname}"
              exec ${updateScript}
            '';
            supportedFeatures = [ "commit" ];
          };
        };
      }
    );

  call = name: callPackage (root + "/${name}") { inherit mkYaziPlugin; };
in
lib.pipe root [
  builtins.readDir
  (lib.filterAttrs (_: type: type == "directory"))
  (builtins.mapAttrs (name: _: call name))
]
// {
  inherit mkYaziPlugin;
}
+23 −0
Original line number Diff line number Diff line
{
  lib,
  fetchFromGitHub,
  mkYaziPlugin,
}:
mkYaziPlugin {
  pname = "diff.yazi";
  version = "25.2.7-unstable-2025-03-02";

  src = fetchFromGitHub {
    owner = "yazi-rs";
    repo = "plugins";
    rev = "b44c245500b34e713732a9130bf436b13b4777e9";
    hash = "sha256-nZ8yfnKvNLM5aA+mmQ3PkfM5lwSKwWnkQewcg9GwseI=";
  };

  meta = {
    description = "Diff the selected file with the hovered file, create a living patch, and copy it to the clipboard";
    homepage = "https://yazi-rs.github.io";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ khaneliman ];
  };
}
+23 −0
Original line number Diff line number Diff line
{
  lib,
  fetchFromGitHub,
  mkYaziPlugin,
}:
mkYaziPlugin {
  pname = "full-border.yazi";
  version = "25.2.26-unstable-2025-03-11";

  src = fetchFromGitHub {
    owner = "yazi-rs";
    repo = "plugins";
    rev = "92f78dc6d0a42569fd0e9df8f70670648b8afb78";
    hash = "sha256-mqo71VLZsHmgTybxgqKNo9F2QeMuCSvZ89uen1VbWb4=";
  };

  meta = {
    description = "Add a full border to Yazi to make it look fancier";
    homepage = "https://yazi-rs.github.io";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ khaneliman ];
  };
}
Loading