Skip to content

Commit

Permalink
build: add nix dev environment (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb authored Jun 21, 2024
1 parent f724edc commit e20cec4
Show file tree
Hide file tree
Showing 5 changed files with 215 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake . -Lv
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
todo.norg
.libraries/
.luarc.json
.direnv
result
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
124 changes: 124 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 73 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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;
};
};
};
}

0 comments on commit e20cec4

Please sign in to comment.