Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 30 additions & 12 deletions pkgs/applications/radio/direwolf/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
{ lib, stdenv, fetchFromGitHub, cmake, alsa-lib, espeak, gpsd
, hamlib, perl, python3, udev }:

with lib;
{ lib
, stdenv
, fetchFromGitHub
, cmake
, alsa-lib
, gpsd
, gpsdSupport ? false
, hamlib
, hamlibSupport ? true
, perl
, python3
, espeak
, udev
, extraScripts ? false
}:

stdenv.mkDerivation rec {
pname = "direwolf";
Expand All @@ -18,9 +29,14 @@ stdenv.mkDerivation rec {

strictDeps = true;

buildInputs = [
espeak gpsd hamlib perl python3
] ++ (optionals stdenv.isLinux [alsa-lib udev]);
buildInputs = lib.optionals stdenv.isLinux [ alsa-lib udev ]
++ lib.optionals gpsdSupport [ gpsd ]
++ lib.optionals hamlibSupport [ hamlib ]
++ lib.optionals extraScripts [ python3 perl espeak ];

preConfigure = lib.optionals (!extraScripts) ''
echo "" > scripts/CMakeLists.txt
'';

postPatch = ''
substituteInPlace conf/CMakeLists.txt \
Expand All @@ -31,21 +47,23 @@ stdenv.mkDerivation rec {
substituteInPlace src/decode_aprs.c \
--replace /usr/share/direwolf/tocalls.txt $out/share/direwolf/tocalls.txt \
--replace /opt/local/share/direwolf/tocalls.txt $out/share/direwolf/tocalls.txt
patchShebangs scripts/dwespeak.sh
substituteInPlace scripts/dwespeak.sh \
--replace espeak ${espeak}/bin/espeak
substituteInPlace cmake/cpack/direwolf.desktop.in \
--replace 'Terminal=false' 'Terminal=true' \
--replace 'Exec=@APPLICATION_DESKTOP_EXEC@' 'Exec=direwolf'
substituteInPlace src/dwgpsd.c \
--replace 'GPSD_API_MAJOR_VERSION > 11' 'GPSD_API_MAJOR_VERSION > 14'
''
+ lib.optionalString extraScripts ''
patchShebangs scripts/dwespeak.sh
substituteInPlace scripts/dwespeak.sh \
--replace espeak ${espeak}/bin/espeak
'';

meta = {
meta = with lib; {
description = "A Soundcard Packet TNC, APRS Digipeater, IGate, APRStt gateway";
homepage = "https://github.com/wb2osz/direwolf/";
license = licenses.gpl2;
platforms = platforms.unix;
maintainers = with maintainers; [ lasandell ];
maintainers = with maintainers; [ lasandell sarcasticadmin ];
};
}