Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
TwIStOy committed Apr 16, 2024
1 parent e08e870 commit f0b3db1
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions lua/dotvim/utils/nix.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,25 @@ local detect_path_parts = {
}

M.is_nix_managed = Fn.invoke_once(function()
local path = vim.split(vim.fn.getenv("PATH"), ":", { trimempty = true })
for _, p in ipairs(path) do
for _, part in ipairs(detect_path_parts) do
if p:find(part, 1, true) then
return true
local has_nix_store_in_path = function()
local path = vim.split(vim.fn.getenv("PATH"), ":", { trimempty = true })
for _, p in ipairs(path) do
for _, part in ipairs(detect_path_parts) do
if p:find(part, 1, true) then
return true
end
end
end
return false
end
return false

local has_generated_nix_aware_file = function()
local path = vim.fn.stdpath("config") .. "/nix-aware.json"
---@diagnostic disable-next-line: undefined-field
return not not vim.uv.fs_stat(path)
end

return has_nix_store_in_path() and has_generated_nix_aware_file()
end)

---@return boolean
Expand Down

0 comments on commit f0b3db1

Please sign in to comment.