chore: routine maintenance
This commit is contained in:
parent
c45ba82b90
commit
c7743490a7
75 changed files with 1200 additions and 634 deletions
|
|
@ -28,16 +28,25 @@ in
|
|||
imports = [
|
||||
./plugins/snacks-nvim
|
||||
./plugins/lualine
|
||||
./plugins/leetcode
|
||||
./extra-lsp.nix
|
||||
];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
(rust-bin.stable.latest.default.override {
|
||||
extensions = [ "rust-src" ];
|
||||
})
|
||||
];
|
||||
|
||||
programs.nvf = {
|
||||
enable = true;
|
||||
settings = {
|
||||
vim = {
|
||||
enableLuaLoader = true;
|
||||
vimAlias = true;
|
||||
extraPackages = with pkgs; [ nixfmt ];
|
||||
extraPackages = with pkgs; [
|
||||
nixfmt
|
||||
];
|
||||
|
||||
clipboard = {
|
||||
enable = true;
|
||||
|
|
@ -380,12 +389,9 @@ in
|
|||
enable = true;
|
||||
lsp = {
|
||||
enable = true;
|
||||
package = [
|
||||
"rust-analyzer"
|
||||
];
|
||||
opts = ''
|
||||
['rust-analyzer'] = {
|
||||
cargo = {allFeature = true},
|
||||
cargo = { allFeature = true },
|
||||
checkOnSave = true,
|
||||
procMacro = {
|
||||
enable = true,
|
||||
|
|
@ -528,7 +534,8 @@ in
|
|||
|
||||
yazi-nvim = {
|
||||
enable = true;
|
||||
mappings.openYaziDir = "<leader>e";
|
||||
mappings.openYaziDir = "<leader>-";
|
||||
mappings.openYazi = "<leader>e";
|
||||
};
|
||||
|
||||
images = {
|
||||
|
|
|
|||
72
home/user/nvf/plugins/leetcode/default.nix
Normal file
72
home/user/nvf/plugins/leetcode/default.nix
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
osConfig,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (osConfig.systemConf) username;
|
||||
relativeDir = "projects/leetcode";
|
||||
dataDir = "${config.home.homeDirectory}/${relativeDir}";
|
||||
in
|
||||
{
|
||||
programs.nvf.settings.vim.utility.leetcode-nvim = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
image_support = true;
|
||||
lang = "rust";
|
||||
plugins.non_standalone = true;
|
||||
storage.home = mkLuaInline ''"${dataDir}"'';
|
||||
injector = mkLuaInline ''
|
||||
{
|
||||
['rust'] = {
|
||||
before = { '#[allow(dead_code)]', 'fn main() {}', '#[allow(dead_code)]', 'struct Solution;' },
|
||||
}
|
||||
}
|
||||
'';
|
||||
hooks."question_enter" = [
|
||||
(mkLuaInline
|
||||
# lua
|
||||
''
|
||||
function (question)
|
||||
if question.lang ~= 'rust' then
|
||||
return
|
||||
end
|
||||
|
||||
local config = require("leetcode.config")
|
||||
local problem_dir = config.user.storage.home .. "/Cargo.toml"
|
||||
local content = [[
|
||||
[package]
|
||||
name = "leetcode"
|
||||
edition = "2024"
|
||||
|
||||
[lib]
|
||||
name = "%s"
|
||||
path = "%s"
|
||||
|
||||
[dependencies]
|
||||
rand = "0.8"
|
||||
regex = "1"
|
||||
itertools = "0.14.0"
|
||||
]]
|
||||
|
||||
local file = io.open(problem_dir, "w")
|
||||
if file then
|
||||
local formatted = (content:gsub(" +", "")):format(question.q.frontend_id, question:path())
|
||||
file:write(formatted)
|
||||
file:close()
|
||||
else
|
||||
print("Failed to open file " .. problem_dir)
|
||||
end
|
||||
end
|
||||
''
|
||||
)
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.tmpfiles.rules = [
|
||||
"d ${dataDir} 0744 ${username} users -"
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue