From 8406f15b21a55f1715d752e859a8b1da416d4199 Mon Sep 17 00:00:00 2001 From: Chris Kruining Date: Tue, 20 Aug 2024 22:13:29 +0200 Subject: [PATCH] add nvim --- default.nix | 1 + flake.lock | 259 ++++++++++++++++++++++++++++++- flake.nix | 5 + hosts/chris-pc/default.nix | 1 + modules/desktop/editors/nvim.nix | 48 ++++++ 5 files changed, 312 insertions(+), 2 deletions(-) create mode 100644 modules/desktop/editors/nvim.nix diff --git a/default.nix b/default.nix index 8d54076..a1e0cbe 100644 --- a/default.nix +++ b/default.nix @@ -9,6 +9,7 @@ in imports = [ inputs.home-manager.nixosModules.home-manager inputs.stylix.nixosModules.stylix + inputs.nixvim.nixosModules.nixvim (mkAliasOptionModule ["hm"] ["home-manager" "users" config.user.name]) (mkAliasOptionModule ["home"] ["hm" "home"]) (mkAliasOptionModule ["create" "configFile"] ["hm" "xdg" "configFile"]) diff --git a/flake.lock b/flake.lock index 1ec9117..84ebb0d 100644 --- a/flake.lock +++ b/flake.lock @@ -130,6 +130,27 @@ "type": "github" } }, + "devshell": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1722113426, + "narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=", + "owner": "numtide", + "repo": "devshell", + "rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, "firefox": { "inputs": { "cachix": "cachix", @@ -168,6 +189,20 @@ } }, "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-compat_3": { "flake": false, "locked": { "lastModified": 1673956053, @@ -183,6 +218,27 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1722555600, + "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -201,6 +257,24 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "fromYaml": { "flake": false, "locked": { @@ -217,6 +291,58 @@ "type": "github" } }, + "git-hooks": { + "inputs": { + "flake-compat": [ + "nixvim", + "flake-compat" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1723803910, + "narHash": "sha256-yezvUuFiEnCFbGuwj/bQcqg7RykIEqudOy/RBrId0pc=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "bfef0ada09e2c8ac55bbcd0831bd0c9d42e651ba", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "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" + } + }, "gnome-shell": { "flake": false, "locked": { @@ -255,6 +381,27 @@ } }, "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1723986931, + "narHash": "sha256-Fy+KEvDQ+Hc8lJAV3t6leXhZJ2ncU5/esxkgt3b8DEY=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "2598861031b78aadb4da7269df7ca9ddfc3e1671", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_3": { "inputs": { "nixpkgs": [ "stylix", @@ -310,6 +457,27 @@ "type": "github" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1723859949, + "narHash": "sha256-kiaGz4deGYKMjJPOji/JVvSP/eTefrIA3rAjOnOpXl4=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "076b9a905af8a52b866c8db068d6da475839d97b", + "type": "github" + }, + "original": { + "owner": "lnl7", + "repo": "nix-darwin", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1721562059, @@ -405,6 +573,56 @@ "type": "github" } }, + "nixvim": { + "inputs": { + "devshell": "devshell", + "flake-compat": "flake-compat_2", + "flake-parts": "flake-parts", + "git-hooks": "git-hooks", + "home-manager": "home-manager_2", + "nix-darwin": "nix-darwin", + "nixpkgs": [ + "nixpkgs" + ], + "nuschtosSearch": "nuschtosSearch", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1724127528, + "narHash": "sha256-fKtsvNQeLhPuz1O53x6Xxkd/yYecpolNXRq7mfvnXQk=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "cb413995e1e101c76d755b7f131ce60c7ea3985d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, + "nuschtosSearch": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1723969429, + "narHash": "sha256-BuewfNEXEf11MIkJY+uvWsdLu1dIvgJqntWChvNdALg=", + "owner": "NuschtOS", + "repo": "search", + "rev": "a05d1805f2a2bc47d230e5e92aecbf69f784f3d0", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "repo": "search", + "type": "github" + } + }, "plasma-manager": { "inputs": { "home-manager": [ @@ -434,6 +652,7 @@ "home-manager": "home-manager", "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable", + "nixvim": "nixvim", "plasma-manager": "plasma-manager", "rust": "rust", "stylix": "stylix" @@ -466,9 +685,9 @@ "base16-kitty": "base16-kitty", "base16-tmux": "base16-tmux", "base16-vim": "base16-vim", - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat_3", "gnome-shell": "gnome-shell", - "home-manager": "home-manager_2", + "home-manager": "home-manager_3", "nixpkgs": "nixpkgs_4" }, "locked": { @@ -499,6 +718,42 @@ "repo": "default", "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-nix": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1723808491, + "narHash": "sha256-rhis3qNuGmJmYC/okT7Dkc4M8CeUuRCSvW6kC2f3hBc=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "1d07739554fdc4f8481068f1b11d6ab4c1a4167a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 50ef845..aee4627 100644 --- a/flake.nix +++ b/flake.nix @@ -16,6 +16,11 @@ inputs.home-manager.follows = "home-manager"; }; + nixvim = { + url = "github:nix-community/nixvim"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + firefox.url = "github:nix-community/flake-firefox-nightly"; stylix.url = "github:danth/stylix"; diff --git a/hosts/chris-pc/default.nix b/hosts/chris-pc/default.nix index 5c57b04..03339ea 100644 --- a/hosts/chris-pc/default.nix +++ b/hosts/chris-pc/default.nix @@ -32,6 +32,7 @@ editors = { default = "nano"; + nvim.enable = true; nano.enable = true; }; diff --git a/modules/desktop/editors/nvim.nix b/modules/desktop/editors/nvim.nix new file mode 100644 index 0000000..5dea6ce --- /dev/null +++ b/modules/desktop/editors/nvim.nix @@ -0,0 +1,48 @@ +{ config, options, lib, pkgs, ... }: +let + inherit (lib.meta) getExe; + inherit (lib.modules) mkIf; +in +{ + options.modules.desktop.editors.nvim = let + inherit (lib.options) mkEnableOption; + in { enable = mkEnableOption "neo-vim (nixvim)"; }; + + config = mkIf config.modules.desktop.editors.nvim.enable { + programs.nixvim = { + enable = true; + + options = { + number = true; + + shiftwidth = 2; + }; + + colorschemes.gruvbox.enable = true; + + plugins = { + lualine.enable = true; + lightline.enable = true; + + lsp = { + enable = true; + servers = { + tsserver.enable = true; + lua-ls.enable = true; + rust-analyzer.enable = true; + }; + }; + + nvim-cmp = { + enable = true; + autoEnableSources = true; + sources = [ + {name = "nvim_lsp";} + {name = "path";} + {name = "buffer";} + ]; + }; + }; + }; + }; +}