From f748daba0fc4930a1e445469845d691f00c9e2dd Mon Sep 17 00:00:00 2001 From: Amneesh Singh Date: Tue, 28 May 2024 05:14:11 +0530 Subject: [PATCH] neovim: move from hosts/ to pkgs/ Signed-off-by: Amneesh Singh --- .envrc | 1 + flake.nix | 3 +- hosts/default.nix | 2 +- hosts/nix.nix | 5 +- hosts/nvim.nix | 7 +++ hosts/nvim/default.nix | 49 ----------------- pkgs/default.nix | 6 --- pkgs/nattovim/default.nix | 59 +++++++++++++++++++++ {hosts/nvim => pkgs/nattovim}/gruvbox.patch | 0 {hosts/nvim => pkgs/nattovim}/init.lua | 0 pkgs/packages.nix | 1 + 11 files changed, 75 insertions(+), 58 deletions(-) create mode 100644 .envrc create mode 100644 hosts/nvim.nix delete mode 100644 hosts/nvim/default.nix create mode 100644 pkgs/nattovim/default.nix rename {hosts/nvim => pkgs/nattovim}/gruvbox.patch (100%) rename {hosts/nvim => pkgs/nattovim}/init.lua (100%) diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/flake.nix b/flake.nix index 444e758..a30f53a 100644 --- a/flake.nix +++ b/flake.nix @@ -55,11 +55,12 @@ ]; perSystem = { system, pkgs, ... }: - { + rec { formatter = pkgs.nixpkgs-fmt; devShells.default = with pkgs; mkShell { packages = [ nixd + formatter ]; }; }; diff --git a/hosts/default.nix b/hosts/default.nix index 324f4a9..ca40da0 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -3,7 +3,7 @@ let inherit (inputs) nixpkgs; commonModules = [ - ./nvim + ./nvim.nix globalArgs ]; desktopModules = [ diff --git a/hosts/nix.nix b/hosts/nix.nix index d4aa31d..db6694e 100644 --- a/hosts/nix.nix +++ b/hosts/nix.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, self, ... }: { nixpkgs = { config = { @@ -6,6 +6,9 @@ allowBroken = true; allowInsecure = true; }; + overlays = [ + self.overlays.default + ]; }; nix = { diff --git a/hosts/nvim.nix b/hosts/nvim.nix new file mode 100644 index 0000000..e078943 --- /dev/null +++ b/hosts/nvim.nix @@ -0,0 +1,7 @@ +{ inputs, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + (nattovim.override { nvimPackage = inputs.nvim-overlay.packages.${pkgs.system}.neovim; }) + ]; +} diff --git a/hosts/nvim/default.nix b/hosts/nvim/default.nix deleted file mode 100644 index 7a9c8eb..0000000 --- a/hosts/nvim/default.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ inputs, config, pkgs, ... }: - -{ - environment.sessionVariables = { - EDITOR = "nvim"; - }; - programs.neovim = { - enable = true; - package = inputs.nvim-overlay.packages.${pkgs.system}.neovim; - defaultEditor = false; - configure = { - customRC = '' - lua << EOF - ${builtins.readFile ./init.lua} - EOF - ''; - packages.myVimPackage = with pkgs.vimPlugins; { - start = [ - nvim-colorizer-lua - bracey-vim - auto-pairs - vim-floaterm - vim-closetag - nerdcommenter - nvim-cmp - luasnip - friendly-snippets - cmp_luasnip - cmp-nvim-lsp - cmp-path - cmp-calc - cmp-emoji - # cmp-look - cmp-buffer - nvim-lspconfig - barbar-nvim - presence-nvim - nvim-web-devicons - nvim-tree-lua - nvim-treesitter - vim-latex-live-preview - lspkind-nvim - catppuccin-nvim - yuck-vim - ]; - }; - }; - }; -} diff --git a/pkgs/default.nix b/pkgs/default.nix index def0aea..5002530 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,14 +1,8 @@ { self, ... }: { - systems = [ "x86_64-linux" ]; - flake = { overlays = rec { packages = import ./packages.nix; default = packages; }; }; - - perSystem = { pkgs, ... }: { - packages = self.overlays.default null pkgs; - }; } diff --git a/pkgs/nattovim/default.nix b/pkgs/nattovim/default.nix new file mode 100644 index 0000000..bbcf9ac --- /dev/null +++ b/pkgs/nattovim/default.nix @@ -0,0 +1,59 @@ +{ wrapNeovimUnstable, neovimUtils, neovim-unwrapped, nvimPackage ? neovim-unwrapped, vimPlugins, ... }: +let + nvimConfig = neovimUtils.makeNeovimConfig { + plugins = with vimPlugins; [ + nvim-colorizer-lua + autoclose-nvim + toggleterm-nvim + luasnip + nvim-cmp + nvim-lspconfig + cmp-nvim-lsp + cmp-path + cmp-calc + cmp-emoji + cmp-buffer + barbar-nvim + nvim-web-devicons + presence-nvim + nvim-tree-lua + nvim-treesitter + lspkind-nvim + catppuccin-nvim + telescope-nvim + ]; + }; +in +wrapNeovimUnstable nvimPackage (nvimConfig // { + luaRcContent = '' + ${builtins.readFile ./init.lua} + ''; +}) +/* wrapNeovim nvimPackage { + configure = { + customRC = '' + ${builtins.readFile ./init.lua} + ''; + packages.myVimPackage = with vimPlugins; { + start = [ + nvim-colorizer-lua + autoclose-nvim + toggleterm-nvim + nvim-cmp + nvim-lspconfig + cmp-nvim-lsp + cmp-path + cmp-calc + cmp-emoji + cmp-buffer + barbar-nvim + nvim-web-devicons + presence-nvim + nvim-tree-lua + nvim-treesitter + lspkind-nvim + catppuccin-nvim + ]; + }; + }; + }*/ diff --git a/hosts/nvim/gruvbox.patch b/pkgs/nattovim/gruvbox.patch similarity index 100% rename from hosts/nvim/gruvbox.patch rename to pkgs/nattovim/gruvbox.patch diff --git a/hosts/nvim/init.lua b/pkgs/nattovim/init.lua similarity index 100% rename from hosts/nvim/init.lua rename to pkgs/nattovim/init.lua diff --git a/pkgs/packages.nix b/pkgs/packages.nix index c7e4855..e8b2e31 100644 --- a/pkgs/packages.nix +++ b/pkgs/packages.nix @@ -6,4 +6,5 @@ in customscripts = call ./customscripts { }; tlauncher = call ./tlauncher { }; simp1e-cursors = call ./simp1e { }; + nattovim = call ./nattovim { }; }