[feat] Improve the nixneovim config

This commit is contained in:
uttarayan21
2024-02-28 11:28:06 +05:30
parent 7966e89d2f
commit 186af6d51e
5 changed files with 247 additions and 33 deletions

View File

@@ -42,6 +42,7 @@ in {
(nerdfonts.override { fonts = [ "Hasklig" ]; }) (nerdfonts.override { fonts = [ "Hasklig" ]; })
mpv mpv
] ++ (if device.isLinux then [ ] ++ (if device.isLinux then [
steam-run
(pkgs.catppuccin-gtk.override { (pkgs.catppuccin-gtk.override {
variant = "mocha"; variant = "mocha";
size = "standard"; size = "standard";

View File

@@ -2,26 +2,97 @@
imports = [ inputs.nixneovim.nixosModules.default ]; imports = [ inputs.nixneovim.nixosModules.default ];
programs.nixneovim = { programs.nixneovim = {
enable = true; enable = true;
extraConfigLua = ''
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
vim.opt.foldtext = "v:lua.vim.treesitter.foldtext()"
'';
options = { options = {
foldexpr = "nvim_treesitter#foldexpr()";
foldmethod = "expr";
number = true; number = true;
relativenumber = true; relativenumber = true;
tabstop = 4;
softtabstop = 4;
shiftwidth = 4;
expandtab = true;
hidden = true;
smartcase = true;
termguicolors = true;
signcolumn = "yes";
# "opt.list" = true;
wrap = true;
};
globals = {
mapleader = " ";
#copilot_no_tab_map = true;
}; };
plugins = { plugins = {
lspconfig = { lspconfig = {
enable = true; enable = true;
servers = { servers = {
rust-analyzer.enable = true; nil = {
nil.enable = true; enable = true;
extraConfig = ''
settings = {
['nil'] = {
formatting = {
command = { "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt" },
},
nix = {
flake = {
autoArchive = true,
},
},
},
},
'';
};
lua-language-server = {
enable = true;
onAttachExtra = ''
local lspconfig = require 'lspconfig'
local lsp_zero = require'lsp-zero'
local lua_opts = lsp_zero.nvim_lua_ls()
lspconfig.lua_ls.setup(lua_opts)
'';
};
}; };
onAttach = ''
vim.lsp.inlay_hint.enable(bufnr, true)
'';
}; };
todo-comments.enable = true;
lualine.enable = true;
commentary.enable = true;
surround.enable = true;
treesitter = { treesitter = {
enable = true; enable = true;
indent = true; indent = true;
}; };
telescope = {
enable = true;
extensions = {
manix.enable = true;
# plenary.enable = true;
};
};
nvim-cmp = {
enable = true;
completion = {
completeopt = "menu,menuone,popup,noselect";
};
sources = {
nvim_lsp.enable = true;
luasnip.enable = true;
buffer.enable = true;
path.enable = true;
cmdline.enable = true;
#copilot.enable = true;
git.enable = true;
};
snippet.luasnip.enable = true;
};
}; };
colorschemes = { colorschemes = {
catppuccin = { catppuccin = {
@@ -33,6 +104,7 @@
normal = { normal = {
"<leader>ff" = "require'telescope.builtin'.find_files"; "<leader>ff" = "require'telescope.builtin'.find_files";
"<leader>gg" = "require'telescope.builtin'.live_grep"; "<leader>gg" = "require'telescope.builtin'.live_grep";
"<leader>mm" = "require'telescope-manix'.search";
"<leader>;" = "require'telescope.builtin'.buffers"; "<leader>;" = "require'telescope.builtin'.buffers";
"<leader><leader>" = "'<c-^>'"; "<leader><leader>" = "'<c-^>'";
"vff" = "'<cmd>vertical Gdiffsplit<cr>'"; "vff" = "'<cmd>vertical Gdiffsplit<cr>'";
@@ -40,7 +112,27 @@
"gi" = "vim.lsp.buf.implementation"; "gi" = "vim.lsp.buf.implementation";
"<leader>a" = "vim.lsp.buf.code_action"; "<leader>a" = "vim.lsp.buf.code_action";
"F" = "function() vim.lsp.buf.format({ async = true }) end"; "F" = "function() vim.lsp.buf.format({ async = true }) end";
# "<C-l>" = ''copilot#Accept("<CR>")'';
}; };
}; };
extraPlugins =
let
comfortable-motion = pkgs.fetchFromGitHub {
owner = "yuttie";
repo = "comfortable-motion.vim";
rev = "master";
sha256 = "sha256-S1LJXmShhpCJIg/FEPx3jFbmPpS/1U4MAQN2RY/nkI0";
};
in
[
comfortable-motion
pkgs.vimExtraPlugins.rustaceanvim
pkgs.vimExtraPlugins.cmp-nvim-lsp
pkgs.vimExtraPlugins.fidget-nvim
pkgs.vimExtraPlugins.rest-nvim
pkgs.vimExtraPlugins.lsp-zero-nvim
pkgs.vimPlugins.vim-abolish
];
}; };
} }

122
config/nix/flake.lock generated
View File

@@ -123,11 +123,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1707685877, "lastModified": 1708794349,
"narHash": "sha256-XoXRS+5whotelr1rHiZle5t5hDg9kpguS5yk8c8qzOc=", "narHash": "sha256-jX+B1VGHT0ruHHL5RwS8L21R6miBn4B6s9iVyUJsJJY=",
"owner": "ipetkov", "owner": "ipetkov",
"repo": "crane", "repo": "crane",
"rev": "2c653e4478476a52c6aa3ac0495e4dea7449ea0e", "rev": "2c94ff9a6fbeb9f3ea0107f28688edbe9c81deaa",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -395,6 +395,24 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_8": {
"inputs": {
"systems": "systems_8"
},
"locked": {
"lastModified": 1689068808,
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": { "gitignore": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -535,11 +553,11 @@
"rust-overlay": "rust-overlay_4" "rust-overlay": "rust-overlay_4"
}, },
"locked": { "locked": {
"lastModified": 1708388174, "lastModified": 1709051793,
"narHash": "sha256-mLROAGNyOykYwWOLga24BX05GnRE+acms0Ru10tye2o=", "narHash": "sha256-4FXFBq5mN1IwN18Fd2OEF1iCZV5PC40gP2L64oyq3xQ=",
"owner": "nix-community", "owner": "nix-community",
"repo": "lanzaboote", "repo": "lanzaboote",
"rev": "73fec69386e8005911e15f3abe6bb6cee7fd9711", "rev": "e761c7ee47b64debc687d8bff7599d702c893dcc",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -673,6 +691,28 @@
"type": "github" "type": "github"
} }
}, },
"nix-github-actions_2": {
"inputs": {
"nixpkgs": [
"nixneovimplugins",
"poetry2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1688870561,
"narHash": "sha256-4UYkifnPEw1nAzqqPOTL2MvWtm3sNGw1UTYTalkTcGY=",
"owner": "nix-community",
"repo": "nix-github-actions",
"rev": "165b1650b753316aa7f1787f3005a8d2da0f5301",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nix-github-actions",
"type": "github"
}
},
"nixneovim": { "nixneovim": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_7", "flake-utils": "flake-utils_7",
@@ -726,6 +766,28 @@
"type": "github" "type": "github"
} }
}, },
"nixneovimplugins_2": {
"inputs": {
"flake-utils": "flake-utils_8",
"nixpkgs": [
"nixpkgs"
],
"poetry2nix": "poetry2nix_2"
},
"locked": {
"lastModified": 1708870615,
"narHash": "sha256-9GeZzoT8kxJY3OkpeOo/eJ4bqwaQTGggv3fR/5UdIkY=",
"owner": "NixNeovim",
"repo": "NixNeovimPlugins",
"rev": "eb98507f0309ddb74d81367838e742d47e9e456f",
"type": "github"
},
"original": {
"owner": "NixNeovim",
"repo": "NixNeovimPlugins",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1706487304, "lastModified": 1706487304,
@@ -898,6 +960,32 @@
"type": "github" "type": "github"
} }
}, },
"poetry2nix_2": {
"inputs": {
"flake-utils": [
"nixneovimplugins",
"flake-utils"
],
"nix-github-actions": "nix-github-actions_2",
"nixpkgs": [
"nixneovimplugins",
"nixpkgs"
]
},
"locked": {
"lastModified": 1689849924,
"narHash": "sha256-d259Z2S7CS7Na04qQNQ6LYQILuI7cf4Rpe76qc4mz40=",
"owner": "nix-community",
"repo": "poetry2nix",
"rev": "1d7eda9336f336392d24e9602be5cb9be7ae405c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "poetry2nix",
"type": "github"
}
},
"pre-commit-hooks-nix": { "pre-commit-hooks-nix": {
"inputs": { "inputs": {
"flake-compat": [ "flake-compat": [
@@ -942,6 +1030,7 @@
"neovim-nightly-overlay": "neovim-nightly-overlay", "neovim-nightly-overlay": "neovim-nightly-overlay",
"nix-darwin": "nix-darwin", "nix-darwin": "nix-darwin",
"nixneovim": "nixneovim", "nixneovim": "nixneovim",
"nixneovimplugins": "nixneovimplugins_2",
"nixpkgs": "nixpkgs_5" "nixpkgs": "nixpkgs_5"
} }
}, },
@@ -1017,11 +1106,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1708241671, "lastModified": 1708827164,
"narHash": "sha256-zSulX9tP4R35Y8A842dGSzaHMVP91W2Ry0SXvQKD2BQ=", "narHash": "sha256-oBNS6pO04Y6gZBLThP3JDDgviex0+WTXz3bVBenyzms=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "d500e370b26f9b14303cb39bf1509df0a920c8b0", "rev": "e0626adabd5ea461f80b1b11390da2a6575adb30",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1134,6 +1223,21 @@
"repo": "default", "repo": "default",
"type": "github" "type": "github"
} }
},
"systems_8": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View File

@@ -52,6 +52,11 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nixneovimplugins = {
url = "github:NixNeovim/NixNeovimPlugins";
inputs.nixpkgs.follows = "nixpkgs";
};
# { pkgs, inputs, system, ... }: # { pkgs, inputs, system, ... }:
# { # {
@@ -72,9 +77,15 @@
}; };
outputs = { nixpkgs, outputs =
# nixos, { nixpkgs
home-manager, nix-darwin, flake-utils, anyrun, neovim-nightly-overlay, ... , # nixos,
home-manager
, nix-darwin
, flake-utils
, anyrun
, neovim-nightly-overlay
, ...
}@inputs: }@inputs:
let let
config_devices = [ config_devices = [
@@ -145,21 +156,26 @@
inputs.neovim-nightly-overlay.overlay inputs.neovim-nightly-overlay.overlay
anyrun-overlay anyrun-overlay
inputs.nixneovim.overlays.default inputs.nixneovim.overlays.default
inputs.nixneovimplugins.overlays.default
]; ];
in { in
nixosConfigurations = let devices = nixos_devices; {
in import ./nixos/device.nix { nixosConfigurations =
inherit devices inputs nixpkgs home-manager overlays; let devices = nixos_devices;
}; in import ./nixos/device.nix {
inherit devices inputs nixpkgs home-manager overlays;
};
darwinConfigurations = let devices = darwin_devices; darwinConfigurations =
in import ./darwin/device.nix { let devices = darwin_devices;
inherit devices inputs nixpkgs home-manager overlays nix-darwin; in import ./darwin/device.nix {
}; inherit devices inputs nixpkgs home-manager overlays nix-darwin;
};
homeConfigurations = let devices = linux_devices; homeConfigurations =
in import ./linux/device.nix { let devices = linux_devices;
inherit devices inputs nixpkgs home-manager overlays; in import ./linux/device.nix {
}; inherit devices inputs nixpkgs home-manager overlays;
};
}; };
} }

View File

@@ -1,7 +1,7 @@
# Edit this configuration file to define what should be installed on # Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ pkgs, ... }: { { pkgs, ... }: {
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
@@ -96,7 +96,8 @@
fish fish
nushellFull nushellFull
(pkgs.wrapFirefox (pkgs.wrapFirefox
(pkgs.firefox-unwrapped.override { pipewireSupport = true; }) { }) (pkgs.firefox-unwrapped.override { pipewireSupport = true; })
{ })
gnumake gnumake
python3 python3
(nerdfonts.override { fonts = [ "FiraCode" "Hasklig" ]; }) (nerdfonts.override { fonts = [ "FiraCode" "Hasklig" ]; })