Skip to content

Commit

Permalink
feat: neorocksTest Nix helper
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Aug 26, 2023
1 parent dac35a3 commit 2e39866
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 9 deletions.
9 changes: 9 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@

checks = {
inherit pre-commit-check;
neorocks-test = pkgs.neorocksTest {
src = ./testproject;
name = "testproject";
neovim = pkgs.neovim-nightly;
luaPackages = ps:
with ps; [
plenary-nvim
];
};
};
})
// {
Expand Down
66 changes: 57 additions & 9 deletions nix/overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,67 @@ with prev.lib; let
self = luajit;
};

neorocks = prev.pkgs.symlinkJoin {
name = "neorocks";
paths = [
final.luajit
final.luajitPackages.luarocks
neolua-stable-wrapper
neolua-nightly-wrapper
];
};
mkNeorocks = neolua-pkgs:
prev.pkgs.symlinkJoin {
name = "neorocks";
paths =
[
final.luajit
final.luajitPackages.luarocks
]
++ neolua-pkgs;
};

neorocks = mkNeorocks [
neolua-stable-wrapper
neolua-nightly-wrapper
];

neorocksTest = {
src,
name,
neovim ? neovim-nightly,
version ? "scm-1",
luaPackages ? [],
}: let
neolua-wrapper = mkNeoluaWrapper "neolua" neovim;
luajit =
(prev.pkgs.luajit.overrideAttrs (old: {
postInstall = ''
${old.postInstall}
ln -s ${neolua-wrapper}/bin/neolua $out/bin/neolua
'';
}))
.override {
self = luajit;
};

buildLuarocksPackage = luajit.pkgs.buildLuarocksPackage;
in
buildLuarocksPackage {
inherit src version;
pname = name;
propagatedBuildInputs = with final.pkgs.luajitPackages;
[
busted
]
++ luaPackages luajit.pkgs;
nativeCheckInputs = [
neolua-wrapper
luajit
];
doCheck = true;
preCheck = ''
luarocks config lua_interpreter neolua
luarocks config variables.LUA_INCDIR ${luajit}/include/luajit-2.1
'';
};
in {
inherit
haskellPackages
neorocks
neorocksTest
neovim-nightly
;
luajitPackages = luajit.pkgs;
}

0 comments on commit 2e39866

Please sign in to comment.