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