mirror of
https://github.com/Smaug123/nix-dotfiles
synced 2025-10-05 06:38:40 +00:00
Bump nixpkgs and fix some nvim stuff (#70)
This commit is contained in:
30
flake.lock
generated
30
flake.lock
generated
@@ -27,11 +27,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1722924007,
|
||||
"narHash": "sha256-+CQDamNwqO33REJLft8c26NbUi2Td083hq6SvAm2xkU=",
|
||||
"lastModified": 1724561770,
|
||||
"narHash": "sha256-zv8C9RNa86CIpyHwPIVO/k+5TfM8ZbjGwOOpTe1grls=",
|
||||
"owner": "lnl7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "91010a5613ffd7ee23ee9263213157a1c422b705",
|
||||
"rev": "ac5694a0b855a981e81b4d9f14052e3ff46ca39e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -50,11 +50,11 @@
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1723686119,
|
||||
"narHash": "sha256-IAqqmbLkL+EhmeD7VAAMRZmay9vSA/MF41RZmFFr/ws=",
|
||||
"lastModified": 1724862133,
|
||||
"narHash": "sha256-7mKSFEcTUgLFz+C8t9KrfLj0HDdorlEwI1J75prQewA=",
|
||||
"owner": "nix-community",
|
||||
"repo": "emacs-overlay",
|
||||
"rev": "f396ad6b3ce6bfa2f3282cba4660df17391fd2a0",
|
||||
"rev": "bd223a4218c70d9ea00ca970c3a02390316e3f42",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -121,11 +121,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1723399884,
|
||||
"narHash": "sha256-97wn0ihhGqfMb8WcUgzzkM/TuAxce2Gd20A8oiruju4=",
|
||||
"lastModified": 1724435763,
|
||||
"narHash": "sha256-UNky3lJNGQtUEXT2OY8gMxejakSWPTfWKvpFkpFlAfM=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "086f619dd991a4d355c07837448244029fc2d9ab",
|
||||
"rev": "c2cd2a52e02f1dfa1c88f95abeb89298d46023be",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -164,11 +164,11 @@
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1723556749,
|
||||
"narHash": "sha256-+CHVZnTnIYRLYsARInHYoWkujzcRkLY/gXm3s5bE52o=",
|
||||
"lastModified": 1724531977,
|
||||
"narHash": "sha256-XROVLf9ti4rrNCFLr+DmXRZtPjCQTW4cYy59owTEmxk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "4a92571f9207810b559c9eac203d1f4d79830073",
|
||||
"rev": "2527da1ef492c495d5391f3bcf9c1dd9f4514e32",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -180,11 +180,11 @@
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1723603349,
|
||||
"narHash": "sha256-VMg6N7MryOuvSJ8Sj6YydarnUCkL7cvMdrMcnsJnJCE=",
|
||||
"lastModified": 1724748588,
|
||||
"narHash": "sha256-NlpGA4+AIf1dKNq76ps90rxowlFXUsV9x7vK/mN37JM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "daf7bb95821b789db24fc1ac21f613db0c1bf2cb",
|
||||
"rev": "a6292e34000dc93d43bccf78338770c1c5ec8a99",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@@ -279,7 +279,6 @@
|
||||
nixpkgs.hledger
|
||||
nixpkgs.hledger-web
|
||||
dotnet
|
||||
nixpkgs.jitsi-meet
|
||||
nixpkgs.elan
|
||||
nixpkgs.coreutils-prefixed
|
||||
nixpkgs.shellcheck
|
||||
|
@@ -218,11 +218,38 @@ local function nuGetVersionToString(v)
|
||||
end
|
||||
end
|
||||
|
||||
local function get_all_variables()
|
||||
local variables = {}
|
||||
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
|
||||
for _, line in ipairs(lines) do
|
||||
local var_name, var_value = line:match("<(%w+)>([^<]+)</(%w+)>")
|
||||
if var_name and var_value then
|
||||
variables[var_name] = var_value
|
||||
end
|
||||
end
|
||||
return variables
|
||||
end
|
||||
|
||||
local function resolve_variable(version, variables)
|
||||
if version:match("^%$%((.+)%)$") then
|
||||
local var_name = version:match("^%$%((.+)%)$")
|
||||
return variables[var_name] or nil
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
---@param v string
|
||||
---@nodiscard
|
||||
---@return NuGetVersion
|
||||
local function parse_version(v)
|
||||
local variables = get_all_variables()
|
||||
local major, minor, patch, pre = v:match("(%d+)%.(%d+)%.(%d+)(.*)$")
|
||||
if major == nil then
|
||||
local resolved = resolve_variable(v, variables)
|
||||
if resolved ~= nil then
|
||||
return parse_version(resolved)
|
||||
end
|
||||
end
|
||||
-- TODO: why does this type-check if you remove the field names?
|
||||
return {
|
||||
major = tonumber(major) or 0,
|
||||
@@ -631,6 +658,14 @@ local function prefetch_dependencies()
|
||||
end
|
||||
end
|
||||
|
||||
---@param v1 NuGetVersion
|
||||
---@param v2 NuGetVersion
|
||||
---@return boolean
|
||||
---@nodiscard
|
||||
local function nuget_versions_equal(v1, v2)
|
||||
return v1.major == v2.major and v1.minor == v2.minor and v1.patch == v2.patch and v1.suffix == v2.suffix
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "fsharp_project", "csharp_project", "xml" },
|
||||
callback = function()
|
||||
@@ -638,13 +673,17 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
local package_name = line:match('PackageReference Include="([^"]+)"')
|
||||
or line:match('PackageReference Update="([^"]+)"')
|
||||
local current_version = nuGetVersionToString(line:match('Version="([^"]+)"'))
|
||||
|
||||
if not package_name then
|
||||
print("No package reference found on the current line")
|
||||
return
|
||||
end
|
||||
|
||||
local current_version = parse_version(line:match('Version="([^"]+)"'))
|
||||
if not current_version then
|
||||
print("oh no!")
|
||||
end
|
||||
|
||||
local package_versions = get_package_versions_sync(package_name)
|
||||
|
||||
if #package_versions == 0 then
|
||||
@@ -664,7 +703,7 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
entry_maker = function(entry)
|
||||
local val = nuGetVersionToString(entry)
|
||||
local display_value = val
|
||||
if current_version and entry == current_version then
|
||||
if current_version and nuget_versions_equal(entry, current_version) then
|
||||
display_value = "[CURRENT] " .. val
|
||||
end
|
||||
return {
|
||||
@@ -696,7 +735,11 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
for dep, range in pairs(package_dependencies) do
|
||||
table.insert(display, dep .. ": " .. range)
|
||||
end
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, display)
|
||||
local ok, err = pcall(vim.api.nvim_buf_set_lines, bufnr, 0, -1, false, display)
|
||||
if not ok then
|
||||
-- If we can't set lines, the window's probably gone. Ignore.
|
||||
return
|
||||
end
|
||||
end)
|
||||
end,
|
||||
}),
|
||||
|
@@ -53,6 +53,9 @@ require("lspconfig")["ltex"].setup({})
|
||||
|
||||
require("lspconfig")["lua_ls"].setup({
|
||||
on_init = function(client)
|
||||
if not client.workspace_folders then
|
||||
return
|
||||
end
|
||||
local path = client.workspace_folders[1].name
|
||||
if vim.uv.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc") then
|
||||
return
|
||||
|
Reference in New Issue
Block a user