summaryrefslogtreecommitdiff
path: root/lib/rust-utils.nix
blob: 87c98696f330bb47daa1ecb6b30bba9090546390 (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
{ lib
, rustPlatform
, fetchFromGitHub
}:
{
  mkRustPackage =
    { pname
    , version
    , githubOwner
    , githubHash
    , cargoHash
    , description ? null
    , license
    , maintainers
    , buildInputs ? [ ]
    , nativeBuildInputs ? [ ]
    }:
    rustPlatform.buildRustPackage rec {
      inherit pname version buildInputs nativeBuildInputs cargoHash;

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

      doCheck = false;

      meta = with lib; {
        inherit description license;
        homepage = "https://github.com/${githubOwner}/${pname}";
        inherit maintainers;
        mainProgram = pname;
      };
    };
}