1{ lib
2, rustPlatform
3, fetchFromGitHub
4, withOpenCL ? true
5, stdenv
6, OpenCL
7, ocl-icd
8}:
9
10rustPlatform.buildRustPackage rec {
11 pname = "lucky-commit";
12 version = "2.2.3";
13
14 src = fetchFromGitHub {
15 owner = "not-an-aardvark";
16 repo = pname;
17 rev = "v${version}";
18 sha256 = "sha256-jxcsTtQcSuL+2vwdxIVxqTpKh8Bfvna+hkGt+Rx21FE=";
19 };
20
21 cargoHash = "sha256-8JkodGtMdYP/IIBqRcJFD5syiZi+VakDyX7VcvR0HLo=";
22
23 buildInputs = lib.optional withOpenCL (if stdenv.isDarwin then OpenCL else ocl-icd);
24
25 buildNoDefaultFeatures = !withOpenCL;
26
27 # disable tests that require gpu
28 checkNoDefaultFeatures = true;
29
30 meta = with lib; {
31 description = "Change the start of your git commit hashes to whatever you want";
32 homepage = "https://github.com/not-an-aardvark/lucky-commit";
33 license = licenses.mit;
34 maintainers = with maintainers; [ figsoda ];
35 mainProgram = "lucky_commit";
36 };
37}