From 3e5c82d968b571fe3ebd03dcef5d7021c277c01e Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 19 Jan 2023 14:07:23 +0100 Subject: tv wwan: make uqmi-wrapper available to root --- tv/3modules/wwan.nix | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'tv') diff --git a/tv/3modules/wwan.nix b/tv/3modules/wwan.nix index 703a903c9..a60d314fd 100644 --- a/tv/3modules/wwan.nix +++ b/tv/3modules/wwan.nix @@ -26,9 +26,19 @@ with import ./lib; config = let cfg = config.tv.wwan; in mkIf cfg.enable { + nixpkgs.overlays = singleton (self: super: { + uqmi-wrapper = pkgs.symlinkJoin { + name = "uqmi-wrapper"; + paths = [ + (pkgs.writeDashBin "uqmi" '' + exec ${pkgs.uqmi}/bin/uqmi --device=${cfg.device} "$@" + '') + pkgs.uqmi + ]; + }; + }); systemd.services.wwan = { environment = { - DEVICE = cfg.device; SECRETS = "%d/secrets"; }; path = [ @@ -36,21 +46,12 @@ with import ./lib; pkgs.coreutils pkgs.iproute2 pkgs.jq - (pkgs.symlinkJoin { - name = "uqmi-wrapper"; - paths = [ - (pkgs.writeDashBin "uqmi" '' - set -efu - exec ${pkgs.uqmi}/bin/uqmi --device="$DEVICE" "$@" - '') - pkgs.uqmi - ]; - }) + pkgs.uqmi-wrapper (pkgs.writeDashBin "get-interface" ( if cfg.interface != null then /* sh */ '' echo ${cfg.interface} '' else /* sh */ '' - exec ${pkgs.libqmi}/bin/qmicli -d "$DEVICE" -p --get-wwan-iface + exec ${pkgs.libqmi}/bin/qmicli -d ${cfg.device} -p --get-wwan-iface '' )) ]; @@ -158,6 +159,9 @@ with import ./lib; ''; }; }; + users.users.root.packages = [ + pkgs.uqmi-wrapper + ]; tv.systemd.services.wwan.operators = cfg.operators; }; } -- cgit v1.2.3