Merge pull request #258056 from sarcasticadmin/rh/1695937430dirwolf

direwolf: make various buildInputs optional

authored by Frederik Rietdijk and committed by GitHub ae95a37b 86dbce6d

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