summaryrefslogtreecommitdiff
path: root/lib/rust-utils.nix
blob: 8b0efb6fa7190486e1db1a23a75bde863a040db4 (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
{
  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;
      };
    };
}