about summary refs log tree commit diff
path: root/pkgs/tools/misc/blink1-tool/default.nix
blob: 44cfa2fbfe72b4a32f3e1ae53ef169e18b412234 (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
, stdenv
, fetchFromGitHub
, pkg-config
, libusb1
}:

stdenv.mkDerivation rec {
  pname = "blink1";
  version = "2.2.0";

  src = fetchFromGitHub {
    owner = "todbot";
    repo = "blink1-tool";
    rev = "v${version}";
    fetchSubmodules = true;
    hash = "sha256-xuCjPSQUQ/KOcdsie/ndecUiEt+t46m4eI33PXJoAAY=";
  };

  postPatch = ''
    substituteInPlace Makefile \
      --replace "@git submodule update --init" "true"
  '';

  nativeBuildInputs = [ pkg-config ];
  buildInputs = [ libusb1 ];

  makeFlags = [
    "GIT_TAG=v${version}"
    "USBLIB_TYPE=HIDAPI"
    "HIDAPI_TYPE=LIBUSB"
  ];

  hardeningDisable = [ "format" ];

  installFlags = [ "PREFIX=${placeholder "out"}" ];

  meta = with lib; {
    description = "Command line client for the blink(1) notification light";
    homepage = "https://blink1.thingm.com/";
    license = with licenses; [ cc-by-sa-40 ];
    maintainers = with maintainers; [ cransom ];
    platforms = platforms.linux;
  };
}