nixpkgs/pkgs/by-name/lu/lux-cli/package.nix
2025-08-16 03:07:53 +02:00

95 lines
1.9 KiB
Nix

{
fetchFromGitHub,
gnupg,
gpgme,
installShellFiles,
lib,
libgit2,
libgpg-error,
lua5_4,
makeWrapper,
nix,
openssl,
pkg-config,
rustPlatform,
versionCheckHook,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "lux-cli";
version = "0.15.1";
src = fetchFromGitHub {
owner = "nvim-neorocks";
repo = "lux";
tag = "v${finalAttrs.version}";
hash = "sha256-1u0zDGUytuMhqe7NOJeXd1DKch8P7FT02MYgMkX3eMc=";
};
buildAndTestSubdir = "lux-cli";
cargoHash = "sha256-C84VZfpMua1RrFhTFhWfY2xZAPDtNllkAbdHljlYdZs=";
nativeInstallCheckInputs = [
versionCheckHook
];
versionCheckProgram = "${placeholder "out"}/bin/${finalAttrs.meta.mainProgram}";
versionCheckProgramArg = "--version";
doInstallCheck = true;
nativeBuildInputs = [
installShellFiles
makeWrapper
pkg-config
];
buildInputs = [
gnupg
gpgme
libgit2
libgpg-error
lua5_4
openssl
];
env = {
LIBGIT2_NO_VENDOR = 1;
LIBSSH2_SYS_USE_PKG_CONFIG = 1;
LUX_SKIP_IMPURE_TESTS = 1; # Disable impure unit tests
};
cargoTestFlags = "--lib"; # Disable impure integration tests
nativeCheckInputs = [
lua5_4
nix
];
postBuild = ''
cargo xtask dist-man
cargo xtask dist-completions
'';
postInstall = ''
installManPage target/dist/lx.1
installShellCompletion target/dist/lx.{bash,fish} --zsh target/dist/_lx
'';
meta = {
description = "Luxurious package manager for Lua";
longDescription = ''
A modern package manager for Lua.
compatible with luarocks.org and the Rockspec specification,
with first-class support for Nix and Neovim.
'';
homepage = "https://nvim-neorocks.github.io/";
changelog = "https://github.com/nvim-neorocks/lux/blob/${finalAttrs.src.tag}/CHANGELOG.md";
license = lib.licenses.lgpl3Plus;
maintainers = with lib.maintainers; [
mrcjkb
];
platforms = lib.platforms.all;
mainProgram = "lx";
};
})