about summary refs log tree commit diff
path: root/pkgs/by-name/kn/knxd/package.nix
blob: bcbe85fcefc21b816692db3c9d5180e0103de679 (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
57
58
{ lib
, stdenv
, buildPackages
, fetchFromGitHub
, autoreconfHook
, pkg-config
, indent
, perl
, argp-standalone
, fmt_9
, libev
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
, withUsb ? stdenv.hostPlatform.isLinux, libusb1
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "knxd";
  version = "0.14.61";

  src = fetchFromGitHub {
    owner = "knxd";
    repo = "knxd";
    rev = finalAttrs.version;
    hash = "sha256-b8svjGaxW8YqonhXewebDUitezKoMcZxcUFGd2EKZQ4=";
  };

  postPatch = ''
    sed -i '2i echo ${finalAttrs.version}; exit' tools/version.sh
    sed -i '2i exit' tools/get_libfmt
  '';

  nativeBuildInputs = [ autoreconfHook pkg-config indent perl ];

  buildInputs = [ fmt_9 libev ]
    ++ lib.optional withSystemd systemd
    ++ lib.optional withUsb libusb1
    ++ lib.optional stdenv.hostPlatform.isDarwin argp-standalone;

  configureFlags = [
    (lib.enableFeature withSystemd "systemd")
    (lib.enableFeature withUsb "usb")
  ];

  depsBuildBuild = [ buildPackages.stdenv.cc ];

  installFlags = lib.optionals withSystemd [
    "systemdsystemunitdir=$(out)/lib/systemd/system"
    "systemdsysusersdir=$(out)/lib/sysusers.d"
  ];

  meta = with lib; {
    description = "Advanced router/gateway for KNX";
    homepage = "https://github.com/knxd/knxd";
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ sikmir ];
    platforms = platforms.unix;
  };
})