aboutsummaryrefslogtreecommitdiff
path: root/lib/build-rust-package.nix
blob: 8a788cfc9753f5b6216b5b0b58b159e053e8aed5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
  lib,
  rustPlatform,
  fetchFromGitHub,
}:
{
  pname,
  version,
  githubOwner,
  githubHash,
  cargoHash ? null,
  description ? null,
  license,
  maintainers ? null,
  buildInputs ? [ ],
  nativeBuildInputs ? [ ],
  cargoLock ? null,
  postPatch ? null,
  cargoPatches ? [ ],
}:
rustPlatform.buildRustPackage rec {
  inherit
    pname
    version
    buildInputs
    nativeBuildInputs
    cargoHash
    cargoLock
    postPatch
    cargoPatches
    ;

  src = fetchFromGitHub {
    owner = githubOwner;
    repo = pname;
    rev = version;
    hash = githubHash;
  };

  doCheck = false;

  meta = with lib; {
    inherit description license maintainers;

    homepage = "https://github.com/${githubOwner}/${pname}";
    mainProgram = pname;
  };
}