1{
2 lib,
3 stdenv,
4 rustPlatform,
5 fetchFromGitHub,
6 openssl,
7 pkg-config,
8 versionCheckHook,
9 nix-update-script,
10 installShellFiles,
11 buildPackages,
12}:
13
14rustPlatform.buildRustPackage (finalAttrs: {
15 pname = "moon";
16 version = "1.38.5";
17
18 src = fetchFromGitHub {
19 owner = "moonrepo";
20 repo = "moon";
21 tag = "v${finalAttrs.version}";
22 hash = "sha256-jWLyg7K+ucCsrHwFNrpmWAXznSD+3TaYGfbZ2hWlnP0=";
23 };
24
25 cargoHash = "sha256-2E59P0d3SDZUgbN5V52Rr9liONiKcFUFv3dSrtFJ8NE=";
26
27 env = {
28 RUSTFLAGS = "-C strip=symbols";
29 OPENSSL_NO_VENDOR = 1;
30 };
31
32 buildInputs = [ openssl ];
33 nativeBuildInputs = [
34 pkg-config
35 installShellFiles
36 ];
37
38 postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) (
39 let
40 emulator = stdenv.hostPlatform.emulator buildPackages;
41 in
42 ''
43 installShellCompletion --cmd moon \
44 --bash <(${emulator} $out/bin/moon completions --shell bash) \
45 --fish <(${emulator} $out/bin/moon completions --shell fish) \
46 --zsh <(${emulator} $out/bin/moon completions --shell zsh)
47 ''
48 );
49
50 # Some tests fail, because test using internet connection and install NodeJS by example
51 doCheck = false;
52
53 doInstallCheck = true;
54 nativeInstallCheckInputs = [ versionCheckHook ];
55
56 passthru.updateScript = nix-update-script { };
57
58 meta = {
59 description = "Task runner and repo management tool for the web ecosystem, written in Rust";
60 mainProgram = "moon";
61 homepage = "https://github.com/moonrepo/moon";
62 changelog = "https://github.com/moonrepo/moon/releases/tag/v${finalAttrs.version}";
63 license = lib.licenses.mit;
64 maintainers = with lib.maintainers; [ flemzord ];
65 };
66})