diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..a1d3540 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake . -Lv diff --git a/.gitignore b/.gitignore index e3ce15e..a335c32 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ todo.norg .libraries/ .luarc.json +.direnv +result diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c8741fc..0696d2e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -50,3 +50,18 @@ These two steps can be executed together with ```bash make dev_setup ``` + +## Nix dev environment + +For nix users, all of these tools are made available in a dev shell. + +Run +```bash +nix develop +``` + +You can test-drive a minimal Neovim package with only neocomplete.nvim and its dependencies +installed by running +```bash +nix run .#nvim +``` diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..eb68729 --- /dev/null +++ b/flake.lock @@ -0,0 +1,325 @@ +{ + "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, + "locked": { + "lastModified": 1715865404, + "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_3": { + "inputs": { + "nixpkgs-lib": [ + "nvim-nightly", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_4": { + "inputs": { + "nixpkgs-lib": [ + "nvim-nightly", + "hercules-ci-effects", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712014858, + "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "gen-luarc": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1717108591, + "narHash": "sha256-Sn6jrh9Nqp5UKJzNT0rg/DQCJCpFs/d+RM2/iENPpBo=", + "owner": "mrcjkb", + "repo": "nix-gen-luarc-json", + "rev": "39704e58b5227a82a14a00f5912e4bfccfa2b687", + "type": "github" + }, + "original": { + "owner": "mrcjkb", + "repo": "nix-gen-luarc-json", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": "flake-compat_2", + "gitignore": "gitignore", + "nixpkgs": [ + "nvim-nightly", + "nixpkgs" + ], + "nixpkgs-stable": [ + "nvim-nightly", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1717664902, + "narHash": "sha256-7XfBuLULizXjXfBYy/VV+SpYMHreNRHk9nKMsm1bgb4=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "cc4d466cb1254af050ff7bdf47f6d404a7c646d1", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nvim-nightly", + "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" + } + }, + "hercules-ci-effects": { + "inputs": { + "flake-parts": "flake-parts_4", + "nixpkgs": [ + "nvim-nightly", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1718018037, + "narHash": "sha256-03rLBd/lKecgaKz0j5ESUf9lDn5R0SJatZTKLL5unWE=", + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "rev": "0ab08b23ce3c3f75fe9a5598756b6fb8bcf0b414", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "type": "github" + } + }, + "neovim-src": { + "flake": false, + "locked": { + "lastModified": 1718749922, + "narHash": "sha256-DAx1WRYBHL9AkPKrJP0aBEtvoH3VgAXJTfALRlkD8ds=", + "owner": "neovim", + "repo": "neovim", + "rev": "a2d510e1015d57f28ab20c5d2897527cae15b9c4", + "type": "github" + }, + "original": { + "owner": "neovim", + "repo": "neovim", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1716948383, + "narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "ad57eef4ef0659193044870c731987a6df5cf56b", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1717284937, + "narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + } + }, + "nixpkgs-lib_2": { + "locked": { + "lastModified": 1714640452, + "narHash": "sha256-QBx10+k6JWz6u7VsohfSw8g8hjdBZEf8CFzXH1/1Z94=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1718606988, + "narHash": "sha256-pmjP5ePc1jz+Okona3HxD7AYT0wbrCwm9bXAlj08nDM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "38d3352a65ac9d621b0cd3074d3bef27199ff78f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1718606988, + "narHash": "sha256-pmjP5ePc1jz+Okona3HxD7AYT0wbrCwm9bXAlj08nDM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "38d3352a65ac9d621b0cd3074d3bef27199ff78f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nvim-nightly": { + "inputs": { + "flake-compat": "flake-compat", + "flake-parts": "flake-parts_3", + "git-hooks": "git-hooks", + "hercules-ci-effects": "hercules-ci-effects", + "neovim-src": "neovim-src", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1718775905, + "narHash": "sha256-1o1A/esIIRAkXfd20TmYU6jJTF3YHUlcAUNezQnizM4=", + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "rev": "42261b7220526fb7fd72912ab3e647019e1d1148", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "gen-luarc": "gen-luarc", + "nixpkgs": "nixpkgs_2", + "nvim-nightly": "nvim-nightly" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..098a37e --- /dev/null +++ b/flake.nix @@ -0,0 +1,77 @@ +{ + description = "neocomplete.nvim package + dev environment"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + nvim-nightly.url = "github:nix-community/neovim-nightly-overlay"; + gen-luarc.url = "github:mrcjkb/nix-gen-luarc-json"; + }; + + outputs = inputs @ { + self, + nixpkgs, + flake-parts, + nvim-nightly, + gen-luarc, + ... + }: + flake-parts.lib.mkFlake {inherit inputs;} { + systems = [ + "x86_64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + perSystem = {system, ...}: let + pkgs = import nixpkgs { + inherit system; + overlays = [ + nvim-nightly.overlays.default + gen-luarc.overlays.default + ]; + }; + luarc = pkgs.mk-luarc { + nvim = pkgs.neovim; + neodev-types = "nightly"; + }; + in { + devShells.default = pkgs.mkShell { + name = "lua devShell"; + shellHook = '' + ln -fs ${pkgs.luarc-to-json luarc} .luarc.json + ''; + buildInputs = with pkgs; [ + lua-language-server + stylua + alejandra + (lua5_1.withPackages (ps: + with ps; [ + luarocks + busted + luacheck + fzy + nlua + ])) + ]; + }; + + packages = rec { + default = neocomplete-nvim; + neocomplete-nvim = pkgs.vimUtils.buildVimPlugin { + pname = "neocomplete.nvim"; + version = "dev"; + src = self; + }; + nvim = let + config = pkgs.neovimUtils.makeNeovimConfig { + plugins = with pkgs; [ + neocomplete-nvim + fzy + ]; + }; + in + pkgs.wrapNeovimUnstable pkgs.neovim config; + }; + }; + }; +}