Skip to content

Commit

Permalink
fix(tooling): Use luaEnv properly (#1679)
Browse files Browse the repository at this point in the history
As discussed at:
e8a56ae
  • Loading branch information
doronbehar authored Jan 25, 2023
1 parent 7a4f9ee commit a34e1c1
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 58,10 @@
luautf8
penlight
vstruct
# lua packages needed for testing
busted
luacheck
luarocks
# If we want to test things with lua5.2 or an even older lua, we uncomment these
#bit32
#compat53
Expand Down Expand Up @@ -107,23 111,36 @@
nativeBuildInputs = oldAttr.nativeBuildInputs [
pkgs.autoreconfHook
];
buildInputs = [
# Add here inputs needed for development, and not for Nixpkgs' build.
pkgs.libarchive
pkgs.perl
# This line, along with the `pkgs.list.drop 1` line afterwards,
# replaces the luaEnv originated in `oldAttr.buildInputs`.
luaEnv
] (
# Add all buildInputs from Nixpkgs' derivation, besides the 1st
# one, which is Nixpkgs' luaEnv. NOTE it's not mandatory to `drop`
# the first buildInput of `oldAttr` as so, because the first `lua`
# interpreter that would have been found otherwise would have been
# the one belonging to the first `luaEnv` of the final
# `buildInputs`. However, we'd like to keep the `buildInputs` clean
# never the less.
pkgs.lib.lists.drop 1 oldAttr.buildInputs
);
meta = oldAttr.meta // {
changelog = "https://github.com/sile-typesetter/sile/raw/master/CHANGELOG.md";
};
});
in rec {
devShells = {
default = pkgs.mkShell {
inherit (sile) checkInputs nativeBuildInputs;
buildInputs = sile.buildInputs [
pkgs.libarchive
pkgs.perl
];
luaEnv = luaEnv pkgs.lua5_3.withPackages(ps: with ps; [
pkgs.lua53Packages.busted
pkgs.lua53Packages.luacheck
pkgs.lua53Packages.luarocks
]);
inherit (sile) checkInputs nativeBuildInputs buildInputs;
# This is written in Nixpkgs' expression as well, but we need to write
# this here so that the overridden luaEnv will be used instead.
passthru = {
inherit luaEnv;
};
};
};
packages.sile = sile;
Expand Down

0 comments on commit a34e1c1

Please sign in to comment.