AstroNvim / astrocommunity

A community repository of common plugin specifications
GNU General Public License v3.0
1.08k stars 222 forks source link

nix pack updates to nixfmt and nixd #883

Open luxus opened 3 months ago

luxus commented 3 months ago

Is your feature related to a problem?

No response

Describe the new feature

nix pack could some updates https://github.com/nix-community/nixd looks like the newest and fastest lsp right now. but it's unstable because of a major rewrite? i changed it locally via https://github.com/nix-community/nixd/blob/main/nixd/docs/editor-setup.md alejandra should be replaced by nixfmt if it makes into 2405 release. (waiting for https://github.com/NixOS/nixfmt/issues/153) it works on unstable with nixpkgs.nixfmt-rfc-style

both is bleeding edge thats my code right now.

return {
  {
    "nvim-treesitter/nvim-treesitter",
    optional = true,
    opts = function(_, opts)
      if opts.ensure_installed ~= "all" then
        opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "nix" })
      end
    end,
  },
  {
    "AstroNvim/astrolsp",
    -- we must use the function override because table merging
    -- does not play nicely with list-like tables
    ---@param opts AstroLSPOpts
    opts = function(plugin, opts)
      -- safely extend the servers list
      opts.servers = opts.servers or {}
      vim.list_extend(opts.servers, {
        "nixd",
        -- add more servers as needed...
      })
    end,
  },
  {
    "nvimtools/none-ls.nvim",
    optional = true,
    opts = function(_, opts)
      local nls = require "null-ls"
      if type(opts.sources) == "table" then
        vim.list_extend(opts.sources, {
          nls.builtins.code_actions.statix,
          nls.builtins.formatting.nixfmt,
          nls.builtins.diagnostics.deadnix,
        })
      end
    end,
  },
  {
    "stevearc/conform.nvim",
    optional = true,
    opts = {
      formatters_by_ft = {
        nix = { "nixfmt" },
      },
    },
  },
  -- {
  --   "mfussenegger/nvim-lint",
  --   optional = true,
  --   opts = {
  --     linters_by_ft = {
  --       nix = { "statix", "nix" },
  --     },
  --   },
  -- },
}

and i guess it makes sense to add deadnix to nvim-lint too https://github.com/bondzula/nvim/blob/7a58fd58857a9a121df9703d4ad132b9bb583e56/lua/plugins/nvim-lint.lua#L9-L41

Additional context

No response

Uzaaft commented 2 months ago

@luxus Feel free to add nixd now that version 2 is released.

Uzaaft commented 4 weeks ago

Still missing nixfmt