1{
2 lib,
3 rustPlatform,
4 fetchFromGitHub,
5 withOpenCL ? true,
6 stdenv,
7 ocl-icd,
8}:
9
10rustPlatform.buildRustPackage rec {
11 pname = "lucky-commit";
12 version = "2.2.5";
13
14 src = fetchFromGitHub {
15 owner = "not-an-aardvark";
16 repo = "lucky-commit";
17 rev = "v${version}";
18 sha256 = "sha256-pghc2lTI81/z1bPJ6P2bFPyZkM8pko0V7lqv9rUUxWM=";
19 };
20
21 cargoHash = "sha256-zuWPkaYltxOOLaR6NTVkf1WbKzUQByml45jNL+e5UJ0=";
22
23 buildInputs = lib.optional (withOpenCL && (!stdenv.hostPlatform.isDarwin)) 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}