diff --git a/modules/languages/ruby/Gemfile b/modules/languages/ruby/Gemfile deleted file mode 100644 index a96201bf..00000000 --- a/modules/languages/ruby/Gemfile +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -source "https://rubygems.org" -gem "rubocop" -gem "rubocop-rails" -gem "rubocop-rspec" -gem "rubocop-minitest" -gem "rubocop-sequel" -gem "rubocop-rake" -gem "rubocop-graphql" -gem "rubocop-capybara" -gem "rubocop-factory_bot" -gem "rubocop-performance" -# gem "rails" diff --git a/modules/languages/ruby/Gemfile.lock b/modules/languages/ruby/Gemfile.lock deleted file mode 100644 index b7f53e34..00000000 --- a/modules/languages/ruby/Gemfile.lock +++ /dev/null @@ -1,82 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - activesupport (7.0.6) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 1.6, < 2) - minitest (>= 5.1) - tzinfo (~> 2.0) - ast (2.4.2) - concurrent-ruby (1.2.2) - i18n (1.14.1) - concurrent-ruby (~> 1.0) - json (2.6.3) - language_server-protocol (3.17.0.3) - minitest (5.18.1) - parallel (1.23.0) - parser (3.2.2.3) - ast (~> 2.4.1) - racc - racc (1.7.1) - rack (3.0.8) - rainbow (3.1.1) - regexp_parser (2.8.1) - rexml (3.2.5) - rubocop (1.54.2) - json (~> 2.3) - language_server-protocol (>= 3.17.0) - parallel (~> 1.10) - parser (>= 3.2.2.3) - rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.0, < 2.0) - ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.29.0) - parser (>= 3.2.1.0) - rubocop-capybara (2.18.0) - rubocop (~> 1.41) - rubocop-factory_bot (2.23.1) - rubocop (~> 1.33) - rubocop-graphql (1.3.0) - rubocop (>= 0.87, < 2) - rubocop-minitest (0.31.0) - rubocop (>= 1.39, < 2.0) - rubocop-performance (1.18.0) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) - rubocop-rails (2.20.2) - activesupport (>= 4.2.0) - rack (>= 1.1) - rubocop (>= 1.33.0, < 2.0) - rubocop-rake (0.6.0) - rubocop (~> 1.0) - rubocop-rspec (2.22.0) - rubocop (~> 1.33) - rubocop-capybara (~> 2.17) - rubocop-factory_bot (~> 2.22) - rubocop-sequel (0.3.4) - rubocop (~> 1.0) - ruby-progressbar (1.13.0) - tzinfo (2.0.6) - concurrent-ruby (~> 1.0) - unicode-display_width (2.4.2) - -PLATFORMS - x86_64-linux - -DEPENDENCIES - rubocop - rubocop-capybara - rubocop-factory_bot - rubocop-graphql - rubocop-minitest - rubocop-performance - rubocop-rails - rubocop-rake - rubocop-rspec - rubocop-sequel - -BUNDLED WITH - 2.4.14 diff --git a/modules/languages/ruby/format-derivation.nix b/modules/languages/ruby/format-derivation.nix deleted file mode 100644 index 0fa5672f..00000000 --- a/modules/languages/ruby/format-derivation.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ - pkgs, - stdenv, -}: 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"]; - # }; - # }; - # }; -in - stdenv.mkDerivation { - name = "Format environment"; - - # nativeBuildInputs = [ - # pkgs.libxslt - # pkgs.zlib - # pkgs.libxml2 - # pkgs.pkg-config - # pkgs.rubocop - # pkgs.solargraph - # ]; - - # Add the derivation to the PATH - buildInputs = [ - pkgs.libxslt - pkgs.libxml2 - pkgs.rubocop - pkgs.solargraph - - # formatter-env - ]; - } diff --git a/modules/languages/ruby/gemset.nix b/modules/languages/ruby/gemset.nix deleted file mode 100644 index 8d152dbe..00000000 --- a/modules/languages/ruby/gemset.nix +++ /dev/null @@ -1,297 +0,0 @@ -{ - activesupport = { - dependencies = ["concurrent-ruby" "i18n" "minitest" "tzinfo"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1cjsf26656996hv48wgv2mkwxf0fy1qc68ikgzq7mzfq2mmvmayk"; - type = "gem"; - }; - version = "7.0.6"; - }; - ast = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "04nc8x27hlzlrr5c2gn7mar4vdr0apw5xg22wp6m8dx3wqr04a0y"; - type = "gem"; - }; - version = "2.4.2"; - }; - concurrent-ruby = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0krcwb6mn0iklajwngwsg850nk8k9b35dhmc2qkbdqvmifdi2y9q"; - type = "gem"; - }; - version = "1.2.2"; - }; - i18n = { - dependencies = ["concurrent-ruby"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0qaamqsh5f3szhcakkak8ikxlzxqnv49n2p7504hcz2l0f4nj0wx"; - type = "gem"; - }; - version = "1.14.1"; - }; - json = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0nalhin1gda4v8ybk6lq8f407cgfrj6qzn234yra4ipkmlbfmal6"; - type = "gem"; - }; - version = "2.6.3"; - }; - language_server-protocol = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0gvb1j8xsqxms9mww01rmdl78zkd72zgxaap56bhv8j45z05hp1x"; - type = "gem"; - }; - version = "3.17.0.3"; - }; - minitest = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1kg9wh7jlc9zsr3hkhpzkbn0ynf4np5ap9m2d8xdrb8shy0y6pmb"; - type = "gem"; - }; - version = "5.18.1"; - }; - parallel = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0jcc512l38c0c163ni3jgskvq1vc3mr8ly5pvjijzwvfml9lf597"; - type = "gem"; - }; - version = "1.23.0"; - }; - parser = { - dependencies = ["ast" "racc"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1swigds85jddb5gshll1g8lkmbcgbcp9bi1d4nigwvxki8smys0h"; - type = "gem"; - }; - version = "3.2.2.3"; - }; - racc = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "11v3l46mwnlzlc371wr3x6yylpgafgwdf0q7hc7c1lzx6r414r5g"; - type = "gem"; - }; - version = "1.7.1"; - }; - rack = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0j3j8lxb3pda25lq9l3661rjd99a3z2ky6cqxbg7sdmvnwpr2b4w"; - type = "gem"; - }; - version = "3.0.8"; - }; - rainbow = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0smwg4mii0fm38pyb5fddbmrdpifwv22zv3d3px2xx497am93503"; - type = "gem"; - }; - version = "3.1.1"; - }; - regexp_parser = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "136br91alxdwh1s85z912dwz23qlhm212vy6i3wkinz3z8mkxxl3"; - type = "gem"; - }; - version = "2.8.1"; - }; - rexml = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "08ximcyfjy94pm1rhcx04ny1vx2sk0x4y185gzn86yfsbzwkng53"; - type = "gem"; - }; - version = "3.2.5"; - }; - rubocop = { - dependencies = ["json" "language_server-protocol" "parallel" "parser" "rainbow" "regexp_parser" "rexml" "rubocop-ast" "ruby-progressbar" "unicode-display_width"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1hc469ahgpfwbvv2q3hqlhp7dlzcii8dlm8k6k324sq26lilv27r"; - type = "gem"; - }; - version = "1.54.2"; - }; - rubocop-ast = { - dependencies = ["parser"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "188bs225kkhrb17dsf3likdahs2p1i1sqn0pr3pvlx50g6r2mnni"; - type = "gem"; - }; - version = "1.29.0"; - }; - rubocop-capybara = { - dependencies = ["rubocop"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "01fn05a87g009ch1sh00abdmgjab87i995msap26vxq1a5smdck6"; - type = "gem"; - }; - version = "2.18.0"; - }; - rubocop-factory_bot = { - dependencies = ["rubocop"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0kqchl8f67k2g56sq2h1sm2wb6br5gi47s877hlz94g5086f77n1"; - type = "gem"; - }; - version = "2.23.1"; - }; - rubocop-graphql = { - dependencies = ["rubocop"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1afxc4ff1ykws8l7wkxqacx2hbm0wvz635vbcqkycwibfx6968vc"; - type = "gem"; - }; - version = "1.3.0"; - }; - rubocop-minitest = { - dependencies = ["rubocop"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1gm31ny25cpw9mwbwfxbg3wxzqkcykxk4pwxwdwbvxsc2yjh3fw7"; - type = "gem"; - }; - version = "0.31.0"; - }; - rubocop-performance = { - dependencies = ["rubocop" "rubocop-ast"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0bp02784v0qm8qcswi169s0ar6216rwk516v3idzpbxznpqp97ac"; - type = "gem"; - }; - version = "1.18.0"; - }; - rubocop-rails = { - dependencies = ["activesupport" "rack" "rubocop"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "05r46ds0dm44fb4p67hbz721zck8mdwblzssz2y25yh075hvs36j"; - type = "gem"; - }; - version = "2.20.2"; - }; - rubocop-rake = { - dependencies = ["rubocop"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1nyq07sfb3vf3ykc6j2d5yq824lzq1asb474yka36jxgi4hz5djn"; - type = "gem"; - }; - version = "0.6.0"; - }; - rubocop-rspec = { - dependencies = ["rubocop" "rubocop-capybara" "rubocop-factory_bot"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "00rsflhijcr0q838fgbdmk7knm5kcjpimn6x0k9qmiw15hi96x1d"; - type = "gem"; - }; - version = "2.22.0"; - }; - rubocop-sequel = { - dependencies = ["rubocop"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1jfdw5vfw77r19njzjn5j055jv7401rr7497flcx5p85sa90dydy"; - type = "gem"; - }; - version = "0.3.4"; - }; - ruby-progressbar = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0cwvyb7j47m7wihpfaq7rc47zwwx9k4v7iqd9s1xch5nm53rrz40"; - type = "gem"; - }; - version = "1.13.0"; - }; - tzinfo = { - dependencies = ["concurrent-ruby"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "16w2g84dzaf3z13gxyzlzbf748kylk5bdgg3n1ipvkvvqy685bwd"; - type = "gem"; - }; - version = "2.0.6"; - }; - unicode-display_width = { - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1gi82k102q7bkmfi7ggn9ciypn897ylln1jk9q67kjhr39fj043a"; - type = "gem"; - }; - version = "2.4.2"; - }; -} diff --git a/modules/languages/ruby/ruby.nix b/modules/languages/ruby/ruby.nix index 4335daea..0cbb6032 100644 --- a/modules/languages/ruby/ruby.nix +++ b/modules/languages/ruby/ruby.nix @@ -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; - # }; - # }) ]); }