1{
2 fetchFromGitHub,
3 gnupg,
4 gpgme,
5 installShellFiles,
6 lib,
7 libgit2,
8 libgpg-error,
9 luajit,
10 makeWrapper,
11 nix,
12 openssl,
13 pkg-config,
14 rustPlatform,
15 versionCheckHook,
16}:
17rustPlatform.buildRustPackage (finalAttrs: {
18 pname = "lux-cli";
19
20 version = "0.11.1";
21
22 src = fetchFromGitHub {
23 owner = "nvim-neorocks";
24 repo = "lux";
25 tag = "v${finalAttrs.version}";
26 hash = "sha256-yjd8nqrypgdS2UtAANv1TtuGtZPaWm7LhVrHPghf5hg=";
27 };
28
29 buildAndTestSubdir = "lux-cli";
30
31 cargoHash = "sha256-iKZ4FJ0IL1lnKuYTmFvx8umoB0z8M8xnvgb/GMfGKkI=";
32
33 nativeInstallCheckInputs = [
34 versionCheckHook
35 ];
36 versionCheckProgram = "${placeholder "out"}/bin/${finalAttrs.meta.mainProgram}";
37 versionCheckProgramArg = "--version";
38 doInstallCheck = true;
39
40 nativeBuildInputs = [
41 installShellFiles
42 makeWrapper
43 pkg-config
44 ];
45
46 buildInputs = [
47 gnupg
48 gpgme
49 libgit2
50 libgpg-error
51 luajit
52 openssl
53 ];
54
55 env = {
56 LIBGIT2_NO_VENDOR = 1;
57 LIBSSH2_SYS_USE_PKG_CONFIG = 1;
58 LUX_SKIP_IMPURE_TESTS = 1; # Disable impure unit tests
59 };
60
61 cargoTestFlags = "--lib"; # Disable impure integration tests
62
63 nativeCheckInputs = [
64 luajit
65 nix
66 ];
67
68 postBuild = ''
69 cargo xtask dist-man
70 cargo xtask dist-completions
71 '';
72
73 meta = {
74 description = "Luxurious package manager for Lua";
75 longDescription = ''
76 A modern package manager for Lua.
77 compatible with luarocks.org and the Rockspec specification,
78 with first-class support for Nix and Neovim.
79 '';
80 homepage = "https://nvim-neorocks.github.io/";
81 changelog = "https://github.com/nvim-neorocks/lux/blob/${finalAttrs.src.tag}/CHANGELOG.md";
82 license = lib.licenses.lgpl3Plus;
83 maintainers = with lib.maintainers; [
84 mrcjkb
85 ];
86 platforms = lib.platforms.all;
87 mainProgram = "lx";
88 };
89})