about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/go/govee2mqtt/package.nix
blob: 41392d0022c13fe00a652fd6bffa1f9d80fbf95b (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
46
47
48
49
50
51
52
53
54
55
56
{ rustPlatform
, lib
, fetchFromGitHub
, fetchpatch
, openssl
, pkg-config
}:

rustPlatform.buildRustPackage rec {
  pname = "govee2mqtt";
  version = "2024.01.24-ea3cd430";

  src = fetchFromGitHub {
    owner = "wez";
    repo = "govee2mqtt";
    rev = version;
    hash = "sha256-iGOj0a4+wLd8QlM1tr+NYfd2tuwgHV+u5dt0zf+WscY=";
  };

  cargoPatches = [
    ./dont-vendor-openssl.diff
  ];

  patches = [
    # update test fixtures https://github.com/wez/govee2mqtt/pull/120
    (fetchpatch {
      url = "https://github.com/wez/govee2mqtt/commit/0c2dc3e1cc1ccd44ddf98ead34e081ac4b4335f1.patch";
      hash = "sha256-0TNYyvRRcMkE9FYPcVoKburejhAn/cVYM3eaobS4nx8=";
    })
  ];

  postPatch = ''
    substituteInPlace src/service/http.rs \
      --replace '"assets"' '"${placeholder "out"}/share/govee2mqtt/assets"'
  '';

  cargoHash = "sha256-wApf+H5T7HPkCGQwv8ePoDnStUn04oVvv3eIJ8aKVUw=";

  nativeBuildInputs = [ pkg-config ];

  buildInputs = [ openssl ];

  postInstall = ''
    mkdir -p $out/share/govee2mqtt/
    cp -r assets $out/share/govee2mqtt/
  '';

  meta = with lib; {
    description = "Connect Govee lights and devices to Home Assistant";
    homepage = "https://github.com/wez/govee2mqtt";
    changelog = "https://github.com/wez/govee2mqtt/blob/${src.rev}/addon/CHANGELOG.md";
    license = licenses.mit;
    maintainers = with maintainers; [ SuperSandro2000 ];
    mainProgram = "govee";
  };
}