From 7df2053a804e6076ea03622ad3f5b9406498ee6b Mon Sep 17 00:00:00 2001 From: Patrick Malolepszy Date: Wed, 1 Oct 2025 06:45:38 -0400 Subject: [PATCH] Init commit --- README.md | 17 ++++ config/bufferline.nix | 6 ++ config/cmp.nix | 13 +++ config/config.nix | 45 +++++++++ config/default.nix | 10 ++ config/lsp.nix | 17 ++++ config/telescope.nix | 10 ++ config/treesitter.nix | 10 ++ flake.lock | 219 ++++++++++++++++++++++++++++++++++++++++++ flake.nix | 47 +++++++++ 10 files changed, 394 insertions(+) create mode 100644 README.md create mode 100644 config/bufferline.nix create mode 100644 config/cmp.nix create mode 100644 config/config.nix create mode 100644 config/default.nix create mode 100644 config/lsp.nix create mode 100644 config/telescope.nix create mode 100644 config/treesitter.nix create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/README.md b/README.md new file mode 100644 index 0000000..bff36b7 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# Nixvim template + +This template gives you a good starting point for configuring nixvim standalone. + +## Configuring + +To start configuring, just add or modify the nix files in `./config`. +If you add a new configuration file, remember to add it to the +[`config/default.nix`](./config/default.nix) file + +## Testing your new configuration + +To test your configuration simply run the following command + +``` +nix run . +``` diff --git a/config/bufferline.nix b/config/bufferline.nix new file mode 100644 index 0000000..2dfee9e --- /dev/null +++ b/config/bufferline.nix @@ -0,0 +1,6 @@ +{ + plugins = { + bufferline.enable = true; + web-devicons.enable = true; + }; +} diff --git a/config/cmp.nix b/config/cmp.nix new file mode 100644 index 0000000..b2d9c3c --- /dev/null +++ b/config/cmp.nix @@ -0,0 +1,13 @@ +{ + plugins = { + cmp = { + enable = true; + autoEnableSources = true; + settings.sources = [ + { name = "nvim_lsp"; } + { name = "buffer"; } + { name = "path"; } + ]; + }; +}; +} diff --git a/config/config.nix b/config/config.nix new file mode 100644 index 0000000..9f45f8c --- /dev/null +++ b/config/config.nix @@ -0,0 +1,45 @@ +{ + colorschemes.catppuccin.enable = true; + globals = { + mapleader = " "; + }; + opts = { + number = true; + relativenumber = true; + spell = true; + spellfile = "~/.config/nvim/spell/en.utf-8.add"; + shiftwidth = 2; + }; + keymaps = [ + { + mode = "n"; + key = "s"; + action = "[s"; + } + { + mode = "n"; + key = "S"; + action = "]s"; + } + { + mode = "n"; + key = "z"; + action = "z="; + } + { + mode = "n"; + key = "Z"; + action = "1z="; + } + { + mode = "n"; + key = "N"; + action = ":bprev"; + } + { + mode = "n"; + key = "n"; + action = ":bnext"; + } + ]; +} diff --git a/config/default.nix b/config/default.nix new file mode 100644 index 0000000..a8eb480 --- /dev/null +++ b/config/default.nix @@ -0,0 +1,10 @@ +{ + imports = [ + ./config.nix + ./telescope.nix + ./bufferline.nix + ./treesitter.nix + ./lsp.nix + ./cmp.nix + ]; +} diff --git a/config/lsp.nix b/config/lsp.nix new file mode 100644 index 0000000..4e83bc2 --- /dev/null +++ b/config/lsp.nix @@ -0,0 +1,17 @@ +{ + plugins = { + lsp = { + enable = true; + servers = { + rust_analyzer = { + enable = true; + installCargo = false; + installRustc = false; + }; + nil_ls = { + enable = true; + }; + }; + }; + }; +} diff --git a/config/telescope.nix b/config/telescope.nix new file mode 100644 index 0000000..7794e47 --- /dev/null +++ b/config/telescope.nix @@ -0,0 +1,10 @@ +{ + plugins = { + telescope = { + enable = true; + keymaps = { + "ff" = "find_files"; + }; + }; +}; +} diff --git a/config/treesitter.nix b/config/treesitter.nix new file mode 100644 index 0000000..abfb1f3 --- /dev/null +++ b/config/treesitter.nix @@ -0,0 +1,10 @@ +{ + plugins = { + treesitter = { + enable = true; + settings = { + ensure_installed = [ "rust" ]; + }; + }; +}; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..1b2935c --- /dev/null +++ b/flake.lock @@ -0,0 +1,219 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1756770412, + "narHash": "sha256-+uWLQZccFHwqpGqr2Yt5VsW/PbeJVTn9Dk6SHWhNRPw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "4524271976b625a4a605beefd893f270620fd751", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1756770412, + "narHash": "sha256-+uWLQZccFHwqpGqr2Yt5VsW/PbeJVTn9Dk6SHWhNRPw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "4524271976b625a4a605beefd893f270620fd751", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "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" + } + }, + "ixx": { + "inputs": { + "flake-utils": [ + "nixvim", + "nuschtosSearch", + "flake-utils" + ], + "nixpkgs": [ + "nixvim", + "nuschtosSearch", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1754860581, + "narHash": "sha256-EM0IE63OHxXCOpDHXaTyHIOk2cNvMCGPqLt/IdtVxgk=", + "owner": "NuschtOS", + "repo": "ixx", + "rev": "babfe85a876162c4acc9ab6fb4483df88fa1f281", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "ref": "v0.1.1", + "repo": "ixx", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1758763312, + "narHash": "sha256-puBMviZhYlqOdUUgEmMVJpXqC/ToEqSvkyZ30qQ09xM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e57b3b16ad8758fd681511a078f35c416a8cc939", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1754788789, + "narHash": "sha256-x2rJ+Ovzq0sCMpgfgGaaqgBSwY+LST+WbZ6TytnT9Rk=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "a73b9c743612e4244d865a2fdee11865283c04e6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1758701979, + "narHash": "sha256-c7DUti3XM1aga8oVgaPnrVmEeCFtN9PaBxyNuqx8jPc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e2642aa7d5a15eae586932a56f4294934f959c14", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixvim": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": "nixpkgs_2", + "nuschtosSearch": "nuschtosSearch", + "systems": "systems_2" + }, + "locked": { + "lastModified": 1758834902, + "narHash": "sha256-Pt7YS5qKMdh6gU0NP6+7qfe/TFlgjo2gnOSmF9fLQ9A=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "da7b983a29ffb8a390a4be7dfd643467c63543bf", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, + "nuschtosSearch": { + "inputs": { + "flake-utils": "flake-utils", + "ixx": "ixx", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1758662783, + "narHash": "sha256-igrxT+/MnmcftPOHEb+XDwAMq3Xg1Xy7kVYQaHhPlAg=", + "owner": "NuschtOS", + "repo": "search", + "rev": "7d4c0fc4ffe3bd64e5630417162e9e04e64b27a4", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "repo": "search", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "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" + } + }, + "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" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..833b0d3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,47 @@ +{ + description = "A nixvim configuration"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + nixvim.url = "github:nix-community/nixvim"; + flake-parts.url = "github:hercules-ci/flake-parts"; + }; + + outputs = + { nixvim, flake-parts, ... }@inputs: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + + perSystem = + { system, ... }: + let + nixvimLib = nixvim.lib.${system}; + nixvim' = nixvim.legacyPackages.${system}; + nixvimModule = { + inherit system; # or alternatively, set `pkgs` + module = import ./config; # import the module directly + # You can use `extraSpecialArgs` to pass additional arguments to your module files + extraSpecialArgs = { + # inherit (inputs) foo; + }; + }; + nvim = nixvim'.makeNixvimWithModule nixvimModule; + in + { + checks = { + # Run `nix flake check .` to verify that your config is not broken + default = nixvimLib.check.mkTestDerivationFromNixvimModule nixvimModule; + }; + + packages = { + # Lets you run `nix run .` to start nixvim + default = nvim; + }; + }; + }; +}