nixvim: init

This commit is contained in:
cy 2025-01-10 23:16:31 -05:00
parent 8dddc70a6c
commit 2b04222b41
5 changed files with 443 additions and 6 deletions

280
flake.lock generated
View file

@ -21,6 +21,27 @@
"type": "github" "type": "github"
} }
}, },
"devshell": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1735644329,
"narHash": "sha256-tO3HrHriyLvipc4xr+Ewtdlo7wM1OjXNjlWRgmM7peY=",
"owner": "numtide",
"repo": "devshell",
"rev": "f7795ede5b02664b57035b3b757876703e2c3eac",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"disko": { "disko": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -74,6 +95,20 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat_2": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"revCount": 57,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": [ "nixpkgs-lib": [
@ -95,6 +130,27 @@
"type": "github" "type": "github"
} }
}, },
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1736143030,
"narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
@ -113,6 +169,50 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": [
"nixvim",
"flake-compat"
],
"gitignore": "gitignore_2",
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1735882644,
"narHash": "sha256-3FZAG+pGt3OElQjesCAWeMkQ7C/nB1oTHLRQ8ceP110=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "a5a961387e75ae44cc20f0a57ae463da5e959656",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": { "gitignore": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -135,6 +235,28 @@
"type": "github" "type": "github"
} }
}, },
"gitignore_2": {
"inputs": {
"nixpkgs": [
"nixvim",
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -155,6 +277,55 @@
"type": "github" "type": "github"
} }
}, },
"home-manager_2": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1736366465,
"narHash": "sha256-Fo68EF6p/N9GJyHiAUbXtiE7IJlb3IMjK86LuxFMsRU=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "7e00856596891850ba5ad4c5ecd2ed74468c08c5",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"ixx": {
"inputs": {
"flake-utils": [
"nixvim",
"nuschtosSearch",
"flake-utils"
],
"nixpkgs": [
"nixvim",
"nuschtosSearch",
"nixpkgs"
]
},
"locked": {
"lastModified": 1729958008,
"narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=",
"owner": "NuschtOS",
"repo": "ixx",
"rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb",
"type": "github"
},
"original": {
"owner": "NuschtOS",
"ref": "v0.0.6",
"repo": "ixx",
"type": "github"
}
},
"lanzaboote": { "lanzaboote": {
"inputs": { "inputs": {
"crane": "crane", "crane": "crane",
@ -182,6 +353,27 @@
"type": "github" "type": "github"
} }
}, },
"nix-darwin": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1736370755,
"narHash": "sha256-iWcjToBpx4PUd74uqvIGAfqqVfyrvRLRauC/SxEKIF0=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "57733bd1dc81900e13438e5b4439239f1b29db0e",
"type": "github"
},
"original": {
"owner": "lnl7",
"repo": "nix-darwin",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1736012469, "lastModified": 1736012469,
@ -246,6 +438,57 @@
"type": "github" "type": "github"
} }
}, },
"nixvim": {
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat_2",
"flake-parts": "flake-parts_2",
"git-hooks": "git-hooks",
"home-manager": "home-manager_2",
"nix-darwin": "nix-darwin",
"nixpkgs": [
"nixpkgs"
],
"nuschtosSearch": "nuschtosSearch",
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1736430661,
"narHash": "sha256-0dabFSGqcPo47WfgPRM5usnVXaGMdYvPlDJ5PeIqjr4=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "67de84848e43ca6a5025e4f8eddc2f6684a51f2b",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixvim",
"type": "github"
}
},
"nuschtosSearch": {
"inputs": {
"flake-utils": "flake-utils_2",
"ixx": "ixx",
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1735854821,
"narHash": "sha256-Iv59gMDZajNfezTO0Fw6LHE7uKAShxbvMidmZREit7c=",
"owner": "NuschtOS",
"repo": "search",
"rev": "836908e3bddd837ae0f13e215dd48767aee355f0",
"type": "github"
},
"original": {
"owner": "NuschtOS",
"repo": "search",
"type": "github"
}
},
"pre-commit-hooks-nix": { "pre-commit-hooks-nix": {
"inputs": { "inputs": {
"flake-compat": [ "flake-compat": [
@ -282,6 +525,7 @@
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-borg": "nixpkgs-borg", "nixpkgs-borg": "nixpkgs-borg",
"nixpkgs-btrbk": "nixpkgs-btrbk", "nixpkgs-btrbk": "nixpkgs-btrbk",
"nixvim": "nixvim",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
"treefmt": "treefmt" "treefmt": "treefmt"
} }
@ -346,6 +590,21 @@
"type": "github" "type": "github"
} }
}, },
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt": { "treefmt": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -365,6 +624,27 @@
"repo": "treefmt-nix", "repo": "treefmt-nix",
"type": "github" "type": "github"
} }
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1736154270,
"narHash": "sha256-p2r8xhQZ3TYIEKBoiEhllKWQqWNJNoT9v64Vmg4q8Zw=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "13c913f5deb3a5c08bb810efd89dc8cb24dd968b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -23,6 +23,10 @@
url = "github:nix-community/lanzaboote/v0.4.1"; url = "github:nix-community/lanzaboote/v0.4.1";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs-borg.url = "github:cything/nixpkgs/borg"; # unmerged PR nixpkgs-borg.url = "github:cything/nixpkgs/borg"; # unmerged PR
nixpkgs-btrbk.url = "github:cything/nixpkgs/btrbk"; # unmerged PR nixpkgs-btrbk.url = "github:cything/nixpkgs/btrbk"; # unmerged PR
@ -165,6 +169,7 @@
extraSpecialArgs = { inherit inputs outputs; }; extraSpecialArgs = { inherit inputs outputs; };
modules = [ modules = [
./home/yt/ytnix.nix ./home/yt/ytnix.nix
inputs.nixvim.homeManagerModules.nixvim
]; ];
}; };

156
home/nixvim/default.nix Normal file
View file

@ -0,0 +1,156 @@
{ pkgs, ...}:
{
programs.nixvim = {
enable = true;
plugins.lualine.enable = true;
opts = {
number = true;
relativenumber = true;
expandtab = true;
autoindent = true;
shiftwidth = 2;
smartindent = true;
tabstop = 2;
ignorecase = true;
incsearch = true;
smartcase = true;
};
colorscheme = "iceberg";
clipboard.register = "unnamedplus";
globals = {
mapleader = ",";
};
extraPlugins = with pkgs.vimPlugins; [
iceberg-vim
];
keymaps = [
{
action = "<cmd>Neotree toggle<CR>";
key = "<space>s";
mode = "n";
options.silent = true;
}
{
# shortcut to command mode
action = ":";
key = ";";
mode = ["n" "x"];
options.silent = true;
}
{
# insert line below without moving cursor
action = "printf('m`%so<ESC>``', v:count1)";
key = "<space>o";
options.expr = true;
mode = "n";
}
{
# insert line above without moving cursor
action = "printf('m`%sO<ESC>``', v:count1)";
key = "<space>O";
options.expr = true;
mode = "n";
}
# nice emacs bindings
{
action = "<HOME>";
key = "<C-a>";
mode = "i";
}
{
action = "<END>";
key = "<C-e>";
mode = "i";
}
];
plugins.cmp = {
enable = true;
settings.sources = [
{ name = "nvim_lsp"; }
{ name = "luasnip"; }
{ name = "buffer"; }
{ name = "nvim_lua"; }
{ name = "path"; }
];
settings.mappings = {
"<C-h>" = "cmp.mapping.abort()";
"<C-n>" = "cmp.mapping.select_next_item()";
"<C-p>" = "cmp.mapping.select_prev_item()";
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
"<C-u>" = "cmp.mapping.scroll_docs(4)";
"<C-k>" = "cmp.mapping.confirm({ select = true })";
"<Tab>" = ''
cmp.mapping(function(fallback)
if require("luasnip").expand_or_jumpable() then
require("luasnip").expand_or_jump()
else
fallback()
end
end,{"i","s"})
'';
"<S-Tab>" = ''
cmp.mapping(function(fallback)
if require("luasnip").jumpable(-1) then
require("luasnip").jump(-1)
else
fallback()
end
end,{"i","s"})
'';
};
};
plugins.lsp = {
enable = true;
keymaps.lspBuf = {
"K" = "hover";
"gd" = "definition";
"gD" = "references";
"gt" = "type_definition";
"gi" = "implementation";
};
servers = {
bashls.enable = true;
lua_ls.enable = true;
nil_ls.enable = true;
rust_analyzer = {
enable = true;
installRustc = true;
installCargo = true;
};
};
};
plugins.treesitter = {
enable = true;
nixGrammars = true;
settings.indent.enable = true;
};
plugins.fzf-lua = {
enable = true;
keymaps = {
"<leader>ff" = "git_files";
"<leader>fg" = "live_grep";
};
};
plugins.neo-tree = {
enable = true;
closeIfLastWindow = true;
};
plugins.cmp-buffer.enable = true;
plugins.cmp-emoji.enable = true;
plugins.cmp-nvim-lsp.enable = true;
plugins.cmp-path.enable = true;
plugins.cmp_luasnip.enable = true;
plugins.luasnip.enable = true;
plugins.nvim-autopairs.enable = true;
plugins.rainbow-delimiters.enable = true;
plugins.web-devicons.enable = true;
plugins.gitsigns.enable = true;
};
}

View file

@ -3,16 +3,13 @@
imports = [ imports = [
../tmux.nix ../tmux.nix
../zsh ../zsh
../nixvim
]; ];
home.sessionVariables = { home.sessionVariables = {
"EDITOR" = "nvim"; "EDITOR" = "nvim";
}; };
xdg.configFile = {
nvim.source = ../nvim;
};
home.packages = with pkgs; [ home.packages = with pkgs; [
man-pages man-pages
man-pages-posix man-pages-posix
@ -30,7 +27,6 @@
}; };
programs.zoxide.enable = true; programs.zoxide.enable = true;
programs.eza.enable = true; programs.eza.enable = true;
programs.neovim.enable = true;
programs.git = { programs.git = {
enable = true; enable = true;
userName = "cy"; userName = "cy";

View file

@ -96,7 +96,7 @@
opentofu opentofu
terraform-ls terraform-ls
gdb gdb
gcc clang
seahorse seahorse
]; ];