about summary refs log tree commit diff
path: root/pkgs/applications/radio/qdmr/default.nix
blob: 6217a169ef256f31d1332a6b17a0a224a02f169a (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{
  lib,
  stdenv,
  fetchFromGitHub,
  installShellFiles,
  writeText,
  cmake,
  libxslt,
  docbook_xsl_ns,
  wrapQtAppsHook,
  libusb1,
  qtlocation,
  qtserialport,
  qttools,
  qtbase,
  yaml-cpp,
}:

let
  inherit (stdenv) isLinux;
in

stdenv.mkDerivation rec {
  pname = "qdmr";
  version = "0.11.3";

  src = fetchFromGitHub {
    owner = "hmatuschek";
    repo = "qdmr";
    rev = "v${version}";
    hash = "sha256-YLGsKGcKIPd0ihd5IzlT71dYkxZfeH7BpnKQMEyY8dI=";
  };

  nativeBuildInputs = [
    cmake
    libxslt
    wrapQtAppsHook
    installShellFiles
  ];

  buildInputs = [
    libusb1
    qtlocation
    qtserialport
    qttools
    qtbase
    yaml-cpp
  ];

  postPatch = lib.optionalString isLinux ''
    substituteInPlace doc/docbook_man.debian.xsl \
      --replace /usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook\.xsl ${docbook_xsl_ns}/xml/xsl/docbook/manpages/docbook.xsl
  '';

  cmakeFlags = [
    "-DBUILD_MAN=ON"
    "-DINSTALL_UDEV_RULES=OFF"
  ];

  postInstall = ''
    installManPage doc/dmrconf.1 doc/qdmr.1
    mkdir -p "$out/etc/udev/rules.d"
    cp ${src}/dist/99-qdmr.rules $out/etc/udev/rules.d/
  '';

  meta = {
    description = "GUI application and command line tool for programming DMR radios";
    homepage = "https://dm3mat.darc.de/qdmr/";
    license = lib.licenses.gpl3Plus;
    maintainers = with lib.maintainers; [ _0x4A6F ];
    platforms = lib.platforms.linux;
  };
}