mason.nvim icon indicating copy to clipboard operation
mason.nvim copied to clipboard

Add Global with_paths Setting Support

Open linw1995 opened this issue 4 months ago • 0 comments

I've searched open issues for similar requests

  • [x] Yes

Is your feature request related to a problem? Please describe.

I use Nix to build my development environment and prefer to keep it as clean as possible. However, mason.nvim requires installers to be available in the global scope, which conflicts with my isolated environment setup.

Describe the solution you'd like

Add support for a global with_paths configuration option that allows users to specify additional PATH environment variables when mason.nvim spawns installer processes during package installation.

Describe potential alternatives you've considered

I implemented this feature 3 weeks ago and it has been working well in my build. Below are code snippets from my Neovim setup that demonstrate the configuration.

Nix Configuration

{
  "${config_root}/lua/config/nixpkgs-passthrough.lua" = let
    masonPackages = with pkgs; [
      go
      cargo
      nodejs
      python3
    ];
    masonPaths = lib.strings.concatStringsSep ",\n  " (map (pkg: ''"${pkg}/bin"'') masonPackages);
  in {
    text = ''
      vim.g.mason_with_paths = {${masonPaths}}
    '';
  };
}

Lua Plugin Configuration

return {
  "mason-org/mason.nvim",
  url = "https://github.com/linw1995/mason.nvim.git",
  opts = {
    with_paths = vim.g.mason_with_paths or {},
  },
}

This implementation dynamically generates the required paths from Nix packages and makes them available to mason.nvim through the with_paths configuration option. Thank you for considering this feature request!

Additional context

No response

linw1995 avatar Aug 20 '25 10:08 linw1995