From a3b504854c49e40f18dbe507559a387c7f669b9b Mon Sep 17 00:00:00 2001 From: Astro Date: Tue, 9 Nov 2021 22:52:00 +0100 Subject: [PATCH 1/3] csdr: init at 0.17.1 --- pkgs/applications/radio/csdr/default.nix | 38 ++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 40 insertions(+) create mode 100644 pkgs/applications/radio/csdr/default.nix diff --git a/pkgs/applications/radio/csdr/default.nix b/pkgs/applications/radio/csdr/default.nix new file mode 100644 index 000000000000..9b1e75c1040f --- /dev/null +++ b/pkgs/applications/radio/csdr/default.nix @@ -0,0 +1,38 @@ +{ stdenv, lib, fetchFromGitHub +, autoreconfHook, pkg-config, fftwFloat, libsamplerate +}: + +stdenv.mkDerivation rec { + pname = "csdr"; + version = "0.17.1"; + + src = fetchFromGitHub { + owner = "jketterl"; + repo = pname; + rev = version; + sha256 = "1vip5a3xgskcwba3xi66zfr986xrsch9na7my818cm8vw345y57b"; + }; + + patchPhase = '' + substituteInPlace configure.ac \ + --replace -Wformat=0 "" + ''; + + nativeBuildInputs = [ + autoreconfHook + pkg-config + ]; + + buildInputs = [ + fftwFloat + libsamplerate + ]; + + meta = with lib; { + homepage = "https://github.com/jketterl/csdr"; + description = "A simple DSP library and command-line tool for Software Defined Radio"; + license = licenses.gpl3Only; + platforms = platforms.unix; + maintainers = with maintainers; [ astro ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ef5abe3724e2..c4b75e702261 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15875,6 +15875,8 @@ with pkgs; cryptominisat = callPackage ../applications/science/logic/cryptominisat { }; + csdr = callPackage ../applications/radio/csdr { }; + ctypes_sh = callPackage ../development/libraries/ctypes_sh { }; curlcpp = callPackage ../development/libraries/curlcpp { }; From 5ab365c2a90df7a57d100aea20ed83be269c3c22 Mon Sep 17 00:00:00 2001 From: Astro Date: Tue, 9 Nov 2021 22:52:46 +0100 Subject: [PATCH 2/3] openwebrx: init at 1.1.0 --- pkgs/applications/radio/openwebrx/default.nix | 92 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 5 + 2 files changed, 97 insertions(+) create mode 100644 pkgs/applications/radio/openwebrx/default.nix diff --git a/pkgs/applications/radio/openwebrx/default.nix b/pkgs/applications/radio/openwebrx/default.nix new file mode 100644 index 000000000000..928bc4168ebd --- /dev/null +++ b/pkgs/applications/radio/openwebrx/default.nix @@ -0,0 +1,92 @@ +{ stdenv, lib, buildPythonPackage, buildPythonApplication, fetchFromGitHub +, pkg-config, cmake, setuptools +, rtl-sdr, soapysdr-with-plugins, csdr, direwolf +}: + +let + + js8py = buildPythonPackage rec { + pname = "js8py"; + version = "0.1.1"; + + src = fetchFromGitHub { + owner = "jketterl"; + repo = pname; + rev = version; + sha256 = "1j80zclg1cl5clqd00qqa16prz7cyc32bvxqz2mh540cirygq24w"; + }; + + pythonImportsCheck = [ "js8py" "test" ]; + + meta = with lib; { + homepage = "https://github.com/jketterl/js8py"; + description = "A library to decode the output of the js8 binary of JS8Call"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ astro ]; + }; + }; + + owrx_connector = stdenv.mkDerivation rec { + pname = "owrx_connector"; + version = "0.5.0"; + + src = fetchFromGitHub { + owner = "jketterl"; + repo = pname; + rev = version; + sha256 = "0gz4nf2frrkx1mpjfjpz2j919fkc99g5lxd8lhva3lgqyisvf4yj"; + }; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + + buildInputs = [ + rtl-sdr + soapysdr-with-plugins + ]; + + meta = with lib; { + homepage = "https://github.com/jketterl/owrx_connector"; + description = "A set of connectors that are used by OpenWebRX to interface with SDR hardware"; + license = licenses.gpl3Only; + platforms = platforms.unix; + maintainers = with maintainers; [ astro ]; + }; + }; + +in +buildPythonApplication rec { + pname = "openwebrx"; + version = "1.1.0"; + + src = fetchFromGitHub { + owner = "jketterl"; + repo = pname; + rev = version; + sha256 = "0maxs07yx235xknvkbmhi2zds3vfkd66l6wz6kspz3jzl4c0v1f9"; + }; + + propagatedBuildInputs = [ + setuptools + csdr + js8py + soapysdr-with-plugins + owrx_connector + direwolf + ]; + + pythonImportsCheck = [ "csdr" "owrx" "test" ]; + + passthru = { + inherit js8py owrx_connector; + }; + + meta = with lib; { + homepage = "https://github.com/jketterl/openwebrx"; + description = "A simple DSP library and command-line tool for Software Defined Radio"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ astro ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c4b75e702261..40c3abc3e607 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18895,6 +18895,11 @@ with pkgs; openrct2 = callPackage ../games/openrct2 { }; + openwebrx = callPackage ../applications/radio/openwebrx { + inherit (python3Packages) + buildPythonPackage buildPythonApplication setuptools; + }; + optparse-bash = callPackage ../development/libraries/optparse-bash { }; orcania = callPackage ../development/libraries/orcania { }; From f1020d20fa135ee2979b008727e277995c60e481 Mon Sep 17 00:00:00 2001 From: Astro Date: Tue, 9 Nov 2021 22:54:12 +0100 Subject: [PATCH 3/3] nixos/openwebrx: init --- nixos/modules/module-list.nix | 1 + nixos/modules/services/web-apps/openwebrx.nix | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 nixos/modules/services/web-apps/openwebrx.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index c5f0b211ff84..afb98db9232e 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -1015,6 +1015,7 @@ ./services/web-apps/pgpkeyserver-lite.nix ./services/web-apps/matomo.nix ./services/web-apps/moinmoin.nix + ./services/web-apps/openwebrx.nix ./services/web-apps/restya-board.nix ./services/web-apps/sogo.nix ./services/web-apps/rss-bridge.nix diff --git a/nixos/modules/services/web-apps/openwebrx.nix b/nixos/modules/services/web-apps/openwebrx.nix new file mode 100644 index 000000000000..51005cd1e497 --- /dev/null +++ b/nixos/modules/services/web-apps/openwebrx.nix @@ -0,0 +1,33 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.services.openwebrx; +in +{ + options.services.openwebrx = with lib; { + enable = mkEnableOption "OpenWebRX Web interface for Software-Defined Radios on http://localhost:8073"; + + package = mkOption { + type = types.package; + default = pkgs.openwebrx; + description = "OpenWebRX package to use for the service"; + }; + }; + + config = lib.mkIf cfg.enable { + systemd.services.openwebrx = { + wantedBy = [ "multi-user.target" ]; + path = with pkgs; [ + csdr + alsaUtils + netcat + ]; + serviceConfig = { + ExecStart = "${cfg.package}/bin/openwebrx"; + Restart = "always"; + DynamicUser = true; + # openwebrx uses /var/lib/openwebrx by default + StateDirectory = [ "openwebrx" ]; + }; + }; + }; +}