Skip to content

programs.neovim: link packpath dir in XDG_DATA_HOME#3717

Merged
teto merged 1 commit intonix-community:masterfrom
teto:neovim-link-packpath-in-xdg
Mar 28, 2023
Merged

programs.neovim: link packpath dir in XDG_DATA_HOME#3717
teto merged 1 commit intonix-community:masterfrom
teto:neovim-link-packpath-in-xdg

Conversation

@teto
Copy link
Copy Markdown
Collaborator

@teto teto commented Feb 28, 2023

link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when developing neovim or when other projects bring their own neovim in PATH). Currently they dont find plugins installed by home-manager in the cases where packpath is not set to the generated nix packpath directory. With this change, neovim can discover HM-installed plugins by itself.

NB: this PR needs this commit NixOS/nixpkgs#218786 from nixpkgs and thus tests will fail until it reaches unstable . Also I remember having a write issue when I first used this PR because home-manager wanted to manage the folder. Let me know if you hit that so we can find a workaround.

Description

Checklist

  • Change is backwards compatible.

  • Code formatted with ./format.

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

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.

    • Added myself and the module files to .github/CODEOWNERS.

@teto teto requested a review from rycee as a code owner February 28, 2023 11:13
@teto teto force-pushed the neovim-link-packpath-in-xdg branch 2 times, most recently from 77168ab to 1562d7a Compare March 6, 2023 13:36
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
Copy link
Copy Markdown
Member

@RaitoBezarius RaitoBezarius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as a NeoVim user.

@teto
Copy link
Copy Markdown
Collaborator Author

teto commented Mar 28, 2023

Ok I'll merge as I think it's more representative of how people want neovim to work (including myself). Remember that you may need to change ~/.local/share/nvim/ away so that HM can deal with it along with your package manager (I use lazy for instance).

@teto teto merged commit deb2f59 into nix-community:master Mar 28, 2023
@teto teto deleted the neovim-link-packpath-in-xdg branch March 28, 2023 08:40
@svrana
Copy link
Copy Markdown
Contributor

svrana commented Mar 28, 2023

I'm using a wrapped neovim and this change appears to cause one of my plugins? to be loaded twice. This results in getting an 'Already loaded' error message when I start neovim. To debug, I ran neovim like this neovim -V2nvim.log and searched for the 'Already loaded' string which I found at line 341

340 sourcing "/nix/store/r6h5damgnb72b2a9gf0hm0mlc09a0rn7-packdir-start/pack/myNeovimPackages/start/vim-latex-live-preview/plugin/latexlivepreview.vim"
Already loaded

(this is from the plugin named: vim-latex-live-preview)

If I search up the file for locations where it was previous loaded, I see it again at line 269.

If I comment out the plugin or remove the site/ directory from XDG_STATE_HOME the error goes away. I've placed the log file at https://gist.github.com/svrana/5c68f834a88eb52fd11e726c0a089906

-- edited

I can send a PR to remove the output from the plugin that's bugging me. I guess I'm wondering if it was intended to attempt to load the plugins twice for a wrapped neovim.

@teto
Copy link
Copy Markdown
Collaborator Author

teto commented Mar 28, 2023

I think this is because your neovim (like everyone else) is wrapped with a --cmd "set packpath..." . so it loads the one at that path plus the one in the standard folder. If you remove this line in nixpkgs https://github.com/nixos/nixpkgs/blob/4bb072f0a8b267613c127684e099a70e1f6ff106/pkgs/applications/editors/neovim/utils.nix#L111 it should fix the issue (it was in my plan to make it configurable in nixpkgs). Until I fix this in nixpkgs, maybe rollback your HM version ? sry I am not sure how to fix cleanly in HM.

@PatrickDaG
Copy link
Copy Markdown

I do not use home manager to manage my plugins, instead adding and configuring them directly in my vim config. This change forced the site directory to be a symlink to the nix store even though it is empty, which in turn prevents my vimconfig from being able to write it and add my plugins. I would suggest only doing this if there are plugins declared in the nix config, or making it optional.

@adrianord
Copy link
Copy Markdown

I am facing the same issue as @PatrickDaG. AstroNvim is managing my plugins with Packer, not using nix for plugin management at all, and this symlink is causing my configuration to fail.

@ncfavier
Copy link
Copy Markdown
Member

I'm going to revert this for now until we figure this out

ncfavier added a commit that referenced this pull request Mar 29, 2023
@ncfavier
Copy link
Copy Markdown
Member

deb2f59#commitcomment-106637065:

Hi,
I manage my plugins via Packer.nvim and don't plan to migrate it to Home Manager. This way I can use my neovim config independently and just reference it from Home Manager to avoid duplication.

This change breaks my nix rebuild, since the site/pack directory generated by Packer is in the way of the new paths that are to be linked.

I'm not sure if there's a workaround to this or if it's just an issue in my setup. Has anyone an idea how to handle this w/o moving my neovim plugin management to Home Manager? Any help is much appreciated.

@teto
Copy link
Copy Markdown
Collaborator Author

teto commented Mar 29, 2023

home-manager should create the fullpath site/pack/HMpack instead so it doesn't conflict. This can be done adjusting some stuff in nixpkgs, but we could have worked around it in HM.

        "nvim/site/pack/HmPackages" = {
          # text = "toto";
          source = "${pkgs.vimUtils.packDir neovimConfig.packpathDirs}/pack/HmPackages";
        };

15cm pushed a commit to 15cm/home-manager that referenced this pull request Apr 22, 2023
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
15cm pushed a commit to 15cm/home-manager that referenced this pull request Apr 22, 2023
teto added a commit to teto/home-manager that referenced this pull request May 1, 2023
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request May 2, 2023
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request May 8, 2023
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request May 13, 2023
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request May 29, 2023
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Nov 12, 2023
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Nov 18, 2023
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Nov 21, 2023
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Nov 26, 2023
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Dec 7, 2023
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Dec 13, 2023
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Jan 4, 2024
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Jan 9, 2024
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Feb 3, 2024
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Feb 14, 2024
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Feb 20, 2024
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Mar 4, 2024
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Mar 14, 2024
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Mar 16, 2024
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Mar 26, 2024
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Apr 4, 2024
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Apr 4, 2024
teto added a commit to teto/home-manager that referenced this pull request Apr 11, 2024
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Apr 20, 2024
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Apr 29, 2024
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request May 27, 2024
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Jun 1, 2024
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Jun 2, 2024
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Jun 10, 2024
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Jun 13, 2024
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
teto added a commit to teto/home-manager that referenced this pull request Jun 24, 2024
link the packpath in expected folder so that even unwrapped neovim can pick home-manager's plugins.

I sometimes need to run neovim not wrapped/configured by nix (when
developing neovim or when other projects bring their own neovim in
PATH). Currently they dont find plugins installed by home-manager in the
cases where packpath is not set to the generated nix packpath directory.
With this change, neovim can discover HM-installed plugins by itself.
@nixos-discourse
Copy link
Copy Markdown

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/cant-load-local-plugin-in-home-manager-installed-neovim/47694/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants