Unverified Commit 834ae553 authored by Austin Horstman's avatar Austin Horstman
Browse files

yaziPlugins: use a helper function for creating derivations

parent a4bc0854
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
{
  lib,
  stdenvNoCC,
  fetchFromGitHub,
  mkYaziPlugin,
}:
stdenvNoCC.mkDerivation {
mkYaziPlugin {
  pname = "bypass.yazi";
  version = "0-unstable-2025-02-16";

@@ -14,14 +14,6 @@ stdenvNoCC.mkDerivation {
    hash = "sha256-XXp4XflrVrs8FrUCRUbSxWZTSGPrIGrpqvB1pARerKQ=";
  };

  installPhase = ''
    runHook preInstall

    cp -r . $out

    runHook postInstall
  '';

  meta = {
    description = "Yazi plugin for skipping directories with only a single sub-directory.";
    homepage = "https://github.com/Rolv-Apneseth/bypass.yazi";
+2 −14
Original line number Diff line number Diff line
{
  lib,
  stdenvNoCC,
  fetchFromGitHub,
  mkYaziPlugin,
}:
stdenvNoCC.mkDerivation {
mkYaziPlugin {
  pname = "chmod.yazi";
  version = "25.2.26-unstable-2025-03-02";

@@ -14,18 +14,6 @@ stdenvNoCC.mkDerivation {
    hash = "sha256-nZ8yfnKvNLM5aA+mmQ3PkfM5lwSKwWnkQewcg9GwseI=";
  };

  # NOTE: License is a relative symbolic link
  # We remove the link and copy the true license
  installPhase = ''
    runHook preInstall

    cp -r chmod.yazi $out
    rm $out/LICENSE
    cp LICENSE $out

    runHook postInstall
  '';

  meta = {
    description = "Execute chmod on the selected files to change their mode";
    homepage = "https://yazi-rs.github.io";
+52 −2
Original line number Diff line number Diff line
{ lib, callPackage }:
{
  lib,
  callPackage,
  stdenvNoCC,
}:
let
  root = ./.;
  call = name: callPackage (root + "/${name}") { };

  mkYaziPlugin =
    args@{
      pname,
      src,
      meta ? { },
      installPhase ? null,
      ...
    }:
    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;
        };
      }
    );

  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;
}
+2 −14
Original line number Diff line number Diff line
{
  lib,
  stdenvNoCC,
  fetchFromGitHub,
  mkYaziPlugin,
}:
stdenvNoCC.mkDerivation {
mkYaziPlugin {
  pname = "diff.yazi";
  version = "25.2.7-unstable-2025-03-02";

@@ -14,18 +14,6 @@ stdenvNoCC.mkDerivation {
    hash = "sha256-nZ8yfnKvNLM5aA+mmQ3PkfM5lwSKwWnkQewcg9GwseI=";
  };

  # NOTE: License is a relative symbolic link
  # We remove the link and copy the true license
  installPhase = ''
    runHook preInstall

    cp -r diff.yazi $out
    rm $out/LICENSE
    cp LICENSE $out

    runHook postInstall
  '';

  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";
+2 −14
Original line number Diff line number Diff line
{
  lib,
  stdenvNoCC,
  fetchFromGitHub,
  mkYaziPlugin,
}:
stdenvNoCC.mkDerivation {
mkYaziPlugin {
  pname = "full-border.yazi";
  version = "25.2.26-unstable-2025-03-11";

@@ -14,18 +14,6 @@ stdenvNoCC.mkDerivation {
    hash = "sha256-mqo71VLZsHmgTybxgqKNo9F2QeMuCSvZ89uen1VbWb4=";
  };

  # NOTE: License is a relative symbolic link
  # We remove the link and copy the true license
  installPhase = ''
    runHook preInstall

    cp -r full-border.yazi $out
    rm $out/LICENSE
    cp LICENSE $out

    runHook postInstall
  '';

  meta = {
    description = "Add a full border to Yazi to make it look fancier";
    homepage = "https://yazi-rs.github.io";
Loading