From f66613b3b60877a41bd6062d35cab37c2f940402 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 23 Aug 2019 17:59:50 +0200 Subject: [PATCH 1/5] nixos/ofono: add module --- nixos/modules/module-list.nix | 1 + nixos/modules/services/networking/ofono.nix | 20 ++++++++++++++++++++ pkgs/tools/networking/ofono/default.nix | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 nixos/modules/services/networking/ofono.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 5335ba3abd18..f0b3e88ad7f0 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -648,6 +648,7 @@ ./services/networking/nullidentdmod.nix ./services/networking/nylon.nix ./services/networking/ocserv.nix + ./services/networking/ofono.nix ./services/networking/oidentd.nix ./services/networking/openfire.nix ./services/networking/openntpd.nix diff --git a/nixos/modules/services/networking/ofono.nix b/nixos/modules/services/networking/ofono.nix new file mode 100644 index 000000000000..58b7d7e7ed61 --- /dev/null +++ b/nixos/modules/services/networking/ofono.nix @@ -0,0 +1,20 @@ +# Ofono daemon. +{ config, lib, pkgs, ... }: + +with lib; + +{ + ###### interface + options = { + services.ofono = { + enable = mkEnableOption "Ofono"; + }; + }; + + ###### implementation + config = mkIf config.services.ofono.enable { + services.dbus.packages = [ pkgs.ofono ]; + + systemd.packages = [ pkgs.ofono ]; + }; +} diff --git a/pkgs/tools/networking/ofono/default.nix b/pkgs/tools/networking/ofono/default.nix index 1e5bd6b66f5d..168c9139dddf 100644 --- a/pkgs/tools/networking/ofono/default.nix +++ b/pkgs/tools/networking/ofono/default.nix @@ -37,7 +37,7 @@ stdenv.mkDerivation rec { ]; configureFlags = [ - "--with-dbusconfdir=${placeholder ''out''}/etc/dbus-1/system.d" + "--with-dbusconfdir=${placeholder ''out''}/share" "--with-systemdunitdir=${placeholder ''out''}/lib/systemd/system" "--enable-external-ell" ]; From 0ae487ecaafb502359d7de63ab65fb0c42b89a9c Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 23 Aug 2019 18:01:09 +0200 Subject: [PATCH 2/5] modem-manager-gui: add plug-in for ofono --- pkgs/applications/networking/modem-manager-gui/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/networking/modem-manager-gui/default.nix b/pkgs/applications/networking/modem-manager-gui/default.nix index d31f98ef4ba6..c91c760eaf59 100644 --- a/pkgs/applications/networking/modem-manager-gui/default.nix +++ b/pkgs/applications/networking/modem-manager-gui/default.nix @@ -1,4 +1,4 @@ -{ stdenv, pkgconfig, python3, fetchhg, gtk3, glib, gdbm, gtkspell3, itstool, libappindicator-gtk3, perlPackages, glibcLocales, meson, ninja }: +{ stdenv, pkgconfig, python3, fetchhg, gtk3, glib, gdbm, gtkspell3, ofono, itstool, libappindicator-gtk3, perlPackages, glibcLocales, meson, ninja }: stdenv.mkDerivation rec { name = "modem-manager-gui-${version}"; @@ -27,6 +27,7 @@ stdenv.mkDerivation rec { glib gdbm gtkspell3 + ofono libappindicator-gtk3 ]; From 150285190a2a2c57f4f9a0ecdb62afda0a0090f3 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 23 Aug 2019 18:44:19 +0200 Subject: [PATCH 3/5] modem-manager-gui: clean up --- .../networking/modem-manager-gui/default.nix | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/networking/modem-manager-gui/default.nix b/pkgs/applications/networking/modem-manager-gui/default.nix index c91c760eaf59..6dcc35f44d33 100644 --- a/pkgs/applications/networking/modem-manager-gui/default.nix +++ b/pkgs/applications/networking/modem-manager-gui/default.nix @@ -1,7 +1,22 @@ -{ stdenv, pkgconfig, python3, fetchhg, gtk3, glib, gdbm, gtkspell3, ofono, itstool, libappindicator-gtk3, perlPackages, glibcLocales, meson, ninja }: +{ stdenv +, pkgconfig +, python3 +, fetchhg +, gtk3 +, glib +, gdbm +, gtkspell3 +, ofono +, itstool +, libappindicator-gtk3 +, perlPackages +, glibcLocales +, meson +, ninja +}: stdenv.mkDerivation rec { - name = "modem-manager-gui-${version}"; + pname = "modem-manager-gui"; version = "0.0.19.1"; src = fetchhg { @@ -10,14 +25,11 @@ stdenv.mkDerivation rec { sha256 = "11iibh36567814h2bz41sa1072b86p1l13xyj670pwkh9k8kw8fd"; }; - LC_ALL = "en_US.utf-8"; - nativeBuildInputs = [ pkgconfig python3 perlPackages.Po4a itstool - glibcLocales meson ninja ]; From 5db762126cf0e9b4dc9843e043a79b3b5008efcf Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 23 Aug 2019 18:54:26 +0200 Subject: [PATCH 4/5] nixos/ofono: allow adding 3rd party plug-ins --- nixos/modules/services/networking/ofono.nix | 26 +++- ...arch-connectors-in-OFONO_PLUGIN_PATH.patch | 120 ++++++++++++++++++ pkgs/tools/networking/ofono/default.nix | 4 + 3 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 pkgs/tools/networking/ofono/0001-Search-connectors-in-OFONO_PLUGIN_PATH.patch diff --git a/nixos/modules/services/networking/ofono.nix b/nixos/modules/services/networking/ofono.nix index 58b7d7e7ed61..40ef9433de0f 100644 --- a/nixos/modules/services/networking/ofono.nix +++ b/nixos/modules/services/networking/ofono.nix @@ -3,18 +3,42 @@ with lib; +let + + cfg = config.services.ofono; + + plugin_path = + lib.concatMapStringsSep ":" + (plugin: "${plugin}/lib/ofono/plugins") + cfg.plugins + ; + +in + { ###### interface options = { services.ofono = { enable = mkEnableOption "Ofono"; + + plugins = mkOption { + type = types.listOf types.package; + default = []; + example = literalExample "[ pkgs.modem-manager-gui ]"; + description = '' + The list of plugins to install. + ''; + }; }; }; ###### implementation - config = mkIf config.services.ofono.enable { + config = mkIf cfg.enable { services.dbus.packages = [ pkgs.ofono ]; systemd.packages = [ pkgs.ofono ]; + + systemd.services.ofono.environment.OFONO_PLUGIN_PATH = mkIf (cfg.plugins != []) plugin_path; + }; } diff --git a/pkgs/tools/networking/ofono/0001-Search-connectors-in-OFONO_PLUGIN_PATH.patch b/pkgs/tools/networking/ofono/0001-Search-connectors-in-OFONO_PLUGIN_PATH.patch new file mode 100644 index 000000000000..eb97209a693e --- /dev/null +++ b/pkgs/tools/networking/ofono/0001-Search-connectors-in-OFONO_PLUGIN_PATH.patch @@ -0,0 +1,120 @@ +From 0e0994c9716700c9484b3dccb25f98a9a59d1744 Mon Sep 17 00:00:00 2001 +From: Jan Tojnar +Date: Fri, 23 Aug 2019 18:42:51 +0200 +Subject: [PATCH] Search connectors in OFONO_PLUGIN_PATH + +Previously, the connectors would only be looked for in a single +directory, specified during compilation. This patch allows to +traverse a list of directories provided by an environment variable. +--- + src/plugin.c | 77 ++++++++++++++++++++++++++++++++++------------------ + 1 file changed, 50 insertions(+), 27 deletions(-) + +diff --git a/src/plugin.c b/src/plugin.c +index 924a45ec..f05055c3 100644 +--- a/src/plugin.c ++++ b/src/plugin.c +@@ -99,35 +99,12 @@ static gboolean check_plugin(struct ofono_plugin_desc *desc, + return TRUE; + } + +-#include "builtin.h" +- +-int __ofono_plugin_init(const char *pattern, const char *exclude) +-{ +- gchar **patterns = NULL; +- gchar **excludes = NULL; +- GSList *list; +- GDir *dir; ++static handle_dir(const gchar *plugin_path, const gchar **patterns, const gchar **excludes) { + const gchar *file; + gchar *filename; +- unsigned int i; +- +- DBG(""); +- +- if (pattern) +- patterns = g_strsplit_set(pattern, ":, ", -1); +- +- if (exclude) +- excludes = g_strsplit_set(exclude, ":, ", -1); +- +- for (i = 0; __ofono_builtin[i]; i++) { +- if (check_plugin(__ofono_builtin[i], +- patterns, excludes) == FALSE) +- continue; +- +- add_plugin(NULL, __ofono_builtin[i]); +- } ++ GDir *dir; + +- dir = g_dir_open(PLUGINDIR, 0, NULL); ++ dir = g_dir_open(plugin_path, 0, NULL); + if (dir != NULL) { + while ((file = g_dir_read_name(dir)) != NULL) { + void *handle; +@@ -137,7 +114,7 @@ int __ofono_plugin_init(const char *pattern, const char *exclude) + g_str_has_suffix(file, ".so") == FALSE) + continue; + +- filename = g_build_filename(PLUGINDIR, file, NULL); ++ filename = g_build_filename(plugin_path, file, NULL); + + handle = dlopen(filename, RTLD_NOW); + if (handle == NULL) { +@@ -168,6 +145,52 @@ int __ofono_plugin_init(const char *pattern, const char *exclude) + + g_dir_close(dir); + } ++} ++ ++#include "builtin.h" ++ ++int __ofono_plugin_init(const char *pattern, const char *exclude) ++{ ++ gchar **patterns = NULL; ++ gchar **excludes = NULL; ++ GSList *list; ++ unsigned int i; ++ ++ DBG(""); ++ ++ if (pattern) ++ patterns = g_strsplit_set(pattern, ":, ", -1); ++ ++ if (exclude) ++ excludes = g_strsplit_set(exclude, ":, ", -1); ++ ++ for (i = 0; __ofono_builtin[i]; i++) { ++ if (check_plugin(__ofono_builtin[i], ++ patterns, excludes) == FALSE) ++ continue; ++ ++ add_plugin(NULL, __ofono_builtin[i]); ++ } ++ ++ ++ const gchar *plugin_path; ++ ++ plugin_path = g_getenv ("OFONO_PLUGIN_PATH"); ++ ++ if (!plugin_path) { ++ gchar **plugin_path_list; ++ gsize i; ++ ++ plugin_path_list = g_strsplit (plugin_path, G_SEARCHPATH_SEPARATOR_S, 0); ++ ++ for (i = 0; plugin_path_list[i]; i++) { ++ handle_dir(plugin_path_list, patterns, excludes); ++ } ++ ++ g_strfreev(plugin_path_list); ++ } ++ ++ handle_dir(PLUGINDIR, patterns, excludes); + + for (list = plugins; list; list = list->next) { + struct ofono_plugin *plugin = list->data; +-- +2.22.0 + diff --git a/pkgs/tools/networking/ofono/default.nix b/pkgs/tools/networking/ofono/default.nix index 168c9139dddf..21d1f9ee0675 100644 --- a/pkgs/tools/networking/ofono/default.nix +++ b/pkgs/tools/networking/ofono/default.nix @@ -22,6 +22,10 @@ stdenv.mkDerivation rec { sha256 = "1qzysmzpgbh6zc3x9xh931wxcazka9wwx727c2k66z9gal2n6n66"; }; + patches = [ + ./0001-Search-connectors-in-OFONO_PLUGIN_PATH.patch + ]; + nativeBuildInputs = [ autoreconfHook pkgconfig From 877dc46d24ae9c0a6cb3c63d57c7f3005f2e11fb Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 23 Aug 2019 20:30:28 +0200 Subject: [PATCH 5/5] ofono-phonesim: init at unstable-2014-04-22 --- .../tools/ofono-phonesim/default.nix | 47 ++++++++++++++++++ .../tools/ofono-phonesim/qt5-compat.patch | 48 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 97 insertions(+) create mode 100644 pkgs/development/tools/ofono-phonesim/default.nix create mode 100644 pkgs/development/tools/ofono-phonesim/qt5-compat.patch diff --git a/pkgs/development/tools/ofono-phonesim/default.nix b/pkgs/development/tools/ofono-phonesim/default.nix new file mode 100644 index 000000000000..137f56bee59e --- /dev/null +++ b/pkgs/development/tools/ofono-phonesim/default.nix @@ -0,0 +1,47 @@ +{ stdenv +, mkDerivation +, fetchFromGitHub +, autoreconfHook +, pkgconfig +, qtbase +, qtscript +}: + +mkDerivation rec { + pname = "ofono-phonesim"; + version = "unstable-2014-04-22"; + + src = fetchFromGitHub { + owner = "jpakkane"; + repo = "ofono-phonesim"; + rev = "baa41f04e6a86c5289d7185cad8a6f08a5c3ed0a"; + sha256 = "0ywalvvf3dfbn81ml21gji1n2hywh2nmakynakjzyyskcqjn2wiz"; + }; + + patches = [ + ./qt5-compat.patch + ]; + + nativeBuildInputs = [ + autoreconfHook + pkgconfig + ]; + + buildInputs = [ + qtbase + qtscript + ]; + + makeFlags = [ + "MOC=${qtbase.dev}/bin/moc" + "UIC=${qtbase.dev}/bin/uic" + ]; + + meta = with stdenv.lib; { + description = "Phone Simulator for modem testing"; + homepage = https://github.com/jpakkane/ofono-phonesim; + license = licenses.gpl2; + maintainers = with maintainers; [ jtojnar ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/development/tools/ofono-phonesim/qt5-compat.patch b/pkgs/development/tools/ofono-phonesim/qt5-compat.patch new file mode 100644 index 000000000000..e2e9dcebd6bc --- /dev/null +++ b/pkgs/development/tools/ofono-phonesim/qt5-compat.patch @@ -0,0 +1,48 @@ +diff --git a/configure.ac b/configure.ac +index 2436292..993df87 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -21,18 +21,18 @@ AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization], + fi + ]) + +-PKG_CHECK_MODULES(QT, QtCore QtGui QtXml QtNetwork QtScript QtDBus, dummy=yes, ++PKG_CHECK_MODULES(QT, Qt5Core Qt5Gui Qt5Widgets Qt5Xml Qt5Network Qt5Script Qt5DBus, dummy=yes, + AC_MSG_ERROR(Qt is required)) + AC_SUBST(QT_CFLAGS) + AC_SUBST(QT_LIBS) + + AC_MSG_CHECKING(for moc) +-MOC="`$PKG_CONFIG --variable=moc_location QtCore`" ++MOC="`$PKG_CONFIG --variable=moc_location Qt5Core`" + AC_SUBST(MOC) + AC_MSG_RESULT($MOC) + + AC_MSG_CHECKING(for uic) +-UIC="`$PKG_CONFIG --variable=uic_location QtCore`" ++UIC="`$PKG_CONFIG --variable=uic_location Qt5Core`" + AC_SUBST(UIC) + AC_MSG_RESULT($UIC) + +diff --git a/src/control.cpp b/src/control.cpp +index e1838a6..880da68 100644 +--- a/src/control.cpp ++++ b/src/control.cpp +@@ -22,7 +22,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +@@ -31,7 +31,7 @@ + #include + #include + #include +-#include ++#include + + #define TWO_BYTE_MAX 65535 + #define FOUR_CHAR 4 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b3ea05b72d68..b980fb4b7f5f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5128,6 +5128,8 @@ in offlineimap = callPackage ../tools/networking/offlineimap { }; + ofono-phonesim = libsForQt5.callPackage ../development/tools/ofono-phonesim/default.nix { }; + oh-my-zsh = callPackage ../shells/zsh/oh-my-zsh { }; ola = callPackage ../applications/misc/ola { };