Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync Flake with nix derivation changes for easier extension of available Lua modules #2186

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build-aux/ax_lua_require.m4
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ AC_DEFUN([AX_LUA_REQUIRE],[
ACTION_IF_FOUND
], [
AC_MSG_RESULT([unable to load])
m4_ifset([ACTION_IF_NOT_FOUND][ACTION_IF_NOT_FOUND],
m4_ifset([ACTION_IF_NOT_FOUND],[ACTION_IF_NOT_FOUND],
[AC_MSG_FAILURE([cannot find Lua module MODULE])])
])

Expand Down
90 changes: 40 additions & 50 deletions build-aux/pkg.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
cargo,
rustc,
rustPlatform,
luarocks,

# buildInputs
cargo-edit,
Expand All @@ -28,7 +29,6 @@
stylua,
taplo,
typos,
darwin,
# FONTCONFIG_FILE
makeFontsConf,
gentium,
Expand All @@ -41,49 +41,6 @@
libtexpdf-src,
}:

let
luaEnv = lua.withPackages (
ps:
with ps;
[
# used for module detection, also recommended at runtime for 3rd party module installation
luarocks

# modules used at runtime
cassowary
cldr
fluent
linenoise
loadkit
lpeg
lua-zlib
lua_cliargs
luaepnf
luaexpat
luafilesystem
luarepl
luasec
luasocket
luautf8
penlight
vstruct

# lua packages needed for testing
busted
luacheck

# packages needed for building api docs
ldoc
]
++ lib.optionals (lib.versionOlder lua.luaversion "5.2") [
bit32
]
++ lib.optionals (lib.versionOlder lua.luaversion "5.3") [
compat53
]
);

in
stdenv.mkDerivation (finalAttrs: {
pname = "sile";
inherit version src;
Expand All @@ -104,7 +61,10 @@ stdenv.mkDerivation (finalAttrs: {
cargo
rustc
rustPlatform.cargoSetupHook
luarocks
];
# luarocks propagates cmake, but it shouldn't be used as a build system.
dontUseCmakeConfigure = true;

preAutoreconf = ''
# Add the libtexpdf src instead of the git submodule. (From some reason
Expand All @@ -120,8 +80,8 @@ stdenv.mkDerivation (finalAttrs: {

buildInputs =
[
finalAttrs.finalPackage.passthru.luaEnv
cargo-edit
luaEnv
harfbuzz
icu
fontconfig
Expand All @@ -130,9 +90,6 @@ stdenv.mkDerivation (finalAttrs: {
stylua
taplo
typos
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.AppKit
];

configureFlags =
Expand Down Expand Up @@ -175,8 +132,41 @@ stdenv.mkDerivation (finalAttrs: {
'';

passthru = {
# So it will be easier to inspect this environment, in comparison to others
inherit luaEnv;

luaPackages =
[
# modules used at runtime
"cassowary"
"cldr"
"fluent"
"linenoise"
"loadkit"
"lpeg"
"lua-zlib"
"lua_cliargs"
"luaepnf"
"luaexpat"
"luafilesystem"
"luarepl"
"luasec"
"luasocket"
"luautf8"
"penlight"
"vstruct"
# lua packages needed for testing
"busted"
"luacheck"
# packages needed for building api docs
"ldoc"
]
++ lib.optionals (lib.versionOlder lua.luaversion "5.2") [
"bit32"
]
++ lib.optionals (lib.versionOlder lua.luaversion "5.3") [
"compat53"
];
luaEnv = lua.withPackages (ps: lib.attrVals finalAttrs.finalPackage.passthru.luaPackages ps);

# Copied from Makefile.am
tests.test = lib.optionalAttrs (!(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)) (
runCommand "${finalAttrs.pname}-test"
Expand Down
12 changes: 6 additions & 6 deletions flake.lock

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

Loading