From cf62184744638413aa3b715ab8212eaf01009687 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sun, 27 Nov 2022 12:29:45 -0700 Subject: [PATCH] first neovim build package --- flake.lock | 445 ++++++++++++++++++++++++++++- flake.nix | 106 ++++++- modules/neovim/plugins-overlay.nix | 53 ++++ 3 files changed, 597 insertions(+), 7 deletions(-) create mode 100644 modules/neovim/plugins-overlay.nix diff --git a/flake.lock b/flake.lock index 6de5404..d671881 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,69 @@ { "nodes": { + "Comment-nvim-src": { + "flake": false, + "locked": { + "lastModified": 1668781964, + "narHash": "sha256-po1MyuuOH3e8yJTAtkxnusFSJuNpQnjpe+zfWPoO62E=", + "owner": "numToStr", + "repo": "Comment.nvim", + "rev": "5f01c1a89adafc52bf34e3bf690f80d9d726715d", + "type": "github" + }, + "original": { + "owner": "numToStr", + "repo": "Comment.nvim", + "type": "github" + } + }, + "bufferline-nvim-src": { + "flake": false, + "locked": { + "lastModified": 1668632062, + "narHash": "sha256-qGl1jwBaMFWsrth7F20KrfJpyVENF8GEOJsVBBcSTVA=", + "owner": "akinsho", + "repo": "bufferline.nvim", + "rev": "4ecfa81e470a589e74adcde3d5bb1727dd407363", + "type": "github" + }, + "original": { + "owner": "akinsho", + "repo": "bufferline.nvim", + "type": "github" + } + }, + "cmp-buffer-src": { + "flake": false, + "locked": { + "lastModified": 1660101488, + "narHash": "sha256-dG4U7MtnXThoa/PD+qFtCt76MQ14V1wX8GMYcvxEnbM=", + "owner": "hrsh7th", + "repo": "cmp-buffer", + "rev": "3022dbc9166796b644a841a02de8dd1cc1d311fa", + "type": "github" + }, + "original": { + "owner": "hrsh7th", + "repo": "cmp-buffer", + "type": "github" + } + }, + "cmp-nvim-lsp-src": { + "flake": false, + "locked": { + "lastModified": 1668566979, + "narHash": "sha256-Mqkp8IH/laUx0cK7S0BjusTT+OtOOJOamZM4+93RHdU=", + "owner": "hrsh7th", + "repo": "cmp-nvim-lsp", + "rev": "59224771f91b86d1de12570b4070fe4ad7cd1eeb", + "type": "github" + }, + "original": { + "owner": "hrsh7th", + "repo": "cmp-nvim-lsp", + "type": "github" + } + }, "darwin": { "inputs": { "nixpkgs": [ @@ -56,6 +120,21 @@ } }, "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -70,6 +149,37 @@ "type": "github" } }, + "flake-utils_3": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitsigns-nvim-src": { + "flake": false, + "locked": { + "lastModified": 1668016276, + "narHash": "sha256-u8nHB4QwP1hkfI64MGF5luTof88hTdpF5s1KBr3X2jE=", + "owner": "lewis6991", + "repo": "gitsigns.nvim", + "rev": "9ff7dfb051e5104088ff80556203634fc8f8546d", + "type": "github" + }, + "original": { + "owner": "lewis6991", + "repo": "gitsigns.nvim", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -92,6 +202,79 @@ "type": "github" } }, + "impatient-nvim-src": { + "flake": false, + "locked": { + "lastModified": 1668271823, + "narHash": "sha256-tsdTHbUC0kYOGonJ1TLIsHnv/RgWGTqHKY3xVj80mxM=", + "owner": "lewis6991", + "repo": "impatient.nvim", + "rev": "d3dd30ff0b811756e735eb9020609fa315bfbbcc", + "type": "github" + }, + "original": { + "owner": "lewis6991", + "repo": "impatient.nvim", + "type": "github" + } + }, + "lualine-nvim-src": { + "flake": false, + "locked": { + "lastModified": 1669435324, + "narHash": "sha256-nbvFpC6/QEIwbnw1Zy4mEutpfI/lFKfPeTXUJmRIODc=", + "owner": "hoob3rt", + "repo": "lualine.nvim", + "rev": "b6314ac556098d7abea9bb8cf896d2e3500eca41", + "type": "github" + }, + "original": { + "owner": "hoob3rt", + "repo": "lualine.nvim", + "type": "github" + } + }, + "nil": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs_2", + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1669391194, + "narHash": "sha256-4oWcXqyBYPHF+Wt8AxRhWk70O1qVJPkyBw2IhxJtj6k=", + "owner": "oxalica", + "repo": "nil", + "rev": "afec5fed829ee193de7e8c62e1fb4bd55140f4ac", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "nil", + "type": "github" + } + }, + "nix2vim": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1666021730, + "narHash": "sha256-eXd9bqYleh+BZsUybKCj7rNhnwoV0tzsuGGXKmW/+NA=", + "owner": "gytis-ivaskevicius", + "repo": "nix2vim", + "rev": "f3b56da72278cd720fe7fb4b6d001047b7179669", + "type": "github" + }, + "original": { + "owner": "gytis-ivaskevicius", + "repo": "nix2vim", + "type": "github" + } + }, "nixlib": { "locked": { "lastModified": 1636849918, @@ -145,6 +328,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1669165918, + "narHash": "sha256-hIVruk2+0wmw/Kfzy11rG3q7ev3VTi/IKVODeHcVjFo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "3b400a525d92e4085e46141ff48cbf89fd89739e", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1666959691, "narHash": "sha256-TRpWA3t8ata79HOGtFd5dDCl1kJQmIE16PDF53/Hcxo=", @@ -160,7 +359,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_4": { "locked": { "lastModified": 1660318005, "narHash": "sha256-g9WCa9lVUmOV6dYRbEPjv/TLOR5hamjeCcKExVGS3OQ=", @@ -175,6 +374,22 @@ "type": "indirect" } }, + "null-ls-nvim-src": { + "flake": false, + "locked": { + "lastModified": 1669235424, + "narHash": "sha256-po66LOeGuBHi3MZsn5+/gYdgU+oFTZUPfPWx2norc3I=", + "owner": "jose-elias-alvarez", + "repo": "null-ls.nvim", + "rev": "c51978f546a86a653f4a492b86313f4616412cec", + "type": "github" + }, + "original": { + "owner": "jose-elias-alvarez", + "repo": "null-ls.nvim", + "type": "github" + } + }, "nur": { "locked": { "lastModified": 1667025500, @@ -190,18 +405,192 @@ "type": "github" } }, + "nvim-lspconfig-src": { + "flake": false, + "locked": { + "lastModified": 1669447443, + "narHash": "sha256-ikrkXhzkn4nYqJd9WaG61UGYWRdY2cbzKQIR+kDcYqE=", + "owner": "neovim", + "repo": "nvim-lspconfig", + "rev": "abe6c99c7489de2c317869cf5dea57a9595a0cca", + "type": "github" + }, + "original": { + "owner": "neovim", + "repo": "nvim-lspconfig", + "type": "github" + } + }, + "nvim-tree-lua-src": { + "flake": false, + "locked": { + "lastModified": 1669432749, + "narHash": "sha256-YQix8eYrruuyH5pzjFvxb6hbMLhu1X/hnymO9dmbCqs=", + "owner": "kyazdani42", + "repo": "nvim-tree.lua", + "rev": "b17358ff4d822deeb42b97919065800f8f91cb55", + "type": "github" + }, + "original": { + "owner": "kyazdani42", + "repo": "nvim-tree.lua", + "type": "github" + } + }, + "nvim-treesitter-src": { + "flake": false, + "locked": { + "lastModified": 1669484329, + "narHash": "sha256-aAzVCRoqa2TDMsDKuxFRJHleR4ubA0bLaCVYk96/su8=", + "owner": "nvim-treesitter", + "repo": "nvim-treesitter", + "rev": "5aacb06135a952190933f9bfff923957db8965db", + "type": "github" + }, + "original": { + "owner": "nvim-treesitter", + "repo": "nvim-treesitter", + "type": "github" + } + }, + "nvim-web-devicons-src": { + "flake": false, + "locked": { + "lastModified": 1669423115, + "narHash": "sha256-Wyd4HnV+aQrh4Z2KdwCdi84glzIbQt8/y7NRGf67hcw=", + "owner": "kyazdani42", + "repo": "nvim-web-devicons", + "rev": "189ad3790d57c548896a78522fd8b0d0fc11be31", + "type": "github" + }, + "original": { + "owner": "kyazdani42", + "repo": "nvim-web-devicons", + "type": "github" + } + }, + "plenary-nvim-src": { + "flake": false, + "locked": { + "lastModified": 1664607953, + "narHash": "sha256-lIdBrVpi+vUudeotjFAuw4C0VT8TPoFE9cVVAQEsAYU=", + "owner": "nvim-lua", + "repo": "plenary.nvim", + "rev": "4b7e52044bbb84242158d977a50c4cbcd85070c7", + "type": "github" + }, + "original": { + "owner": "nvim-lua", + "repo": "plenary.nvim", + "type": "github" + } + }, "root": { "inputs": { + "Comment-nvim-src": "Comment-nvim-src", + "bufferline-nvim-src": "bufferline-nvim-src", + "cmp-buffer-src": "cmp-buffer-src", + "cmp-nvim-lsp-src": "cmp-nvim-lsp-src", "darwin": "darwin", "firefox-darwin": "firefox-darwin", + "gitsigns-nvim-src": "gitsigns-nvim-src", "home-manager": "home-manager", + "impatient-nvim-src": "impatient-nvim-src", + "lualine-nvim-src": "lualine-nvim-src", + "nil": "nil", + "nix2vim": "nix2vim", "nixos-generators": "nixos-generators", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", + "null-ls-nvim-src": "null-ls-nvim-src", "nur": "nur", + "nvim-lspconfig-src": "nvim-lspconfig-src", + "nvim-tree-lua-src": "nvim-tree-lua-src", + "nvim-treesitter-src": "nvim-treesitter-src", + "nvim-web-devicons-src": "nvim-web-devicons-src", + "plenary-nvim-src": "plenary-nvim-src", + "telescope-nvim-src": "telescope-nvim-src", + "telescope-project-nvim-src": "telescope-project-nvim-src", + "toggleterm-nvim-src": "toggleterm-nvim-src", + "vim-bbye-src": "vim-bbye-src", + "vim-repeat-src": "vim-repeat-src", + "vim-surround-src": "vim-surround-src", "wallpapers": "wallpapers", "wsl": "wsl" } }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "nil", + "flake-utils" + ], + "nixpkgs": [ + "nil", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1669170936, + "narHash": "sha256-TKPH4Pzkjw5gAPo9hejs3O4mWJW6V/RSiOj8UuSFRTs=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "c90c223c4aef334356029b89c72bb65e26f7efe6", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "telescope-nvim-src": { + "flake": false, + "locked": { + "lastModified": 1669224375, + "narHash": "sha256-NqMtFHgYO031WLDHb7AuVRUFMA72LHYVjbD0bt26O6I=", + "owner": "nvim-telescope", + "repo": "telescope.nvim", + "rev": "cea9c75c19d172d2c6f089f21656019734a615cf", + "type": "github" + }, + "original": { + "owner": "nvim-telescope", + "repo": "telescope.nvim", + "type": "github" + } + }, + "telescope-project-nvim-src": { + "flake": false, + "locked": { + "lastModified": 1665406281, + "narHash": "sha256-ZBFgUlW+h7vndazZ0lZux8i7yQHKJNDPQPZ2z96Rfpk=", + "owner": "nvim-telescope", + "repo": "telescope-project.nvim", + "rev": "ff4d3cea905383a67d1a47b9dd210c4907d858c2", + "type": "github" + }, + "original": { + "owner": "nvim-telescope", + "repo": "telescope-project.nvim", + "type": "github" + } + }, + "toggleterm-nvim-src": { + "flake": false, + "locked": { + "lastModified": 1667475764, + "narHash": "sha256-gazqaTsK5hAFqk6OONqTsR/zmjN3P8fPKsYufBhkeRA=", + "owner": "akinsho", + "repo": "toggleterm.nvim", + "rev": "3ba683827c623affb4d9aa518e97b34db2623093", + "type": "github" + }, + "original": { + "owner": "akinsho", + "repo": "toggleterm.nvim", + "type": "github" + } + }, "utils": { "locked": { "lastModified": 1659877975, @@ -217,6 +606,54 @@ "type": "github" } }, + "vim-bbye-src": { + "flake": false, + "locked": { + "lastModified": 1520078493, + "narHash": "sha256-xJMZQ/27TgwAnvPVH1fjF6SLOA9jvXmbfcwV0NZ1kTY=", + "owner": "moll", + "repo": "vim-bbye", + "rev": "25ef93ac5a87526111f43e5110675032dbcacf56", + "type": "github" + }, + "original": { + "owner": "moll", + "repo": "vim-bbye", + "type": "github" + } + }, + "vim-repeat-src": { + "flake": false, + "locked": { + "lastModified": 1611544268, + "narHash": "sha256-8rfZa3uKXB3TRCqaDHZ6DfzNbm7WaYnLvmTNzYtnKHg=", + "owner": "tpope", + "repo": "vim-repeat", + "rev": "24afe922e6a05891756ecf331f39a1f6743d3d5a", + "type": "github" + }, + "original": { + "owner": "tpope", + "repo": "vim-repeat", + "type": "github" + } + }, + "vim-surround-src": { + "flake": false, + "locked": { + "lastModified": 1666730476, + "narHash": "sha256-DZE5tkmnT+lAvx/RQHaDEgEJXRKsy56KJY919xiH1lE=", + "owner": "tpope", + "repo": "vim-surround", + "rev": "3d188ed2113431cf8dac77be61b842acb64433d9", + "type": "github" + }, + "original": { + "owner": "tpope", + "repo": "vim-surround", + "type": "github" + } + }, "wallpapers": { "flake": false, "locked": { @@ -236,8 +673,8 @@ "wsl": { "inputs": { "flake-compat": "flake-compat", - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs_3" + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_4" }, "locked": { "lastModified": 1666720338, diff --git a/flake.nix b/flake.nix index f8aa770..6cc5f03 100644 --- a/flake.nix +++ b/flake.nix @@ -41,6 +41,93 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + # Convert Nix to Neovim config + nix2vim = { + url = "github:gytis-ivaskevicius/nix2vim"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + # Nix language server + nil.url = "github:oxalica/nil"; + + # Neovim plugins + nvim-lspconfig-src = { + url = "github:neovim/nvim-lspconfig"; + flake = false; + }; + cmp-nvim-lsp-src = { + url = "github:hrsh7th/cmp-nvim-lsp"; + flake = false; + }; + cmp-buffer-src = { + url = "github:hrsh7th/cmp-buffer"; + flake = false; + }; + plenary-nvim-src = { + url = "github:nvim-lua/plenary.nvim"; + flake = false; + }; + null-ls-nvim-src = { + url = "github:jose-elias-alvarez/null-ls.nvim"; + flake = false; + }; + vim-surround-src = { + url = "github:tpope/vim-surround"; + flake = false; + }; + vim-repeat-src = { + url = "github:tpope/vim-repeat"; + flake = false; + }; + Comment-nvim-src = { + url = "github:numToStr/Comment.nvim"; + flake = false; + }; + impatient-nvim-src = { + url = "github:lewis6991/impatient.nvim"; + flake = false; + }; + nvim-treesitter-src = { + url = "github:nvim-treesitter/nvim-treesitter"; + flake = false; + }; + telescope-nvim-src = { + url = "github:nvim-telescope/telescope.nvim"; + flake = false; + }; + telescope-project-nvim-src = { + url = "github:nvim-telescope/telescope-project.nvim"; + flake = false; + }; + toggleterm-nvim-src = { + url = "github:akinsho/toggleterm.nvim"; + flake = false; + }; + gitsigns-nvim-src = { + url = "github:lewis6991/gitsigns.nvim"; + flake = false; + }; + lualine-nvim-src = { + url = "github:hoob3rt/lualine.nvim"; + flake = false; + }; + nvim-web-devicons-src = { + url = "github:kyazdani42/nvim-web-devicons"; + flake = false; + }; + bufferline-nvim-src = { + url = "github:akinsho/bufferline.nvim"; + flake = false; + }; + vim-bbye-src = { + url = "github:moll/vim-bbye"; + flake = false; + }; + nvim-tree-lua-src = { + url = "github:kyazdani42/nvim-tree.lua"; + flake = false; + }; + }; outputs = { self, nixpkgs, ... }@inputs: @@ -86,10 +173,23 @@ }; # Package servers into images with a generator - packages.aws = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ] - (system: { + packages = forAllSystems (system: { + + aws = { "${system}" = import ./hosts/aws { inherit inputs globals system; }; - }); + }; + + neovim = let + pkgs = import nixpkgs { + inherit system; + overlays = [ + (import ./modules/neovim/plugins-overlay.nix inputs) + inputs.nix2vim.overlay + ]; + }; + in pkgs.neovimBuilder { package = pkgs.neovim-unwrapped; }; + + }); apps = forAllSystems (system: let pkgs = import nixpkgs { inherit system; }; diff --git a/modules/neovim/plugins-overlay.nix b/modules/neovim/plugins-overlay.nix new file mode 100644 index 0000000..5296426 --- /dev/null +++ b/modules/neovim/plugins-overlay.nix @@ -0,0 +1,53 @@ +# Adopted from here: https://github.com/DieracDelta/vimconfig/blob/801b62dd56cfee59574639904a6c95b525725f66/plugins.nix + +inputs: final: prev: + +let + + # Use nixpkgs vimPlugin but with source directly from plugin author + withSrc = pkg: src: pkg.overrideAttrs (_: { inherit src; }); + + # Package plugin + plugin = pname: src: + prev.vimUtils.buildVimPluginFrom2Nix { + inherit pname src; + version = "master"; + }; + +in { + + nil = inputs.nil.packages.${prev.system}.nil; + + nvim-lspconfig = + (withSrc prev.vimPlugins.nvim-lspconfig inputs.nvim-lspconfig); + cmp-nvim-lsp = (withSrc prev.vimPlugins.cmp-nvim-lsp inputs.cmp-nvim-lsp); + cmp-buffer = (withSrc prev.vimPlugins.cmp-buffer inputs.cmp-buffer); + plenary-nvim = (withSrc prev.vimPlugins.plenary-nvim inputs.plenary-nvim); + null-ls-nvim = (withSrc prev.vimPlugins.null-ls-nvim inputs.null-ls-nvim); + vim-surround = (withSrc prev.vimPlugins.vim-surround inputs.vim-surround); + vim-repeat = (withSrc prev.vimPlugins.vim-repeat inputs.vim-repeat); + comment-nvim = (withSrc prev.vimPlugins.comment-nvim inputs.comment-nvim); + impatient-nvim = + (withSrc prev.vimPlugins.impatient-nvim inputs.impatient-nvim); + nvim-treesitter = + (withSrc prev.vimPlugins.nvim-treesitter inputs.nvim-treesitter); + telescope-nvim = + (withSrc prev.vimPlugins.telescope-nvim inputs.telescope-nvim); + telescope-project-nvim = (withSrc prev.vimPlugins.telescope-project-nvim + inputs.telescope-project-nvim); + toggleterm-nvim = + (withSrc prev.vimPlugins.toggleterm-nvim inputs.toggleterm-nvim); + gitsigns-nvim = (withSrc prev.vimPlugins.gitsigns-nvim inputs.gitsigns-nvim); + lualine-nvim = (withSrc prev.vimPlugins.lualine-nvim inputs.lualine-nvim); + nvim-web-devicons = + (withSrc prev.vimPlugins.nvim-web-devicons inputs.nvim-web-devicons); + bufferline-nvim = + (withSrc prev.vimPlugins.bufferline-nvim inputs.bufferline-nvim); + vim-bbye = (withSrc prev.vimPlugins.vim-bbye inputs.vim-bbye); + nvim-tree-lua = (withSrc prev.vimPlugins.nvim-tree-lua inputs.nvim-tree-lua); + + # Packaging plugins with Nix + # comment-nvim = plugin "comment-nvim" comment-nvim-src; + # plenary-nvim = plugin "plenary-nvim" plenary-nvim-src; + +}