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.1.0";
13
14 src = fetchFromGitHub {
15 owner = "not-an-aardvark";
16 repo = pname;
17 rev = "v${version}";
18 sha256 = "0vs668i1yglfcqs94jhwdk90v0lja2w5kr5gakz082wykilms0zg";
19 };
20
21 cargoSha256 = "sha256-MvopLKhovwXaEmRgXnAzJeuhPgqnMjt0EtKUGSWFpaY=";
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}