mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-10 15:35:30 +00:00
Remove embeded dependencies
This commit is contained in:
parent
eac1a7f567
commit
970e4a52cd
5 changed files with 11 additions and 557 deletions
|
|
@ -6,105 +6,33 @@
|
|||
}:
|
||||
with lib;
|
||||
with builtins; let
|
||||
formatter-env = with pkgs;
|
||||
bundlerEnv {
|
||||
name = "Gem dependencies";
|
||||
inherit ruby_3_2;
|
||||
ruby = ruby_3_2;
|
||||
gemdir = ./.;
|
||||
#gemConfig =
|
||||
# pkgs.defaultGemConfig
|
||||
# // {
|
||||
# nokogiri = attrs: {
|
||||
# buildFlags = ["--use-system-libraries"]; # "--with-zlib-include=${pkgs.zlib}/include/libxml2"];
|
||||
#};
|
||||
# };
|
||||
};
|
||||
|
||||
#format-env = pkgs.callPackage ./format-derivation.nix {inherit pkgs;};
|
||||
cfg = config.vim.languages.ruby;
|
||||
|
||||
defaultServer = "rubyserver";
|
||||
defaultServer = "rubocop";
|
||||
servers = {
|
||||
rubyserver = {
|
||||
package = pkgs.rubyPackages_3_2.solargraph.overrideAttrs (
|
||||
fa: oa: {
|
||||
buildInputs = oa.buildInputs ++ [formatter-env];
|
||||
}
|
||||
);
|
||||
solargraph = {
|
||||
package = pkgs.ruby_3_2;
|
||||
|
||||
lspConfig = ''
|
||||
lspconfig.solargraph.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = attach_keymaps,
|
||||
--cmd = { "${pkgs.ruby_3_2}/bin/bundle exec solargraph", "stdio" }
|
||||
cmd = { "${cfg.lsp.package}/bin/solargraph", "stdio" },
|
||||
settings = {
|
||||
solargraph = {
|
||||
diagnostics = true,
|
||||
autoformat = true,
|
||||
-- bundlerPath = "${pkgs.ruby_3_2}/bin/bundler",
|
||||
completion = true,
|
||||
formatting = true,
|
||||
logLevel = "debug",
|
||||
references = true,
|
||||
useBundler = false
|
||||
}
|
||||
}
|
||||
cmd = { "${cfg.lsp.package}/bin/bundle", "exec", "solargraph", "stdio" }
|
||||
}
|
||||
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: specify packages
|
||||
defaultFormat = "rubocop";
|
||||
formats = {
|
||||
rubocop = {
|
||||
package = pkgs.rubyPackages_3_2.rubocop.overrideAttrs (
|
||||
fa: oa: {
|
||||
buildInputs = oa.buildInputs ++ [formatter-env];
|
||||
package = pkgs.ruby_3_2;
|
||||
|
||||
lspConfig = ''
|
||||
lspconfig.rubocop.setup {
|
||||
on_attach = attach_keymaps,
|
||||
cmd = { "${cfg.lsp.package}/bin/bundle", "exec", "rubocop", "--lsp" },
|
||||
}
|
||||
);
|
||||
nullConfig = ''
|
||||
lspconfig.rubocop.setup {
|
||||
on_attach = attach_keymaps,
|
||||
cmd = { "${cfg.format.package}/bin/rubocop", "--require", "${formatter-env}/lib/ruby/gems/3.2.0/gems/rubocop-rails-2.20.2/lib/rubocop-rails.rb"} --, nls.builtins.formatting.rubocop._opts.args }
|
||||
}
|
||||
-- local conditional = function(fn)
|
||||
-- local utils = require("null-ls.utils").make_conditional_utils()
|
||||
-- return fn(utils)
|
||||
-- end
|
||||
--
|
||||
-- table.insert(
|
||||
-- ls_sources,
|
||||
-- null_ls.builtins.formatting.rubocop.with({
|
||||
-- command = "${cfg.format.package}/bin/rubocop",
|
||||
-- args = { "--require", "${formatter-env}/lib/ruby/gems/3.2.0/gems/rubocop-rails-2.20.2/lib/rubocop-rails.rb"}
|
||||
-- })
|
||||
-- )
|
||||
-- or null_ls.builtins.formatting.rubocop.with({
|
||||
-- command = "${cfg.format.package}/bin/rubocop",
|
||||
-- })
|
||||
-- end)
|
||||
-- )
|
||||
'';
|
||||
};
|
||||
};
|
||||
# TODO: specify packages
|
||||
# defaultDiagnostics = ["rubocop"];
|
||||
# diagnostics = {
|
||||
# rubocop = {
|
||||
# package = pkgs.rubyPackages_3_2.rubocop;
|
||||
# nullConfig = pkg: ''
|
||||
# table.insert(
|
||||
# ls_sources,
|
||||
# null_ls.builtins.diagnostics.rubocop.with({
|
||||
# command = "${lib.getExe pkg}",
|
||||
# })
|
||||
# )
|
||||
# '';
|
||||
# };
|
||||
# };
|
||||
in {
|
||||
options.vim.languages.ruby = {
|
||||
enable = mkEnableOption "Ruby/Ruby on Rails language support";
|
||||
|
|
@ -129,32 +57,6 @@ in {
|
|||
default = servers.${cfg.lsp.server}.package;
|
||||
};
|
||||
};
|
||||
|
||||
format = {
|
||||
enable = mkEnableOption "Enable Ruby/RoR formatting" // {default = config.vim.languages.enableFormat;};
|
||||
|
||||
type = mkOption {
|
||||
description = "Ruby/RoR formatter to use";
|
||||
type = with types; enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Ruby/RoR formatter package";
|
||||
type = types.package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
};
|
||||
};
|
||||
|
||||
# extraDiagnostics = {
|
||||
# enable = mkEnableOption "Enable extra Ruby/RoR diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
|
||||
|
||||
# types = lib.nvim.types.diagnostics {
|
||||
# langDesc = "Ruby/RoR";
|
||||
# inherit diagnostics;
|
||||
# inherit defaultDiagnostics;
|
||||
# };
|
||||
# };
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
|
|
@ -167,19 +69,5 @@ in {
|
|||
vim.lsp.lspconfig.enable = true;
|
||||
vim.lsp.lspconfig.sources.ruby-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.ruby-format = formats.${cfg.format.type}.nullConfig;
|
||||
})
|
||||
|
||||
# (mkIf cfg.extraDiagnostics.enable {
|
||||
# vim.lsp.null-ls.enable = true;
|
||||
# vim.lsp.null-ls.sources = lib.nvim.languages.diagnosticsToLua {
|
||||
# lang = "ruby";
|
||||
# config = cfg.extraDiagnostics.types;
|
||||
# inherit diagnostics;
|
||||
# };
|
||||
# })
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue