home-manager icon indicating copy to clipboard operation
home-manager copied to clipboard

fish: consider extra outputs to install completions

Open neosimsim opened this issue 2 years ago β€’ 8 comments

Description

After switching to fish, I noticed that some man pages are not considered when generating completions. This is because

  • Some packages provide man pages in extraOutputs, e.g. tmux and tmux.man and
  • Some packages link man pages, e.g. if a package is wrapped with buildEnv.

To fix this I added extraOutputsToInstall an source for man pages, similar to nixpkgs buildEnv

Checklist

  • [x] Change is backwards compatible.

  • [x] Code formatted with ./format.

  • [x] Code tested through nix-shell --pure tests -A run.all.

  • [x] Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

neosimsim avatar May 01 '22 11:05 neosimsim

@hyperfekt IIUC you added the code. Would you mind to review?

neosimsim avatar May 01 '22 15:05 neosimsim

Thanks for the contribution! LGTM, but I don't use Fish, so I'll wait for @hyperfekt to say.

About the conflict, it is just to make the script use Python 3. It should be easily resolved by rebasing your branch.

rycee avatar May 02 '22 21:05 rycee

Maybe some else?

CC @tjni @kidonng @pvsr

neosimsim avatar May 09 '22 12:05 neosimsim

Could you provide me with some steps to test the difference before and after? I can sanity check it.

On my OSX machine, I tried getting completions after the tmux command, and I was able to currently without changes. I'm not positive if I am doing something wrong or if it's perhaps an OSX specific quirk that it works.

tjni avatar May 09 '22 17:05 tjni

I can't reproduce either, on OSX or NixOS. Do you have programs.man.generateCaches enabled? That fixed the issues I was having with man completions.

pvsr avatar May 10 '22 00:05 pvsr

I'm sorry for not explaining well.

I was testing with

{ pkgs, config, lib, ... }:
{
  home.packages = with pkgs; [
    tmux
    (buildEnv {
      name = "some-wrapper";
      paths = [ git ];
      pathsToLink = [ "/share/man" ];
    })
  ];

  programs.fish.enable = true;
}

and looking at home-manager_generated_completions

With upstream home-manager I find

> ls result/home-files/.local/share/fish/home-manager_generated_completions/tmux.fish
ls: cannot access 'result/home-files/.local/share/fish/home-manager_generated_completions/tmux.fish': No such file or directory

> ls result/home-files/.local/share/fish/home-manager_generated_completions/git.fish
ls: cannot access 'result/home-files/.local/share/fish/home-manager_generated_completions/git.fish': No such file or directory

With the patch I get

> ls result/home-files/.local/share/fish/home-manager_generated_completions/tmux.fish
result/home-files/.local/share/fish/home-manager_generated_completions/tmux.fish

> ls result/home-files/.local/share/fish/home-manager_generated_completions/git.fish
result/home-files/.local/share/fish/home-manager_generated_completions/git.fish

I was able to currently without changes. I'm not positive if I am doing something wrong or if it's perhaps an OSX specific quirk that it works.

Maybe you have entries in $HOME/.local/share/fish/generated_completions? Or maybe fish already had the completions loaded from your previous setup, not sure how fish behaves with removed completion files.

neosimsim avatar May 10 '22 04:05 neosimsim

@pvsr programs.man.generateCaches did not work for me :cry:

neosimsim avatar May 10 '22 04:05 neosimsim

@tjni @pvsr any updates?

neosimsim avatar May 23 '22 12:05 neosimsim

Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting.

If you are the original author of the PR

  • GitHub sometimes doesn't notify people who commented / reviewed a PR previously when you (force) push commits. If you have addressed the reviews you can officially ask for a review from those who commented to you or anyone else.
  • If it is unfinished but you plan to finish it, please mark it as a draft.
  • If you don't expect to work on it any time soon, please consider closing it with a short comment encouraging someone else to pick up your work.
  • To get things rolling again, rebase the PR against the target branch and address valid comments.
If you are not the original author of the PR

  • If you want to pick up the work on this PR, please create a new PR and indicate that it supercedes and closes this PR.

stale[bot] avatar Oct 17 '22 22:10 stale[bot]

Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting.

If you are the original author of the PR

  • GitHub sometimes doesn't notify people who commented / reviewed a PR previously when you (force) push commits. If you have addressed the reviews you can officially ask for a review from those who commented to you or anyone else.
  • If it is unfinished but you plan to finish it, please mark it as a draft.
  • If you don't expect to work on it any time soon, please consider closing it with a short comment encouraging someone else to pick up your work.
  • To get things rolling again, rebase the PR against the target branch and address valid comments.
If you are not the original author of the PR

  • If you want to pick up the work on this PR, please create a new PR and indicate that it supercedes and closes this PR.

stale[bot] avatar Mar 06 '23 11:03 stale[bot]

@tjni @pvsr: Could you have a second look on this? I'm inclined to merge this even if it seems to already work for some. So I'll merge in a day or two unless somebody tells me otherwise πŸ™‚

rycee avatar Jun 23 '23 07:06 rycee

Merged to master now πŸ™‚

rycee avatar Jun 24 '23 11:06 rycee

That’s great. Thank you. I can finally use upstream again πŸ˜…

neosimsim avatar Jun 24 '23 18:06 neosimsim