This commit is contained in:
cy 2025-01-05 06:02:42 -05:00
parent ec219285e9
commit 4c17e30aa8
4 changed files with 56 additions and 48 deletions

View file

@ -69,20 +69,25 @@
(overlayPkgsFromFlake inputs.nixpkgs-stable [ (overlayPkgsFromFlake inputs.nixpkgs-stable [
# "prometheus" # fails to build on unstable # "prometheus" # fails to build on unstable
]) ])
(final: prev: { (_final: prev: {
conduwuit = prev.conduwuit.override (old: { conduwuit = prev.conduwuit.override (old: {
rustPlatform = old.rustPlatform // { rustPlatform = old.rustPlatform // {
buildRustPackage = args: old.rustPlatform.buildRustPackage (args // { buildRustPackage =
version = "0.4.6"; args:
src = prev.fetchFromGitHub { old.rustPlatform.buildRustPackage (
owner = "girlbossceo"; args
repo = "conduwuit"; // {
rev = "c7ae9516767dff6767a725be3d144164c0d1ad56"; version = "0.4.6";
hash = "sha256-llE6EPE70iV7gGz2c2uhRAQIhRe57cYaXfA4NnbRtrM="; src = prev.fetchFromGitHub {
}; owner = "girlbossceo";
cargoHash = "sha256-5KXFei6A12QrFattkbDZM2LuLueV+aKunDgy6ZAaF7E="; repo = "conduwuit";
doCheck = false; rev = "c7ae9516767dff6767a725be3d144164c0d1ad56";
}); hash = "sha256-llE6EPE70iV7gGz2c2uhRAQIhRe57cYaXfA4NnbRtrM=";
};
cargoHash = "sha256-5KXFei6A12QrFattkbDZM2LuLueV+aKunDgy6ZAaF7E=";
doCheck = false;
}
);
}; };
}); });
}) })

View file

@ -53,43 +53,47 @@ opt.guicursor = "i-ci-ve:ver25-blinkon500-blinkon500"
-- as event. It seems that when BufReadPost is triggered, FileType event is still not run. -- as event. It seems that when BufReadPost is triggered, FileType event is still not run.
-- So the filetype for this buffer is empty string. -- So the filetype for this buffer is empty string.
api.nvim_create_autocmd("FileType", { api.nvim_create_autocmd("FileType", {
group = api.nvim_create_augroup("resume_cursor_position", { clear = true }), group = api.nvim_create_augroup("resume_cursor_position", { clear = true }),
pattern = "*", pattern = "*",
callback = function(ev) callback = function(ev)
local mark_pos = api.nvim_buf_get_mark(ev.buf, '"') local mark_pos = api.nvim_buf_get_mark(ev.buf, '"')
local last_cursor_line = mark_pos[1] local last_cursor_line = mark_pos[1]
local max_line = vim.fn.line("$") local max_line = vim.fn.line("$")
local buf_filetype = api.nvim_get_option_value("filetype", { buf = ev.buf }) local buf_filetype = api.nvim_get_option_value("filetype", { buf = ev.buf })
local buftype = api.nvim_get_option_value("buftype", { buf = ev.buf }) local buftype = api.nvim_get_option_value("buftype", { buf = ev.buf })
-- only handle normal files -- only handle normal files
if buf_filetype == "" or buftype ~= "" then if buf_filetype == "" or buftype ~= "" then
return return
end end
-- Only resume last cursor position when there is no go-to-line command (something like '+23'). -- Only resume last cursor position when there is no go-to-line command (something like '+23').
if vim.fn.match(vim.v.argv, [[\v^\+(\d){1,}$]]) ~= -1 then if vim.fn.match(vim.v.argv, [[\v^\+(\d){1,}$]]) ~= -1 then
return return
end end
if last_cursor_line > 1 and last_cursor_line <= max_line then if last_cursor_line > 1 and last_cursor_line <= max_line then
-- vim.print(string.format("mark_pos: %s", vim.inspect(mark_pos))) -- vim.print(string.format("mark_pos: %s", vim.inspect(mark_pos)))
-- it seems that without vim.schedule, the cursor position can not be set correctly -- it seems that without vim.schedule, the cursor position can not be set correctly
vim.schedule(function() vim.schedule(function()
local status, result = pcall(api.nvim_win_set_cursor, 0, mark_pos) local status, result = pcall(api.nvim_win_set_cursor, 0, mark_pos)
if not status then if not status then
api.nvim_err_writeln( api.nvim_err_writeln(
string.format("Failed to resume cursor position. Context %s, error: %s", vim.inspect(ev), result) string.format(
) "Failed to resume cursor position. Context %s, error: %s",
end vim.inspect(ev),
end) result
-- the following two ways also seem to work, )
-- ref: https://www.reddit.com/r/neovim/comments/104lc26/how_can_i_press_escape_key_using_lua/ )
-- vim.api.nvim_feedkeys("g`\"", "n", true) end
-- vim.fn.execute("normal! g`\"") end)
end -- the following two ways also seem to work,
end, -- ref: https://www.reddit.com/r/neovim/comments/104lc26/how_can_i_press_escape_key_using_lua/
-- vim.api.nvim_feedkeys("g`\"", "n", true)
-- vim.fn.execute("normal! g`\"")
end
end,
}) })
keymap.set("n", "<space>s", require("nvim-tree.api").tree.toggle, { keymap.set("n", "<space>s", require("nvim-tree.api").tree.toggle, {

View file

@ -1,4 +1,4 @@
{config, ...}: { config, ... }:
{ {
services.atticd = { services.atticd = {
enable = true; enable = true;

View file

@ -17,8 +17,7 @@
name = "atticd"; name = "atticd";
ensureDBOwnership = true; ensureDBOwnership = true;
} }
] ];
;
}; };
services.postgresqlBackup = { services.postgresqlBackup = {
enable = true; enable = true;