Skip to content

vimPlugins: inherit lua & node packages before overrides#390702

Merged
khaneliman merged 1 commit intoNixOS:masterfrom
MattSturgeon:vim-lua-packages
Mar 17, 2025
Merged

vimPlugins: inherit lua & node packages before overrides#390702
khaneliman merged 1 commit intoNixOS:masterfrom
MattSturgeon:vim-lua-packages

Conversation

@MattSturgeon
Copy link
Contributor

I noticed that since #377508 vimPlugins overrides are not being applied to plugins that are now based on luaPackages.

  • Move lua & node package inheritance to a dedicated file
  • Apply lua & node package inheritance before overrides
  • Simplify impl using lib.pipe

I've added some NOTE comments to each of the plugins with overrides affected by this PR, hopefully this'll aid the review. My assumption is that these overrides are still relevant even after #377508. I can remove these comments if you think they aren't needed.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

- Move lua & node package inheritance to a dedicated file
- Apply lua & node package inheritance before overrides
@github-actions github-actions bot added the 6.topic: vim Advanced text editor label Mar 17, 2025
@MattSturgeon MattSturgeon requested review from GaetanLepage, PerchunPak, khaneliman and teto and removed request for PerchunPak and khaneliman March 17, 2025 16:05
Copy link
Member

@PerchunPak PerchunPak left a comment

Choose a reason for hiding this comment

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

Great solution, thanks!

MattSturgeon added a commit to nix-community/nixvim that referenced this pull request Mar 17, 2025
NixOS/nixpkgs#390702

Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/5d9b5431f967007b3952c057fc92af49a4c5f3b2?narHash=sha256-nkH2Edu9rClcsQp2PYBe8E6fp8LDPi2uDBQ6wyMdeXI%3D' (2025-03-16)
  → 'github:NixOS/nixpkgs/0ca1fc33509563e87989fad2cbc3d39f988570de?narHash=sha256-sgwENLuCiEPZvHOKPPjmmNdeO1xZurC29aWiP1n5X1w%3D' (2025-03-17)
MattSturgeon added a commit to nix-community/nixvim that referenced this pull request Mar 17, 2025
NixOS/nixpkgs#390702

Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/5d9b5431f967007b3952c057fc92af49a4c5f3b2?narHash=sha256-nkH2Edu9rClcsQp2PYBe8E6fp8LDPi2uDBQ6wyMdeXI%3D' (2025-03-16)
  → 'github:NixOS/nixpkgs/0ca1fc33509563e87989fad2cbc3d39f988570de?narHash=sha256-sgwENLuCiEPZvHOKPPjmmNdeO1xZurC29aWiP1n5X1w%3D' (2025-03-17)
Copy link
Contributor

@khaneliman khaneliman left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for finding that

@khaneliman
Copy link
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 390702 --skip-package vimPlugins


x86_64-linux

✅ 91 packages built:
  • vimPlugins.ChatGPT-nvim
  • vimPlugins.CopilotChat-nvim
  • vimPlugins.LuaSnip-snippets-nvim
  • vimPlugins.advanced-git-search-nvim
  • vimPlugins.agitator-nvim
  • vimPlugins.cheatsheet-nvim
  • vimPlugins.cmp-fuzzy-buffer
  • vimPlugins.cmp-fuzzy-path
  • vimPlugins.cmp_luasnip
  • vimPlugins.compiler-nvim
  • vimPlugins.diagram-nvim
  • vimPlugins.dotnet-nvim
  • vimPlugins.easy-dotnet-nvim
  • vimPlugins.faust-nvim
  • vimPlugins.fuzzy-nvim
  • vimPlugins.gitsigns-nvim
  • vimPlugins.hardhat-nvim
  • vimPlugins.haskell-snippets-nvim
  • vimPlugins.image-nvim
  • vimPlugins.leetcode-nvim
  • vimPlugins.lispdocs-nvim
  • vimPlugins.luasnip
  • vimPlugins.luasnip-latex-snippets-nvim
  • vimPlugins.neorg-telescope
  • vimPlugins.neotest
  • vimPlugins.neotest-bash
  • vimPlugins.neotest-dart
  • vimPlugins.neotest-deno
  • vimPlugins.neotest-dotnet
  • vimPlugins.neotest-elixir
  • vimPlugins.neotest-foundry
  • vimPlugins.neotest-go
  • vimPlugins.neotest-golang
  • vimPlugins.neotest-gradle
  • vimPlugins.neotest-gtest
  • vimPlugins.neotest-haskell
  • vimPlugins.neotest-java
  • vimPlugins.neotest-jest
  • vimPlugins.neotest-minitest
  • vimPlugins.neotest-mocha
  • vimPlugins.neotest-pest
  • vimPlugins.neotest-phpunit
  • vimPlugins.neotest-playwright
  • vimPlugins.neotest-plenary
  • vimPlugins.neotest-python
  • vimPlugins.neotest-rspec
  • vimPlugins.neotest-rust
  • vimPlugins.neotest-scala
  • vimPlugins.neotest-testthat
  • vimPlugins.neotest-vitest
  • vimPlugins.neotest-zig
  • vimPlugins.neuron-nvim
  • vimPlugins.nvchad
  • vimPlugins.nvim-coverage
  • vimPlugins.nvim-scissors
  • vimPlugins.obsidian-nvim
  • vimPlugins.octo-nvim
  • vimPlugins.overseer-nvim
  • vimPlugins.remote-sshfs-nvim
  • vimPlugins.rest-nvim
  • vimPlugins.rustaceanvim
  • vimPlugins.sg-nvim
  • vimPlugins.smart-open-nvim
  • vimPlugins.telekasten-nvim
  • vimPlugins.telescope-asynctasks-nvim
  • vimPlugins.telescope-cheat-nvim
  • vimPlugins.telescope-coc-nvim
  • vimPlugins.telescope-dap-nvim
  • vimPlugins.telescope-emoji-nvim
  • vimPlugins.telescope-frecency-nvim
  • vimPlugins.telescope-fzf-native-nvim
  • vimPlugins.telescope-fzf-writer-nvim
  • vimPlugins.telescope-fzy-native-nvim
  • vimPlugins.telescope-git-conflicts-nvim
  • vimPlugins.telescope-github-nvim
  • vimPlugins.telescope-glyph-nvim
  • vimPlugins.telescope-live-grep-args-nvim
  • vimPlugins.telescope-lsp-handlers-nvim
  • vimPlugins.telescope-media-files-nvim
  • vimPlugins.telescope-nvim
  • vimPlugins.telescope-smart-history-nvim
  • vimPlugins.telescope-symbols-nvim
  • vimPlugins.telescope-ui-select-nvim
  • vimPlugins.telescope-ultisnips-nvim
  • vimPlugins.telescope-undo-nvim
  • vimPlugins.telescope-vim-bookmarks-nvim
  • vimPlugins.telescope-z-nvim
  • vimPlugins.telescope-zf-native-nvim
  • vimPlugins.telescope-zoxide
  • vimPlugins.zotcite
  • vimPluginsUpdater

@khaneliman khaneliman merged commit 0f80da4 into NixOS:master Mar 17, 2025
1 check passed
};

# NOTE: this overrides a luaPackages-based plugin
gitsigns-nvim = super.gitsigns-nvim.overrideAttrs {
Copy link
Member

Choose a reason for hiding this comment

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

the main driver for using buildNeovimPlugin is to not have to add dependencies. Could this have been deleted instead ? same remark for the rest.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nixvim's update has been blocked for a while because these overrides were no longer being applied (they we're being silently shadowed by the luaPackages-based plugins). So at least currently, most of them are still needed.

I agree, ideally buildNeovimPlugin and/or toVimPackage would correctly propagate the underlying lua package's dependencies, however it seems like that isn't currently happening.

It's also possible that the dependencies are being propagated, but there is an issue in nixvim's combine-plugins impl. IIRC we only saw errors when combine-pluigins was being used.

Either way, overrides shouldn't be silently ignored, and this PR fixes that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's also possible that the dependencies are being propagated, but there is an issue in nixvim's combine-plugins impl

Looking at nixvim's impl, that may be the case. It looks like we explicitly flat-map plugins and their dependencies but don't consider things like propagatedBuildInputs.

https://github.com/nix-community/nixvim/blob/33097dcf776d1fad0ff3842096c4e3546312f251/modules/top-level/output.nix#L209-L215

@MattSturgeon MattSturgeon deleted the vim-lua-packages branch March 17, 2025 17:10
@teto
Copy link
Member

teto commented Mar 17, 2025

NOTE: this overrides a luaPackages-based plugin

These comments look liked debug comments. Maybe because the plugin definition have been moved to another file while before you could have jsut searched them within the file.

The PR changes the infra enough that this could have waited for more feedback rather than a blitzmerge. Some bikeshedding for instance. Like extras.nix is not very descriptive.

GaetanLepage pushed a commit to nix-community/nixvim that referenced this pull request Mar 18, 2025
NixOS/nixpkgs#390702

Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/5d9b5431f967007b3952c057fc92af49a4c5f3b2?narHash=sha256-nkH2Edu9rClcsQp2PYBe8E6fp8LDPi2uDBQ6wyMdeXI%3D' (2025-03-16)
  → 'github:NixOS/nixpkgs/0ca1fc33509563e87989fad2cbc3d39f988570de?narHash=sha256-sgwENLuCiEPZvHOKPPjmmNdeO1xZurC29aWiP1n5X1w%3D' (2025-03-17)
GaetanLepage pushed a commit to nix-community/nixvim that referenced this pull request Mar 18, 2025
NixOS/nixpkgs#390702

Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/5d9b5431f967007b3952c057fc92af49a4c5f3b2?narHash=sha256-nkH2Edu9rClcsQp2PYBe8E6fp8LDPi2uDBQ6wyMdeXI%3D' (2025-03-16)
  → 'github:NixOS/nixpkgs/0ca1fc33509563e87989fad2cbc3d39f988570de?narHash=sha256-sgwENLuCiEPZvHOKPPjmmNdeO1xZurC29aWiP1n5X1w%3D' (2025-03-17)
@teto
Copy link
Member

teto commented Mar 23, 2025

it would be neat if we could remove those overrides before release or alternatively move them to extra.nix ?
There would be no need for # NOTE: this overrides a luaPackages-based plugin anymore as it would be obvious ?!

@MattSturgeon
Copy link
Contributor Author

As per my original description, those notes were mainly intended to aid the PR review and highlight overrides that should probably be removed at some point.

I think it's fine for extra.nix to focus on introducing/inheriting packages while overrides.nix contains any bespoke overrides, regardless of where the base package comes from.

IMO once we've figured out which overrides are needed, the ones that aren't needed can be dropped and the others can have the comment removed. At that point it shouldn't matter where the base package came from.


I'm starting to suspect that most of the overrides shouldn't be necessary, and the reason not having the dependencies attribute broke nixvim is due to its combinePlugins option not correctly handling propagated inputs.

None of us in nixvim are too familiar with buildNeovimPlugin and our combinePlugins option was written by a third party contributor, so it's been a struggle to pinpoint the issue. 😅

@khaneliman khaneliman mentioned this pull request Mar 23, 2025
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: vim Advanced text editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants