From 7c785e0473905842f958f2abc234093ac9d5c971 Mon Sep 17 00:00:00 2001 From: buffet Date: Wed, 31 Jul 2024 11:00:28 +0200 Subject: [PATCH] feat: setup nvim with a bunch of random plugins --- flake.lock | 179 +++++++++++++++++++++++++++++++++------ flake.nix | 29 ++++++- users/buffet/default.nix | 1 + users/buffet/nixvim.nix | 81 ++++++++++++++++++ 4 files changed, 258 insertions(+), 32 deletions(-) create mode 100644 users/buffet/nixvim.nix diff --git a/flake.lock b/flake.lock index 0365d91..f7cbc3a 100644 --- a/flake.lock +++ b/flake.lock @@ -49,6 +49,26 @@ "type": "github" } }, + "devshell": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1722113426, + "narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=", + "owner": "numtide", + "repo": "devshell", + "rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, "disko": { "inputs": { "nixpkgs": [ @@ -70,7 +90,6 @@ } }, "flake-compat": { - "flake": false, "locked": { "lastModified": 1696426674, "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", @@ -85,6 +104,27 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1719994518, + "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": [ @@ -120,10 +160,37 @@ "type": "github" } }, + "git-hooks": { + "inputs": { + "flake-compat": [ + "flake-compat" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs-unstable" + ], + "nixpkgs-stable": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1721042469, + "narHash": "sha256-6FPUl7HVtvRHCCBQne7Ylp4p+dpP3P/OYuzjztZ4s70=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "f451c19376071a90d8c58ab1a953c6e9840527fd", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ - "pre-commit-hooks", + "git-hooks", "nixpkgs" ] }, @@ -199,6 +266,27 @@ "url": "https://git.lix.systems/lix-project/nixos-module/archive/2.90.0.tar.gz" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1720845312, + "narHash": "sha256-yPhAsJTpyoIPQZJGC8Fw8W2lAXyhLoTn+HP20bmfkfk=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "5ce8503cf402cf76b203eba4b7e402bea8e44abc", + "type": "github" + }, + "original": { + "owner": "lnl7", + "repo": "nix-darwin", + "type": "github" + } + }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -266,6 +354,42 @@ "type": "github" } }, + "nixvim": { + "inputs": { + "devshell": [ + "devshell" + ], + "flake-compat": [ + "flake-compat" + ], + "flake-parts": "flake-parts", + "git-hooks": [ + "git-hooks" + ], + "home-manager": [ + "home-manager" + ], + "nix-darwin": "nix-darwin", + "nixpkgs": [ + "nixpkgs" + ], + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1721045803, + "narHash": "sha256-dQGvOK+t45unF7DTp5bfO37hY0NkDUw6X3MH5CCTEAs=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "eef2f4c6b190d92e296e47e5fe10e7ced65fd959", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "nixos-24.05", + "repo": "nixvim", + "type": "github" + } + }, "nur": { "locked": { "lastModified": 1722249943, @@ -281,44 +405,22 @@ "type": "github" } }, - "pre-commit-hooks": { - "inputs": { - "flake-compat": "flake-compat", - "gitignore": "gitignore", - "nixpkgs": [ - "nixpkgs-unstable" - ], - "nixpkgs-stable": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1721042469, - "narHash": "sha256-6FPUl7HVtvRHCCBQne7Ylp4p+dpP3P/OYuzjztZ4s70=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "f451c19376071a90d8c58ab1a953c6e9840527fd", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, "root": { "inputs": { "agenix": "agenix", + "devshell": "devshell", "disko": "disko", + "flake-compat": "flake-compat", "flake-utils": "flake-utils", + "git-hooks": "git-hooks", "home-manager": "home-manager", "lix-module": "lix-module", "nix-index-database": "nix-index-database", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable", + "nixvim": "nixvim", "nur": "nur", - "pre-commit-hooks": "pre-commit-hooks", "systems": "systems" } }, @@ -337,6 +439,27 @@ "repo": "default", "type": "github" } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1720818892, + "narHash": "sha256-f52x9srIcqQm1Df3T+xYR5P6VfdnDFa2vkkcLhlTp6U=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "5b002f8a53ed04c1a4177e7b00809d57bd2c696f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 3c282f8..99d0ed7 100644 --- a/flake.nix +++ b/flake.nix @@ -12,6 +12,7 @@ }; inputs = { + flake-compat.url = "github:edolstra/flake-compat"; nixos-hardware.url = "github:NixOS/nixos-hardware"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; @@ -26,6 +27,14 @@ }; }; + devshell = { + url = "github:numtide/devshell"; + inputs = { + flake-utils.follows = "flake-utils"; + nixpkgs.follows = "nixpkgs"; + }; + }; + disko = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; @@ -54,9 +63,21 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - pre-commit-hooks = { - url = "github:cachix/pre-commit-hooks.nix"; + nixvim = { + url = "github:nix-community/nixvim/nixos-24.05"; inputs = { + devshell.follows = "devshell"; + flake-compat.follows = "flake-compat"; + git-hooks.follows = "git-hooks"; + home-manager.follows = "home-manager"; + nixpkgs.follows = "nixpkgs"; + }; + }; + + git-hooks = { + url = "github:cachix/git-hooks.nix"; + inputs = { + flake-compat.follows = "flake-compat"; nixpkgs.follows = "nixpkgs-unstable"; nixpkgs-stable.follows = "nixpkgs"; }; @@ -73,7 +94,7 @@ flake-utils, nixpkgs, nixpkgs-unstable, - pre-commit-hooks, + git-hooks, ... } @ args: let makeSystem = system: config: @@ -98,7 +119,7 @@ } // flake-utils.lib.eachDefaultSystem (system: { checks = { - pre-commit-check = pre-commit-hooks.lib.${system}.run { + pre-commit-check = git-hooks.lib.${system}.run { src = ./.; hooks = { alejandra.enable = true; diff --git a/users/buffet/default.nix b/users/buffet/default.nix index e190579..bbc79af 100644 --- a/users/buffet/default.nix +++ b/users/buffet/default.nix @@ -13,6 +13,7 @@ ./git.nix ./ime.nix ./mako.nix + ./nixvim.nix ./nvd.nix ./ssh.nix ./sway.nix diff --git a/users/buffet/nixvim.nix b/users/buffet/nixvim.nix new file mode 100644 index 0000000..7a51fe3 --- /dev/null +++ b/users/buffet/nixvim.nix @@ -0,0 +1,81 @@ +{ + pkgs, + nixvim, + ... +}: { + home-manager.users.buffet = { + imports = [ + nixvim.homeManagerModules.nixvim + ]; + + programs.nixvim = { + enable = true; + colorschemes.ayu.enable = true; + + plugins = { + cmp.enable = true; + cmp-async-path.enable = true; + cmp-buffer.enable = true; + cmp-calc.enable = true; + cmp-conventionalcommits.enable = true; + cmp-emoji.enable = true; + cmp-nvim-lsp.enable = true; + cmp-pandoc-nvim.enable = true; + crates-nvim.enable = true; + fugitive.enable = true; + gitsigns = { + enable = true; + settings.current_line_blame = true; + }; + lsp = { + enable = true; + servers = { + clangd.enable = true; + nil-ls.enable = true; + pyright.enable = true; + rust-analyzer = { + enable = true; + installCargo = true; + installRustc = true; + cargoPackage = pkgs.unstable.cargo; + rustcPackage = pkgs.unstable.rustc; + }; + }; + }; + lualine.enable = true; + nix.enable = true; + noice.enable = true; + oil.enable = true; + parinfer-rust.enable = true; + persistence.enable = true; + rust-tools.enable = true; + startify.enable = true; + telescope = { + enable = true; + extensions = { + fzf-native = { + enable = true; + }; + }; + }; + treesitter.enable = true; + }; + + keymaps = [ + { + action = "Telescope find_files"; + key = "f"; + mode = "n"; + options = { + silent = true; + }; + } + { + action = ""; + key = "kj"; + mode = "i"; + } + ]; + }; + }; +}