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 2fd2e95
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-override =
(prev.pkgs.luajit.overrideAttrs (old: {
postInstall = ''
${old.postInstall}
ln -s ${neolua-wrapper}/bin/neolua $out/bin/neolua
'';
}))
.override {
self = luajit-override;
};

buildLuarocksPackage = luajit-override.pkgs.buildLuarocksPackage;
in
buildLuarocksPackage {
inherit src version;
pname = name;
propagatedBuildInputs = with luajit-override.pkgs;
[
busted
]
++ luaPackages luajit-override.pkgs;
doCheck = true;
extraConfig = ''
lua_interpreter = "neolua"
'';
extraVariables = {
LUA_BINDIR = "${luajit-override}/bin";
LUA_DIR = "${luajit-override}";
LUA_INCDIR = "${luajit-override}/include/luajit-2.1";
};
};
in {
inherit
haskellPackages
neorocks
neorocksTest
neovim-nightly
;
luajitPackages = luajit.pkgs;
}

0 comments on commit 2fd2e95

Please sign in to comment.