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..19d9cd3 --- /dev/null +++ b/flake.lock @@ -0,0 +1,124 @@ +{ + "nodes": { + "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": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "gen-luarc": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1718922730, + "narHash": "sha256-ykhhOPqA9NzdNBr3ii+3h2DkK2+wasNqQLfMF6BXxTE=", + "owner": "mrcjkb", + "repo": "nix-gen-luarc-json", + "rev": "021e8078e43884c6cdc70ca753d9a0b146cd55a4", + "type": "github" + }, + "original": { + "owner": "mrcjkb", + "repo": "nix-gen-luarc-json", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1718714799, + "narHash": "sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c00d587b1a1afbf200b1d8f0b0e4ba9deb1c7f0e", + "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": 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_2": { + "locked": { + "lastModified": 1718870667, + "narHash": "sha256-jab3Kpc8O1z3qxwVsCMHL4+18n5Wy/HHKyu1fcsF7gs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9b10b8f00cb5494795e5f51b39210fed4d2b0748", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "gen-luarc": "gen-luarc", + "nixpkgs": "nixpkgs_2" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..fc6d5a2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,73 @@ +{ + description = "neocomplete.nvim package + dev environment"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + gen-luarc.url = "github:mrcjkb/nix-gen-luarc-json"; + }; + + outputs = inputs @ { + self, + nixpkgs, + flake-parts, + 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 = [ + gen-luarc.overlays.default + ]; + }; + luarc = pkgs.mk-luarc { + nvim = pkgs.neovim-unwrapped; + }; + 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-unwrapped config; + }; + }; + }; +}