diff --git a/flake.lock b/flake.lock index cb1f162..fa8cc4d 100644 --- a/flake.lock +++ b/flake.lock @@ -18,6 +18,27 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1769996383, + "narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "57928607ea566b5db3ad13af0e57e921e6b12381", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -25,11 +46,11 @@ ] }, "locked": { - "lastModified": 1771625283, - "narHash": "sha256-1T88/PSNKpRNtaiXATTae0hpRnBpjmIL0b1QfGO6HBA=", + "lastModified": 1771683283, + "narHash": "sha256-WxAEkAbo8dP7qiyPM6VN4ZGAxfuBVlNBNPkrqkrXVEc=", "owner": "nix-community", "repo": "home-manager", - "rev": "a913ae61bf3b9f4312f6097b68cdf0a0fa699279", + "rev": "c6ed3eab64d23520bcbb858aa53fe2b533725d4a", "type": "github" }, "original": { @@ -70,11 +91,49 @@ "type": "github" } }, + "nixvim": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1771135771, + "narHash": "sha256-wyvBIhDuyCRyjB3yPg77qoyxrlgQtBR1rVW3c9knV3E=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "ed0424f0b08d303a7348f52f7850ad1b2704f9ba", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, "root": { "inputs": { "catppuccin": "catppuccin", "home-manager": "home-manager", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_2", + "nixvim": "nixvim" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 7f9e5be..77b872b 100644 --- a/flake.nix +++ b/flake.nix @@ -8,6 +8,10 @@ inputs.nixpkgs.follows = "nixpkgs"; }; catppuccin.url = "github:catppuccin/nix"; + nixvim = { + url = "github:nix-community/nixvim"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = @@ -15,6 +19,7 @@ nixpkgs, home-manager, catppuccin, + nixvim, ... }: @@ -35,6 +40,7 @@ modules = [ ./home.nix catppuccin.homeModules.catppuccin + nixvim.homeManagerModules.nixvim ]; }; @@ -47,6 +53,7 @@ modules = [ ./home.nix catppuccin.homeModules.catppuccin + nixvim.homeManagerModules.nixvim ]; }; }; diff --git a/home.nix b/home.nix index 201b1be..ca43307 100644 --- a/home.nix +++ b/home.nix @@ -28,6 +28,7 @@ ./modules/packages.nix # cli tools ./modules/fish.nix + ./modules/nixvim.nix ./modules/yazi.nix ./modules/btop.nix ./modules/atuin.nix @@ -48,7 +49,7 @@ home.file = { ".config/fastfetch".source = ./dotfiles/fastfetch; ".config/MangoHud".source = ./dotfiles/mangohud; - ".config/nvim".source = ./dotfiles/nvim; + # ".config/nvim".source = ./dotfiles/nvim; ".config/gtk-3.0/settings.ini".source = ./dotfiles/gtk-3.0/settings.ini; ".config/gtk-4.0".source = ./dotfiles/gtk-4.0; ".config/hypr".source = ./dotfiles/hypr; diff --git a/modules/nixvim.nix b/modules/nixvim.nix new file mode 100644 index 0000000..46360f5 --- /dev/null +++ b/modules/nixvim.nix @@ -0,0 +1,210 @@ +{ ... }: + +{ + programs.nixvim = { + enable = true; + defaultEditor = true; + + globals = { + mapleader = " "; + maplocalleader = "\\"; + }; + + opts = { + relativenumber = true; + number = true; + signcolumn = "yes"; + cursorline = false; + wrap = true; + shiftwidth = 4; + tabstop = 4; + expandtab = true; + list = true; + clipboard = "unnamedplus"; + spell = true; + spelllang = [ + "pl" + "en" + ]; + }; + + colorschemes.catppuccin = { + enable = true; + settings.flavour = "mocha"; + }; + + keymaps = [ + { + mode = [ + "n" + "v" + ]; + key = ""; + action = ""; + options.silent = true; + } + { + mode = "x"; + key = ">"; + action = ">gv"; + options.desc = "Shift code right"; + } + { + mode = "x"; + key = "<"; + action = "ff" = { + action = "find_files"; + options.desc = "Telescope find files"; + }; + "fg" = { + action = "git_files"; + options.desc = "Telescope find git files"; + }; + }; + }; + + harpoon = { + enable = true; + enableTelescope = true; + }; + + lsp = { + enable = true; + servers = { + lua_ls.enable = true; + clangd.enable = true; + nil_ls.enable = true; + pyright.enable = true; + rust_analyzer = { + enable = true; + installCargo = true; + installRustc = true; + }; + }; + keymaps = { + lspBuf = { + "gd" = "definition"; + "gi" = "implementation"; + "ca" = "code_action"; + "cf" = "format"; + "r" = "rename"; + }; + }; + }; + + lsp-format.enable = true; + + luasnip.enable = true; + cmp = { + enable = true; + settings = { + snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end"; + sources = [ + { name = "nvim_lsp"; } + { name = "luasnip"; } + { name = "buffer"; } + ]; + mapping = { + "" = "cmp.mapping.select_prev_item()"; + "" = "cmp.mapping.select_next_item()"; + "" = "cmp.mapping.confirm({ select = true })"; + "" = "cmp.mapping.abort()"; + }; + window = { + documentation = { + border = "rounded"; + }; + }; + }; + }; + }; + }; +} diff --git a/modules/packages.nix b/modules/packages.nix index 4ae1eb2..1443e69 100644 --- a/modules/packages.nix +++ b/modules/packages.nix @@ -8,7 +8,6 @@ fzf eza fastfetch - neovim fd duf gdu