NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.11k stars 14.15k forks source link

trouble using zsh plugins #268985

Closed KiaraGrouwstra closed 5 months ago

KiaraGrouwstra commented 11 months ago

hi there, i found nixpkgs has a package zsh-history-search-multi-word, but i cannot figure out how to use it.

Describe the bug

i cannot get this plugin to both build and load

Steps To Reproduce

i tried:

{ pkgs, lib, ... }:

{
  programs.zsh = {
    enable = true;
    plugins = with pkgs; [
      zsh-history-search-multi-word
    ];
  };
}

which upon build yields:

error: The option `programs.zsh.plugins."[definition 1-entry 1]".__ignoreNulls' does not exist.
{ pkgs, lib, ... }:

{
  home.packages = with pkgs; [
    zsh-history-search-multi-word
  ];

  programs.zsh = {
    enable = true;
    oh-my-zsh = {
      enable = true;
      plugins = [
        "history-search-multi-word"
      ];
    };
  };
}

which upon opening a zsh shell yields:

[oh-my-zsh] plugin 'history-search-multi-word' not found

(similar if you prepend with zsh-.)

Expected behavior

plugin builds and loads

Screenshots

n/a

Additional context

n/a

Notify maintainers

@sei40kr @pSub @Artturin

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

i only use flakes, in this case:

    "master": {
      "locked": {
        "lastModified": 1699436246,
        "narHash": "sha256-RvYt1hRWAbBIT/QApyztv/u0eoJuq59fSGtohZhktT0=",
        "owner": "nixos",
        "repo": "nixpkgs",
        "rev": "7a1f927eea31dcc5f224557641a70724d3908c06",
        "type": "github"
      },
      "original": {
        "owner": "nixos",
        "ref": "master",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
Gashmore1 commented 5 months ago

Have you tried this with other plugins? I seem to be seeing the same behavior from powerlevel10k. From what I can see it looks that these packages are not being downloaded to the /nix/store/

KiaraGrouwstra commented 5 months ago

@Gashmore1 i can reproduce with powerlevel10k as well yeah, even when explicitly installing the packages. programs.zsh.oh-my-zsh.plugins appears to work with their listed plugins, so that one might be expected behavior. not sure about programs.zsh.plugins tho.

tomodachi94 commented 5 months ago

That HM config doesn't look right. You'll need something like this:

{ pkgs, ... }:

{
  programs.zsh = {
    enable = true;
    plugins = [ 
      rec { # rec makes things a bit easier to read
        name = "history-search-multi-word";
        src = pkgs.zsh-history-search-multi-word;
        file = "share/zsh/zsh-${name}/${name}.plugin.zsh";
      }
    ];
  };
}

Further reading: