From d70fb0855e76c1fd4d417c8388dd3412ef73cb39 Mon Sep 17 00:00:00 2001 From: Robert James Hernandez Date: Fri, 29 Sep 2023 16:33:29 +0000 Subject: [PATCH] direwolf: set hamlib, gpsd, and extraScripts as optional direwolf includes a set of extra scripts which showcase various capabilities of the pkg. However, they depend on languages that are not critical to building direwolf itself. --- pkgs/applications/radio/direwolf/default.nix | 26 ++++++++++++-------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/pkgs/applications/radio/direwolf/default.nix b/pkgs/applications/radio/direwolf/default.nix index 0cd513b2bb02..f72b190c8702 100644 --- a/pkgs/applications/radio/direwolf/default.nix +++ b/pkgs/applications/radio/direwolf/default.nix @@ -4,11 +4,14 @@ , cmake , alsa-lib , gpsd +, gpsdSupport ? false , hamlib +, hamlibSupport ? true , perl , python3 , espeak , udev +, extraScripts ? false }: stdenv.mkDerivation rec { @@ -26,13 +29,14 @@ stdenv.mkDerivation rec { strictDeps = true; - buildInputs = [ - espeak - gpsd - hamlib - perl - python3 - ] ++ (lib.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 \ @@ -43,14 +47,16 @@ 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 = with lib; {