From ab8eea9719e871b6ef120ef385adb22ab510c05b Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Fri, 17 May 2024 19:34:24 +0200 Subject: [PATCH] feat: manage luarocks installation as rockspec dependency --- .github/workflows/luarocks.yml | 1 + bootstrap.lua | 7 ++-- doc/rocks.txt | 2 +- flake.lock | 44 ++++++++++++------------- installer.lua | 10 +++--- lua/rocks/config/init.lua | 2 +- lua/rocks/config/internal.lua | 31 +++++++++++++++-- lua/rocks/loader.lua | 13 +++++--- lua/rocks/luarocks.lua | 14 ++++++-- nix/plugin-overlay.nix | 29 ++++++++++++++-- nix/test-overlay.nix | 1 + plugin/rocks.lua | 1 + rocks.nvim-scm-1.rockspec | 2 ++ spec/adapter_spec.lua | 1 + spec/loader_spec.lua | 3 ++ spec/operations/bulk_install_spec.lua | 1 + spec/operations/helpers_spec.lua | 1 + spec/operations/install_update_spec.lua | 1 + spec/operations/pin_commands_spec.lua | 1 + spec/operations/pin_spec.lua | 1 + spec/operations/sync_spec.lua | 1 + 21 files changed, 123 insertions(+), 44 deletions(-) diff --git a/.github/workflows/luarocks.yml b/.github/workflows/luarocks.yml index 951a52a1..e3f35018 100644 --- a/.github/workflows/luarocks.yml +++ b/.github/workflows/luarocks.yml @@ -31,6 +31,7 @@ jobs: version: ${{ env.LUAROCKS_VERSION }} test_interpreters: "" dependencies: | + luarocks >= 3.11.1, < 4.0.0 toml-edit >= 0.3.6 fidget.nvim >= 1.1.0 fzy diff --git a/bootstrap.lua b/bootstrap.lua index 0666d69e..4fa2765c 100644 --- a/bootstrap.lua +++ b/bootstrap.lua @@ -11,7 +11,10 @@ math.randomseed(os.time()) local config_data = vim.g.rocks_nvim or {} local install_path = config_data.rocks_path or vim.fs.joinpath(vim.fn.stdpath("data") --[[@as string]], "rocks") -local luarocks_binary = config_data.luarocks_binary or vim.fs.joinpath(install_path, "bin", "luarocks") +local temp_luarocks_path = + ---@diagnostic disable-next-line: param-type-mismatch + vim.fs.joinpath(vim.fn.stdpath("run"), ("luarocks-%X"):format(math.random(256 ^ 7))) +local luarocks_binary = vim.fs.joinpath(temp_luarocks_path, "bin", "luarocks") ---@param dep string ---@return boolean is_missing @@ -104,7 +107,7 @@ local function set_up_luarocks(path) return true end -assert(set_up_luarocks(install_path), "failed to install luarocks! Please try again :)") +assert(set_up_luarocks(temp_luarocks_path), "failed to install luarocks! Please try again :)") vim.notify("Installing rocks.nvim...") diff --git a/doc/rocks.txt b/doc/rocks.txt index 280d2f1e..30bc9a7b 100644 --- a/doc/rocks.txt +++ b/doc/rocks.txt @@ -62,7 +62,7 @@ RocksOpts *RocksOpts* Fields: ~ {rocks_path?} (string) Local path in your filesystem to install rocks. Defaults to a `rocks` directory in `vim.fn.stdpath("data")`. {config_path?} (string) Rocks declaration file path. Defaults to `rocks.toml` in `vim.fn.stdpath("config")`. - {luarocks_binary?} (string) Luarocks binary path. Defaults to `luarocks`. + {luarocks_binary?} (string) Luarocks binary path. Defaults to `{rocks_path}/bin/luarocks`. {lazy?} (boolean) Whether to query luarocks.org lazily. Defaults to `false`. Setting this to `true` may improve startup time, but features like auto-completion will lag initially. {dynamic_rtp?} (boolean) Whether to automatically add freshly installed plugins to the 'runtimepath'. Defaults to `true` for the best default experience. {generate_help_pages?} (boolean) Whether to re-generate plugins help pages after installation/upgrade. diff --git a/flake.lock b/flake.lock index fb03e04f..c9481b6f 100644 --- a/flake.lock +++ b/flake.lock @@ -121,11 +121,11 @@ "nixpkgs-lib": "nixpkgs-lib_3" }, "locked": { - "lastModified": 1715865404, - "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=", + "lastModified": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", "type": "github" }, "original": { @@ -143,11 +143,11 @@ ] }, "locked": { - "lastModified": 1715865404, - "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=", + "lastModified": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", "type": "github" }, "original": { @@ -345,11 +345,11 @@ "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1717219491, - "narHash": "sha256-3mlNyu3p7EF65sojsaFwQud2Fo0ew1gRQYOqlmPlh/I=", + "lastModified": 1717392362, + "narHash": "sha256-sgCg3MHIAdVxQMGe4aCcueu2nj2tOoLvkyphOe57PNc=", "owner": "nvim-neorocks", "repo": "neorocks", - "rev": "e3ae683981790e443294c93471b2b0def85f04a7", + "rev": "7754bc30ab9efdb9255a88a3646ac0edc622a4df", "type": "github" }, "original": { @@ -368,11 +368,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1717214603, - "narHash": "sha256-GHZpwwZe7LVYCQGp05oFQ653oiP3jgin+bgZSOgp3uE=", + "lastModified": 1717311741, + "narHash": "sha256-iZbUT3oz+4sG+StUW+oApwK4eADQQOdkU/AWY5T/r0E=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "15fae73bcb20aad8fe2c88373d77a2b71dd13f5a", + "rev": "67e84c020323a28f33ad4498f022a7b2c67719ad", "type": "github" }, "original": { @@ -384,11 +384,11 @@ "neovim-src": { "flake": false, "locked": { - "lastModified": 1717166885, - "narHash": "sha256-HcvLlqj4SaBEqjf1aVnH0Jig1oVwrX/LWNbAx0Sx5Jk=", + "lastModified": 1717280958, + "narHash": "sha256-1k0brOQVt5idsf7WHPbig/ASgSl6pzFb2lyPYfFeo1U=", "owner": "neovim", "repo": "neovim", - "rev": "d62d181ce065556be51d5eda0425aa42f427cc27", + "rev": "05435a915a8446a8c2d824551fbea2dc1d7b5e98", "type": "github" }, "original": { @@ -439,14 +439,14 @@ }, "nixpkgs-lib_3": { "locked": { - "lastModified": 1714640452, - "narHash": "sha256-QBx10+k6JWz6u7VsohfSw8g8hjdBZEf8CFzXH1/1Z94=", + "lastModified": 1717284937, + "narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" } }, "nixpkgs-stable": { @@ -531,11 +531,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1717290166, - "narHash": "sha256-Jy6zphKMNNnLd5+nVFVYRm7+dEBqYqGF1ugfkM3HIkA=", + "lastModified": 1717426394, + "narHash": "sha256-Jexij76wLjk7Ks/zCbzl/GjdfsR/gWSSUmaoBnjR+hY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "afa9e41dccd70f7c13bb76b9ab20a2dd38c897a2", + "rev": "5c954f70b7058c2f11edec1c96713d0f683b3d1c", "type": "github" }, "original": { diff --git a/installer.lua b/installer.lua index 1c696897..22cab0a5 100644 --- a/installer.lua +++ b/installer.lua @@ -349,15 +349,18 @@ local function install() if line == "< OK >" then local install_path = input_fields.install_path.content local setup_luarocks = input_fields.setup_luarocks.content == "true" + local temp_luarocks_path = + ---@diagnostic disable-next-line: param-type-mismatch + vim.fs.joinpath(vim.fn.stdpath("run"), ("luarocks-%X"):format(math.random(256 ^ 7))) local luarocks_binary = "luarocks" if setup_luarocks then - local success = set_up_luarocks(install_path) + local success = set_up_luarocks(temp_luarocks_path) if not success then return end - luarocks_binary = vim.fs.joinpath(install_path, "bin", "luarocks") + luarocks_binary = vim.fs.joinpath(temp_luarocks_path, "bin", "luarocks") elseif vim.fn.executable(luarocks_binary) ~= 1 then vim.notify( luarocks_binary @@ -389,7 +392,6 @@ local function install() acquire_buffer_lock(buffer, function() local install_path_rel = install_path:gsub(vim.env.HOME, "") - local luarocks_binary_rel = luarocks_binary:gsub(vim.env.HOME, "") vim.api.nvim_buf_set_lines(buffer, 0, -1, true, { "INSTALLATION COMPLETE", @@ -399,7 +401,6 @@ local function install() ">lua", " local rocks_config = {", ' rocks_path = vim.env.HOME .. "' .. install_path_rel .. '",', - ' luarocks_binary = vim.env.HOME .. "' .. luarocks_binary_rel .. '",', " }", " ", " vim.g.rocks_nvim = rocks_config", @@ -437,7 +438,6 @@ local function install() vim.fn.setreg('"', { "local rocks_config = {", ' rocks_path = vim.env.HOME .. "' .. install_path_rel .. '",', - ' luarocks_binary = vim.env.HOME .. "' .. luarocks_binary_rel .. '",', "}", "", "vim.g.rocks_nvim = rocks_config", diff --git a/lua/rocks/config/init.lua b/lua/rocks/config/init.lua index 87fd10a7..46ffc626 100644 --- a/lua/rocks/config/init.lua +++ b/lua/rocks/config/init.lua @@ -16,7 +16,7 @@ local config = {} ---@class RocksOpts ---@field rocks_path? string Local path in your filesystem to install rocks. Defaults to a `rocks` directory in `vim.fn.stdpath("data")`. ---@field config_path? string Rocks declaration file path. Defaults to `rocks.toml` in `vim.fn.stdpath("config")`. ----@field luarocks_binary? string Luarocks binary path. Defaults to `luarocks`. +---@field luarocks_binary? string Luarocks binary path. Defaults to `{rocks_path}/bin/luarocks`. ---@field lazy? boolean Whether to query luarocks.org lazily. Defaults to `false`. Setting this to `true` may improve startup time, but features like auto-completion will lag initially. ---@field dynamic_rtp? boolean Whether to automatically add freshly installed plugins to the 'runtimepath'. Defaults to `true` for the best default experience. ---@field generate_help_pages? boolean Whether to re-generate plugins help pages after installation/upgrade. diff --git a/lua/rocks/config/internal.lua b/lua/rocks/config/internal.lua index 6e4eacfc..47b87240 100644 --- a/lua/rocks/config/internal.lua +++ b/lua/rocks/config/internal.lua @@ -20,17 +20,30 @@ local config = {} local constants = require("rocks.constants") local fs = require("rocks.fs") +---@diagnostic disable-next-line: param-type-mismatch +local default_rocks_path = vim.fs.joinpath(vim.fn.stdpath("data"), "rocks") + +---@param rocks_path string +---@return string +local function get_default_luarocks_binary(rocks_path) + -- NOTE: On Windows, the binary installed with the luarocks rock is luarocks.bat, + -- but that doesn't seem to work with vim.system. + local default_luarocks_path = vim.fs.joinpath(rocks_path, "bin", "luarocks") + return vim.uv.fs_stat(default_luarocks_path) and default_luarocks_path or "luarocks" +end + +local default_luarocks_binary = get_default_luarocks_binary(default_rocks_path) + --- rocks.nvim default configuration ---@class RocksConfig local default_config = { ---@type string Local path in your filesystem to install rocks - ---@diagnostic disable-next-line: param-type-mismatch - rocks_path = vim.fs.joinpath(vim.fn.stdpath("data"), "rocks"), + rocks_path = default_rocks_path, ---@type string Rocks declaration file path ---@diagnostic disable-next-line: param-type-mismatch config_path = vim.fs.joinpath(vim.fn.stdpath("config"), "rocks.toml"), ---@type string Luarocks binary path - luarocks_binary = "luarocks", + luarocks_binary = get_default_luarocks_binary(default_rocks_path), ---@type boolean Whether to query luarocks.org lazily lazy = false, ---@type boolean Whether to automatically add freshly installed plugins to the 'runtimepath' @@ -41,6 +54,10 @@ local default_config = { reinstall_dev_rocks_on_update = true, ---@type boolean Whether to use the luarocks loader to support multiple dependencies enable_luarocks_loader = true, + + -- Internal configs + ---@type string + default_luarocks_binary = default_luarocks_binary, ---@class RocksConfigDebugInfo debug_info = { ---@type boolean @@ -90,6 +107,14 @@ config = vim.tbl_deep_extend("force", { }, default_config, opts) ---@cast config RocksConfig +if not opts.luarocks_binary and opts.rocks_path and opts.rocks_path ~= default_rocks_path then + -- luarocks_binary has not been overridden, but rocks_path has + ---@diagnostic disable-next-line: inject-field + config.default_luarocks_binary = get_default_luarocks_binary(opts.rocks_path) + ---@diagnostic disable-next-line: inject-field + config.luarocks_binary = config.default_luarocks_binary +end + local ok, err = check.validate(config) if not ok then vim.notify("Rocks: " .. err, vim.log.levels.ERROR) diff --git a/lua/rocks/loader.lua b/lua/rocks/loader.lua index 48409be1..0569a3f5 100644 --- a/lua/rocks/loader.lua +++ b/lua/rocks/loader.lua @@ -3,8 +3,14 @@ local loader = {} local log = require("rocks.log") local config = require("rocks.config.internal") +---@return string | nil local function get_luarocks_lua_dir_from_luarocks() - local sc = vim.system({ config.luarocks_binary, "--lua-version=5.1", "which", "luarocks.loader" }):wait() + local ok, so = pcall(vim.system, { config.luarocks_binary, "--lua-version=5.1", "which", "luarocks.loader" }) + if not ok then + log.error(("Could not invoke luarocks at %s"):format(config.luarocks_binary)) + return + end + local sc = so:wait() local result = sc.stdout and sc.stdout:match(vim.fs.joinpath("(%S+)", "5.1", "luarocks", "loader.lua")) return result end @@ -12,9 +18,8 @@ end ---@return boolean function loader.enable() log.trace("Enabling luarocks loader") - local default_luarocks_binary = vim.fs.joinpath(config.rocks_path, "bin", "luarocks") - local luarocks_lua_dir = config.luarocks_binary == default_luarocks_binary - and vim.fs.joinpath(default_luarocks_binary, "share", "lua") + local luarocks_lua_dir = config.luarocks_binary == config.default_luarocks_binary + and vim.fs.joinpath(config.rocks_path, "share", "lua") or get_luarocks_lua_dir_from_luarocks() if luarocks_lua_dir then package.path = package.path diff --git a/lua/rocks/luarocks.lua b/lua/rocks/luarocks.lua index 49e5dafc..56a1cb14 100644 --- a/lua/rocks/luarocks.lua +++ b/lua/rocks/luarocks.lua @@ -45,10 +45,9 @@ local function mk_server_args(servers) end ---@param args string[] luarocks CLI arguments ----@param on_exit (function|nil) Called asynchronously when the luarocks command exits. +---@param on_exit fun(sc: vim.SystemCompleted)|nil Called asynchronously when the luarocks command exits. --- asynchronously. Receives SystemCompleted object, see return of SystemObj:wait(). ---@param opts? LuarocksCliOpts ----@return vim.SystemObj ---@see vim.system luarocks.cli = function(args, on_exit, opts) opts = opts or {} @@ -86,7 +85,16 @@ luarocks.cli = function(args, on_exit, opts) luarocks_cmd = vim.list_extend(luarocks_cmd, args) log.info(luarocks_cmd) opts.detach = true -- Prevent luarocks from exiting uncleanly - return vim.system(luarocks_cmd, opts, on_exit_wrapped) + local ok, err = pcall(vim.system, luarocks_cmd, opts, on_exit_wrapped) + if not ok then + ---@type vim.SystemCompleted + local sc = { + code = 1, + signal = 0, + stderr = ("Failed to invoke luarocks at %s: %s"):format(config.luarocks_binary, err), + } + on_exit_wrapped(sc) + end end ---@class LuarocksSearchOpts diff --git a/nix/plugin-overlay.nix b/nix/plugin-overlay.nix index 3e991df8..17ef9a42 100644 --- a/nix/plugin-overlay.nix +++ b/nix/plugin-overlay.nix @@ -4,6 +4,29 @@ }: final: prev: let lib = final.lib; rocks-nvim-luaPackage-override = luaself: luaprev: { + # Workaround for https://github.com/NixOS/nixpkgs/issues/316009 + luarocks-rock = luaself.callPackage ({ + buildLuarocksPackage, + fetchFromGitHub, + fetchurl, + }: + buildLuarocksPackage { + pname = "luarocks"; + version = "3.11.1-1"; + knownRockspec = + (fetchurl { + url = "mirror://luarocks/luarocks-3.11.1-1.rockspec"; + sha256 = "0xg0siza8nlnnkaarmw73q12qx3frlfbysd5ipmxxi1d7yc38bbn"; + }) + .outPath; + src = fetchFromGitHub { + owner = "luarocks"; + repo = "luarocks"; + rev = "v3.11.1"; + hash = "sha256-GglygI8HP+aDFEuucOkjQ2Pgfv4+jW+og+2vL3KoZCQ="; + }; + }) {}; + toml-edit = (luaself.callPackage ({ buildLuarocksPackage, @@ -133,7 +156,7 @@ luaOlder, buildLuarocksPackage, lua, - luarocks, + luarocks-rock, toml-edit, fidget-nvim, nvim-nio, @@ -147,7 +170,7 @@ src = self; disabled = luaOlder "5.1"; propagatedBuildInputs = [ - luarocks + luarocks-rock toml-edit fidget-nvim nvim-nio @@ -200,7 +223,7 @@ in { -- Copied from installer.lua local rocks_config = { rocks_path = vim.fn.stdpath("data") .. "/rocks", - luarocks_binary = "${final.lua51Packages.luarocks}/bin/luarocks", + luarocks_binary = "${final.lua51Packages.luarocks-rock}/bin/luarocks", } vim.g.rocks_nvim = rocks_config diff --git a/nix/test-overlay.nix b/nix/test-overlay.nix index cd0a27c7..743655d8 100644 --- a/nix/test-overlay.nix +++ b/nix/test-overlay.nix @@ -8,6 +8,7 @@ neovim = nvim; luaPackages = ps: with ps; [ + luarocks-rock toml-edit toml fidget-nvim diff --git a/plugin/rocks.lua b/plugin/rocks.lua index 9a648fe8..2d6c6eea 100644 --- a/plugin/rocks.lua +++ b/plugin/rocks.lua @@ -17,6 +17,7 @@ if vim.fn.has("nvim-" .. min_version) ~= 1 then end local log = require("rocks.log") +log.info(vim.uv.os_uname()) log.trace("loading nio") local nio = require("nio") log.trace("loading rocks.adapter") diff --git a/rocks.nvim-scm-1.rockspec b/rocks.nvim-scm-1.rockspec index 4bcaad11..23c24f92 100644 --- a/rocks.nvim-scm-1.rockspec +++ b/rocks.nvim-scm-1.rockspec @@ -8,6 +8,7 @@ version = _MODREV .. _SPECREV dependencies = { "lua >= 5.1", + "luarocks >= 3.11.1, < 4.0.0", "toml-edit >= 0.3.6", "fidget.nvim >= 1.1.0", "fzy", @@ -17,6 +18,7 @@ dependencies = { test_dependencies = { "lua >= 5.1", + "luarocks >= 3.11.1, < 4.0.0", "toml-edit >= 0.3.6", "fidget.nvim >= 1.1.0", "fzy", diff --git a/spec/adapter_spec.lua b/spec/adapter_spec.lua index 8e46572c..6989f429 100644 --- a/spec/adapter_spec.lua +++ b/spec/adapter_spec.lua @@ -2,6 +2,7 @@ local tempdir = vim.fn.tempname() vim.system({ "rm", "-r", tempdir }):wait() vim.system({ "mkdir", "-p", tempdir }):wait() vim.g.rocks_nvim = { + luarocks_binary = "luarocks", rocks_path = tempdir, } diff --git a/spec/loader_spec.lua b/spec/loader_spec.lua index f75994ad..296b865a 100644 --- a/spec/loader_spec.lua +++ b/spec/loader_spec.lua @@ -1,3 +1,6 @@ +vim.g.rocks_nvim = { + luarocks_binary = "luarocks", +} local loader = require("rocks.loader") describe("rocks.loader", function() diff --git a/spec/operations/bulk_install_spec.lua b/spec/operations/bulk_install_spec.lua index e7a88381..62c1a48b 100644 --- a/spec/operations/bulk_install_spec.lua +++ b/spec/operations/bulk_install_spec.lua @@ -2,6 +2,7 @@ local tempdir = vim.fn.tempname() vim.system({ "rm", "-r", tempdir }):wait() vim.system({ "mkdir", "-p", tempdir }):wait() vim.g.rocks_nvim = { + luarocks_binary = "luarocks", rocks_path = tempdir, config_path = vim.fs.joinpath(tempdir, "rocks.toml"), } diff --git a/spec/operations/helpers_spec.lua b/spec/operations/helpers_spec.lua index ddd6ae6f..b04fdfd2 100644 --- a/spec/operations/helpers_spec.lua +++ b/spec/operations/helpers_spec.lua @@ -1,6 +1,7 @@ local tempdir = vim.fn.tempname() vim.fn.mkdir(tempdir, "p") vim.g.rocks_nvim = { + luarocks_binary = "luarocks", rocks_path = tempdir, } local nio = require("nio") diff --git a/spec/operations/install_update_spec.lua b/spec/operations/install_update_spec.lua index c65fb68c..2987e26f 100644 --- a/spec/operations/install_update_spec.lua +++ b/spec/operations/install_update_spec.lua @@ -2,6 +2,7 @@ local tempdir = vim.fn.tempname() vim.system({ "rm", "-r", tempdir }):wait() vim.system({ "mkdir", "-p", tempdir }):wait() vim.g.rocks_nvim = { + luarocks_binary = "luarocks", rocks_path = tempdir, config_path = vim.fs.joinpath(tempdir, "rocks.toml"), } diff --git a/spec/operations/pin_commands_spec.lua b/spec/operations/pin_commands_spec.lua index af40ef77..85604acb 100644 --- a/spec/operations/pin_commands_spec.lua +++ b/spec/operations/pin_commands_spec.lua @@ -2,6 +2,7 @@ local tempdir = vim.fn.tempname() vim.system({ "rm", "-r", tempdir }):wait() vim.system({ "mkdir", "-p", tempdir }):wait() vim.g.rocks_nvim = { + luarocks_binary = "luarocks", rocks_path = tempdir, config_path = vim.fs.joinpath(tempdir, "rocks.toml"), } diff --git a/spec/operations/pin_spec.lua b/spec/operations/pin_spec.lua index 5e283a39..0307466f 100644 --- a/spec/operations/pin_spec.lua +++ b/spec/operations/pin_spec.lua @@ -2,6 +2,7 @@ local tempdir = vim.fn.tempname() vim.system({ "rm", "-r", tempdir }):wait() vim.system({ "mkdir", "-p", tempdir }):wait() vim.g.rocks_nvim = { + luarocks_binary = "luarocks", rocks_path = tempdir, config_path = vim.fs.joinpath(tempdir, "rocks.toml"), } diff --git a/spec/operations/sync_spec.lua b/spec/operations/sync_spec.lua index 9bac7a87..d2d2cb05 100644 --- a/spec/operations/sync_spec.lua +++ b/spec/operations/sync_spec.lua @@ -2,6 +2,7 @@ local tempdir = vim.fn.tempname() vim.system({ "rm", "-r", tempdir }):wait() vim.system({ "mkdir", "-p", tempdir }):wait() vim.g.rocks_nvim = { + luarocks_binary = "luarocks", rocks_path = tempdir, config_path = vim.fs.joinpath(tempdir, "rocks.toml"), }