Yazi plugin modules deprecated

{ pkgs, ... }:
let
  yazi-plugins = pkgs.fetchFromGitHub {
    owner = "yazi-rs";
    repo = "plugins";
    rev = "55bf6996ada3df4cbad331ce3be0c1090769fc7c";
    hash = "sha256-v/C+ZBrF1ghDt1SXpZcDELmHMVAqfr44iWxzUWynyRk=";
  };
in
{
  programs = {
    yazi = {
      enable = true;
      enableZshIntegration = true;
      shellWrapperName = "y";
      # package = pkgs.yazi; # Comment if using the git package

      flavors =
        let
          gruvbox-yazi = (
            pkgs.stdenv.mkDerivation {
              pname = "yazi-flavor-gruvbox";
              version = "24.4.25";
              src = pkgs.fetchFromGitHub {
                owner = "bennyyip";
                repo = "gruvbox-dark.yazi";
                rev = "91fdfa70f6d593934e62aba1e449f4ec3d3ccc90";
                hash = "sha256-RWqyAdETD/EkDVGcnBPiMcw1mSd78Aayky9yoxSsry4=";
              };
              installPhase = ''
                mkdir -p $out
                cp -r $src/* $out/
              '';
            }
          );
        in
        {
          gruvbox-dark = gruvbox-yazi;
        };

      theme = {
        flavor = {
          dark = "gruvbox-dark";
          light = "gruvbox-dark";
        };
      };

      plugins = {
        full-border = "${yazi-plugins}/full-border.yazi";
        vcs-files = "${yazi-plugins}/vcs-files.yazi";
        smart-enter = "${yazi-plugins}/smart-enter.yazi";
        git = "${yazi-plugins}/git.yazi";
        toggle-pane = "${yazi-plugins}/toggle-pane.yazi";
      };

      keymap = {
        manager = {
          prepend_keymap = [
            {
              on = "T";
              run = "plugin toggle-pane min-preview";
              desc = "Show or hide the preview pane";
            }

            {
              on = "l";
              run = "plugin smart-enter";
              desc = "Enter the child directory, or open the file";
            }

            # For vcs-files.yazi
            {
              on = [
                "g"
                "c"
              ];
              run = "plugin vcs-files";
              desc = "Show Git File changes";
            }
          ];
        };
      };

      settings = {
        plugin = {
          prepend_fetchers = [
            # For git.yazi
            {
              id = "git";
              name = "*";
              run = "git";
            }
            {
              id = "git";
              name = "*/";
              run = "git";
            }
            # For git.yazi
          ];
        };
      };

      initLua = # lua
        ''
          -- For full-border plugin
          require("full-border"):setup {
            type = ui.Border.ROUNDED, 
          }

          -- for git.yazi
          require("git"):setup()
        '';
    };
  };
}

The above is my yazi.nix configuration. The plugin module requires for the plugins to have a init.lua in their repo. However, most plugins have moved to a main.lua (initially they used a init.lua). This is not reflected in the new module. How do I fix it? How do I report this issue (total noob in this)?

 Failed assertions:
       - krish profile: Value at `programs.yazi.plugins.full-border` is not a valid yazi plugin.

       The plugin is missing these files: init.lua
       Evaluated value: `/nix/store/rfs69364g6s9h635lgba83i135k8xafa-source/full-border.yazi`

       - krish profile: Value at `programs.yazi.plugins.git` is not a valid yazi plugin.

       The plugin is missing these files: init.lua
       Evaluated value: `/nix/store/rfs69364g6s9h635lgba83i135k8xafa-source/git.yazi`

       - krish profile: Value at `programs.yazi.plugins.smart-enter` is not a valid yazi plugin.

       The plugin is missing these files: init.lua
       Evaluated value: `/nix/store/rfs69364g6s9h635lgba83i135k8xafa-source/smart-enter.yazi`

       - krish profile: Value at `programs.yazi.plugins.toggle-pane` is not a valid yazi plugin.

       The plugin is missing these files: init.lua
       Evaluated value: `/nix/store/rfs69364g6s9h635lgba83i135k8xafa-source/toggle-pane.yazi`

       - krish profile: Value at `programs.yazi.plugins.vcs-files` is not a valid yazi plugin.

       The plugin is missing these files: init.lua
       Evaluated value: `/nix/store/rfs69364g6s9h635lgba83i135k8xafa-source/vcs-files.yazi`

the above is the output of “not building”

EDIT: For some reason pkgs.yaziPlugins.<plugin> is not working either, the error gives that the yaziPlugins attribute is missing, though the attribute is defined in the all-packages.nix file.

1 Like

Is this part of your Home Manager config? The assertions in HM’s yazi module that required an init.lua in the plugins are removed in 25.05 and unstable, so updating should fix the problem.

Well do’h. 25.05 isn’t released yet, so that was probably not much helpful.

This should work, moving your plugins section into a package override:

programs.yazi = {
	package = pkgs.yazi.override {
		plugins = {
			full-border = "${yazi-plugins}/full-border.yazi";
			# ...
		};
	};
}
1 Like

I filed a PR (or whatever it’s called, I don’t know)

There’s no plugins option in it’s nix source

That’s yazi-unwrapped which is a dependency of the yazi package. It’s a common pattern in nixpkgs.