From ab587dc84e37677be49064f13a4751d14e140147 Mon Sep 17 00:00:00 2001 From: Igor Rzegocki Date: Tue, 5 Nov 2024 16:02:40 +0100 Subject: [PATCH] feat(home-manager): add zoom --- modules/apps/default.nix | 1 + modules/apps/zoom/default.nix | 62 +++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 modules/apps/zoom/default.nix diff --git a/modules/apps/default.nix b/modules/apps/default.nix index 1d52c61..fef7a9b 100644 --- a/modules/apps/default.nix +++ b/modules/apps/default.nix @@ -32,5 +32,6 @@ _: { ./syncthing ./thunderbird ./zathura + ./zoom ]; } diff --git a/modules/apps/zoom/default.nix b/modules/apps/zoom/default.nix new file mode 100644 index 0000000..aafb2a9 --- /dev/null +++ b/modules/apps/zoom/default.nix @@ -0,0 +1,62 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.myHomeApps.zoom; +in +{ + options.myHomeApps.zoom = { + enable = lib.mkEnableOption "zoom"; + }; + + config = + let + zoomwrapper = pkgs.writeShellScriptBin "zoom-wrapper" '' + TARGET="https://app.zoom.us/wc/$(echo "$@" | awk -F/ '{ print $NF }' | grep -Eo '(^|=)[0-9]{10,}' | tr -d '=')/join" + ZOOM_PASSWORD="$(echo "$@" | grep -Eo '[?&]pwd=[^&]+' | tr '&' '?')" + + ${lib.getExe pkgs.ungoogled-chromium} --app="$TARGET$ZOOM_PASSWORD" --class="Zoom" --user-data-dir="${config.xdg.stateHome}/zoom" + ''; + in + lib.mkIf cfg.enable { + home.packages = [ zoomwrapper ]; + + myHomeApps.firefox.extraConfig = { + "network.protocol-handler.expose.zoommtg" = false; + }; + + xdg = { + dataFile = { + "applications/Zoom.desktop".text = '' + [Desktop Entry] + Name=Zoom + Comment=Zoom Video Conference + Exec=${lib.getExe zoomwrapper} %U + Icon=Zoom + Terminal=false + Type=Application + Encoding=UTF-8 + Categories=Network;Application; + StartupWMClass=zoom + MimeType=x-scheme-handler/zoommtg;x-scheme-handler/zoomus;x-scheme-handler/tel;x-scheme-handler/callto;x-scheme-handler/zoomphonecall;application/x-zoom + X-KDE-Protocols=zoommtg;zoomus;tel;callto;zoomphonecall; + Name[en_US]=Zoom + ''; + }; + + mimeApps = { + defaultApplications = { + "x-scheme-handler/zoommtg" = "Zoom.desktop"; + "x-scheme-handler/zoomus" = "Zoom.desktop"; + "x-scheme-handler/tel" = "Zoom.desktop"; + "x-scheme-handler/callto" = "Zoom.desktop"; + "x-scheme-handler/zoomphonecall" = "Zoom.desktop"; + "application/x-zoom" = "Zoom.desktop"; + }; + }; + }; + }; +}