anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / applications / radio / direwolf / default.nix
blob6cd591fcbda64d7c321ad46d78f57353e59b6455
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , cmake
5 , alsa-lib
6 , gpsd
7 , gpsdSupport ? false
8 , hamlib
9 , hamlibSupport ? true
10 , perl
11 , portaudio
12 , python3
13 , espeak
14 , udev
15 , extraScripts ? false
18 stdenv.mkDerivation rec {
19   pname = "direwolf";
20   version = "1.7";
22   src = fetchFromGitHub {
23     owner = "wb2osz";
24     repo = "direwolf";
25     rev = version;
26     hash = "sha256-Vbxc6a6CK+wrBfs15dtjfRa1LJDKKyHMrg8tqsF7EX4=";
27   };
29   nativeBuildInputs = [ cmake ];
31   strictDeps = true;
33   buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ alsa-lib udev ]
34     ++ lib.optionals stdenv.hostPlatform.isDarwin [ portaudio ]
35     ++ lib.optionals gpsdSupport [ gpsd ]
36     ++ lib.optionals hamlibSupport [ hamlib ]
37     ++ lib.optionals extraScripts [ python3 perl espeak ];
39   preConfigure = lib.optionals (!extraScripts) ''
40     echo "" > scripts/CMakeLists.txt
41   '';
43   postPatch = ''
44     substituteInPlace conf/CMakeLists.txt \
45       --replace /etc/udev/rules.d/ $out/lib/udev/rules.d/
46     substituteInPlace src/symbols.c \
47       --replace /usr/share/direwolf/symbols-new.txt $out/share/direwolf/symbols-new.txt \
48       --replace /opt/local/share/direwolf/symbols-new.txt $out/share/direwolf/symbols-new.txt
49     substituteInPlace src/decode_aprs.c \
50       --replace /usr/share/direwolf/tocalls.txt $out/share/direwolf/tocalls.txt \
51       --replace /opt/local/share/direwolf/tocalls.txt $out/share/direwolf/tocalls.txt
52     substituteInPlace cmake/cpack/direwolf.desktop.in \
53       --replace 'Terminal=false' 'Terminal=true' \
54       --replace 'Exec=@APPLICATION_DESKTOP_EXEC@' 'Exec=direwolf'
55     substituteInPlace src/dwgpsd.c \
56       --replace 'GPSD_API_MAJOR_VERSION > 11' 'GPSD_API_MAJOR_VERSION > 14'
57   ''
58   + lib.optionalString extraScripts ''
59     patchShebangs scripts/dwespeak.sh
60     substituteInPlace scripts/dwespeak.sh \
61       --replace espeak ${espeak}/bin/espeak
62   '';
64   meta = with lib; {
65     description = "Soundcard Packet TNC, APRS Digipeater, IGate, APRStt gateway";
66     homepage = "https://github.com/wb2osz/direwolf/";
67     license = licenses.gpl2;
68     platforms = platforms.unix;
69     maintainers = with maintainers; [ lasandell sarcasticadmin ];
70   };