Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fish error when programs.fish.vendor.config.enable = true #261777

Closed
magnetophon opened this issue Oct 18, 2023 · 18 comments · Fixed by #261778
Closed

fish error when programs.fish.vendor.config.enable = true #261777

magnetophon opened this issue Oct 18, 2023 · 18 comments · Fixed by #261778
Labels
0.kind: bug Something is broken

Comments

@magnetophon
Copy link
Member

Describe the bug

When programs.fish.vendor.config.enable = true, I get the following error at every fish prompt:

fish: Unknown command: fzf_key_bindings
/run/current-system/sw/share/fish/vendor_conf.d/load-fzf-key-bindings.fish (line 1):
fzf_key_bindings
^~~~~~~~~~~~~~~^
from sourcing file /run/current-system/sw/share/fish/vendor_conf.d/load-fzf-key-bindings.fish
        called on line 248 of file /nix/store/mnmy8xws1zxblajvnal6v11i32ji4qp6-fish-3.6.1/share/fish/config.fish

When I set it to false, the error goes away.

Steps To Reproduce

Steps to reproduce the behavior:

  1. set programs.fish.vendor.config.enable = true in your config. (this is the default.
  2. open the fish shell in a terminal
  3. see the error

Expected behavior

No error.

Notify maintainers

@cole-h @Winter @srapenne

Metadata

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.5.7, NixOS, 23.11 (Tapir), 23.11pre536534.ca012a02bf83`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.17.0`
 - channels(root): `"nixos, nixos-hardware"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@magnetophon magnetophon added the 0.kind: bug Something is broken label Oct 18, 2023
@goofansu
Copy link

I encountered the same problem after updating packages with:

cd nix-config
nix flake update
darwin-rebuild switch --flake .

But starting new shells don't have the problem, so I restarted all existing shells.

nix-info:

  • system: "aarch64-darwin"
  • host os: Darwin 21.6.0, macOS 12.7
  • multi-user?: yes
  • sandbox: no
  • version: nix-env (Nix) 2.17.1
  • channels(root): "nixpkgs"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixpkgs

@magnetophon
Copy link
Member Author

@goofansu Thanks for the reply.
I tried to reproduce your findings, but ran into #262266, so I can't test.

@travis-anderson
Copy link

travis-anderson commented Oct 20, 2023

I think this was addressed here yesterday: #261778

@goofansu
Copy link

goofansu commented Oct 20, 2023

@magnetophon Sorry I was wrong, the error still happens, but only in git projects, so I wasn't noticed the problem. I installed fzf 0.40.0 in the 23.05 branch temporarily.

@simonbcn
Copy link

simonbcn commented Oct 20, 2023

I have upgraded from 23.05 to unstable and now I have the same problem as magnetophon.

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.5.7, NixOS, 23.11 (Tapir), 23.11pre536534.ca012a02bf83`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.17.0`
 - channels(root): `"nixos"`
 - channels(juan): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Parts of configuration.nix where I refer to fish and its plugins:

....
  users = {
    users.juan.isNormalUser = true;
    users.juan.description = "Juan";
    users.juan.extraGroups = [ "networkmanager" "wheel" ];
    users.juan.packages = with pkgs; [
...
    ];

    defaultUserShell = pkgs.fish;
  };
...
  environment = {

    systemPackages = with pkgs; [
      vscodium
      fishPlugins.done
      fishPlugins.tide
      fishPlugins.fzf-fish
      fzf
      fishPlugins.grc
      grc
      fishPlugins.colored-man-pages
      nil
      nixpkgs-fmt
      git
      nodejs
      plocate
      fd
      wget
    ];

    shells = with pkgs; [ fish ];
  };

  programs.fish = {
    enable = true;
    interactiveShellInit = ''
      set fish_greeting # Disable greeting
    '';
  };
....

@goofansu
Copy link

goofansu commented Oct 20, 2023

@simonbcn Just wait for #261778 backported to unstable, but I didn't see the backport PR.

@SuperSamus
Copy link
Contributor

SuperSamus commented Oct 22, 2023

Using nixpkgs-unstable (which has landed the PR), the issue has been fixed specifically for fzf, but not for tide.
While the custom prompt is working, there's the error:

fish: Unknown command: _tide_item_virtual_env
/run/current-system/sw/share/fish/vendor_functions.d/_tide_1_line_prompt.fish (line 11): 
        _tide_item_$item
        ^~~~~~~~~~~~~~~^
in function '_tide_1_line_prompt'
in command substitution
fish: Unknown command: _tide_item_chruby
/run/current-system/sw/share/fish/vendor_functions.d/_tide_1_line_prompt.fish (line 11): 
        _tide_item_$item
        ^~~~~~~~~~~~~~~^
in function '_tide_1_line_prompt'

EDIT: Fixed by deleting ~/.config/fish/fish_variables.

@r-vdp
Copy link
Contributor

r-vdp commented Oct 24, 2023

@simonbcn Just wait for #261778 backported to unstable, but I didn't see the backport PR.

A backport should not be needed, since 23.05 is still on fzf 0.40 which should not be affected. Only unstable was affected.

@r-vdp
Copy link
Contributor

r-vdp commented Oct 24, 2023

You can always apply the patch from the PR to fzf in your local config while we wait for hydra: (@pbek)

pkgs.fzf.overrideAttrs(_: prev: {
  patches = (prev.patches or [ ]) ++ [
    (pkgs.fetchpatch {
      name = "fzf-fix-fish-key-bindings.patch";
      url = "https://github.com/NixOS/nixpkgs/pull/261778.diff";
      hash = "sha256-DSdB9VxNuCS1j0hWkzUVM1jXLWAIcVWnMriPgs2YDJs=";
    })
  ];
})

@pbek
Copy link
Contributor

pbek commented Oct 24, 2023

Thank you, @r-vdp! Have to play with that more, the config caused some errors for me...

@r-vdp
Copy link
Contributor

r-vdp commented Oct 24, 2023

@pbek oh sorry, my fault, the PR patch would need to be applied to nixpkgs as a whole, not the fzf source, you can do it like this though:

pkgs.fzf.overrideAttrs (final: prev: {
  postInstall = (prev.postInstall or "") + ''
    cat << EOF > $out/share/fish/vendor_conf.d/load-fzf-key-bindings.fish
      status is-interactive; or exit 0
      fzf_key_bindings
    EOF
  '';
});

@pbek
Copy link
Contributor

pbek commented Oct 24, 2023

Didn't work either 😅

@r-vdp
Copy link
Contributor

r-vdp commented Oct 24, 2023

Didn't work either 😅

Hmm, it should, we can discuss in the support channel on matrix or such if you want, that's probably better than here

@goofansu
Copy link

goofansu commented Oct 25, 2023

@pbek oh sorry, my fault, the PR patch would need to be applied to nixpkgs as a whole, not the fzf source, you can do it like this though:

pkgs.fzf.overrideAttrs (final: prev: {
  postInstall = (prev.postInstall or "") + ''
    cat << EOF > $out/share/fish/vendor_conf.d/load-fzf-key-bindings.fish
      status is-interactive; or exit 0
      fzf_key_bindings
    EOF
  '';
});

@r-vdp Thanks, it works.

@pbek Do you use home-manager? If so, it works like:

{ pkgs, ... }:

{
  programs.fzf = {
    enable = true;
    package = pkgs.fzf.overrideAttrs (final: prev: {
      postInstall = (prev.postInstall or "") + ''
        cat << EOF > $out/share/fish/vendor_conf.d/load-fzf-key-bindings.fish
          status is-interactive; or exit 0
          fzf_key_bindings
        EOF
      '';
    });
  };
}

@pbek
Copy link
Contributor

pbek commented Oct 25, 2023

@goofansu, yes, I do use home-manager. 😁 Thank you, that worked!
@r-vdp, sorry for messing up the GitHub issue. 😅

@SuperSamus
Copy link
Contributor

In reply to my previous message, I fixed it by deleting ~/.config/fish/fish_variables.

@pbek
Copy link
Contributor

pbek commented Oct 30, 2023

It's fixed for me now in nixpkgs unstable! 👍🏻

@r-vdp r-vdp mentioned this issue Oct 30, 2023
12 tasks
@r-vdp
Copy link
Contributor

r-vdp commented Oct 30, 2023

Fixed in #261778

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants