86 lines
1.7 KiB
Nix
Raw Normal View History

2025-05-03 21:56:57 +02:00
{
gnupg,
gpgme,
isLuaJIT,
lib,
libgit2,
libgpg-error,
lua,
2025-06-01 21:54:49 +02:00
lux-cli,
2025-05-03 21:56:57 +02:00
nix,
openssl,
pkg-config,
rustPlatform,
}:
let
luaMajorMinor = lib.take 2 (lib.splitVersion lua.version);
luaVersionDir = if isLuaJIT then "jit" else lib.concatStringsSep "." luaMajorMinor;
luaFeature = if isLuaJIT then "luajit" else "lua${lib.concatStringsSep "" luaMajorMinor}";
in
rustPlatform.buildRustPackage rec {
pname = "lux-lua";
2025-06-01 21:54:49 +02:00
version = lux-cli.version;
2025-05-03 21:56:57 +02:00
2025-06-01 21:54:49 +02:00
src = lux-cli.src;
2025-05-03 21:56:57 +02:00
buildAndTestSubdir = "lux-lua";
buildNoDefaultFeatures = true;
buildFeatures = [ luaFeature ];
2025-06-01 21:54:49 +02:00
cargoHash = lux-cli.cargoHash;
2025-05-03 21:56:57 +02:00
nativeBuildInputs = [
pkg-config
];
buildInputs = [
gnupg
gpgme
libgit2
libgpg-error
lua
openssl
];
2025-05-11 15:42:48 +02:00
doCheck = false; # lux-lua tests are broken in nixpkgs
2025-05-03 21:56:57 +02:00
useNextest = true;
nativeCheckInputs = [
lua
nix
];
env = {
LIBGIT2_NO_VENDOR = 1;
LIBSSH2_SYS_USE_PKG_CONFIG = 1;
LUX_SKIP_IMPURE_TESTS = 1; # Disable impure unit tests
};
buildPhase = ''
runHook preBuild
2025-05-11 15:42:48 +02:00
cargo xtask-${luaFeature} dist
mkdir -p $out
runHook postBuild
2025-05-11 15:42:48 +02:00
'';
installPhase = ''
runHook preInstall
cp -r target/dist/share $out
cp -r target/dist/lib $out
2025-05-11 15:42:48 +02:00
runHook postInstall
'';
2025-05-03 21:56:57 +02:00
cargoTestFlags = "--lib"; # Disable impure integration tests
meta = {
description = "Lua API for the Lux package manager";
homepage = "https://nvim-neorocks.github.io/";
changelog = "https://github.com/nvim-neorocks/lux/blob/${src.tag}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
mrcjkb
];
platforms = lib.platforms.all;
};
}