nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 rustPlatform,
6
7 openssl,
8 pkg-config,
9 installShellFiles,
10 buildPackages,
11 versionCheckHook,
12 nix-update-script,
13}:
14
15rustPlatform.buildRustPackage (finalAttrs: {
16 pname = "rattler-build";
17 version = "0.44.0";
18
19 src = fetchFromGitHub {
20 owner = "prefix-dev";
21 repo = "rattler-build";
22 tag = "v${finalAttrs.version}";
23 hash = "sha256-VgthpzZNFBIV4SwikmHJkRsuEP0j16hVt+CxOBuOy6s=";
24 };
25
26 cargoHash = "sha256-HO4DXuCs/Jtz7kzp3jn/X/75Zdh9gS0ZO3eS9GFCbXA=";
27
28 doCheck = false; # test requires network access
29
30 buildInputs = [
31 openssl
32 ];
33
34 nativeBuildInputs = [
35 pkg-config
36 installShellFiles
37 ];
38
39 cargoBuildFlags = [ "--bin rattler-build" ]; # other bin like `generate-cli-docs` shouldn't be distributed.
40
41 postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) (
42 let
43 emulator = stdenv.hostPlatform.emulator buildPackages;
44 in
45 ''
46 installShellCompletion --cmd rattler-build \
47 --bash <(${emulator} $out/bin/rattler-build completion --shell bash) \
48 --fish <(${emulator} $out/bin/rattler-build completion --shell fish) \
49 --zsh <(${emulator} $out/bin/rattler-build completion --shell zsh)
50 ''
51 );
52
53 doInstallCheck = true;
54 nativeInstallCheckInputs = [
55 versionCheckHook
56 ];
57 versionCheckProgramArg = "--version";
58
59 passthru.updateScript = nix-update-script { };
60
61 meta = {
62 description = "Universal package builder for Windows, macOS and Linux";
63 homepage = "https://rattler.build/";
64 changelog = "https://github.com/prefix-dev/rattler-build/releases/tag/v${finalAttrs.version}";
65 license = lib.licenses.bsd3;
66 maintainers = with lib.maintainers; [
67 genga898
68 xiaoxiangmoe
69 ];
70 mainProgram = "rattler-build";
71 };
72})