about summary refs log tree commit diff stats
path: root/hm/soispha/conf/firefox/config/extensions
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-10-21 22:30:59 +0200
committerSoispha <soispha@vhack.eu>2023-10-21 22:30:59 +0200
commit27a254a27df47cac88ce8053b4efe575cf9c481e (patch)
tree5441124451062b275592bf798e9da88f10851f26 /hm/soispha/conf/firefox/config/extensions
parentfix(hm/conf/firefox/scr/extensions): Add required 'default_area' (diff)
downloadnixos-config-27a254a27df47cac88ce8053b4efe575cf9c481e.zip
feat(hm/conf/firefox): Use the policy.json file for configs
Diffstat (limited to 'hm/soispha/conf/firefox/config/extensions')
-rw-r--r--hm/soispha/conf/firefox/config/extensions/native_messaging_hosts/default.nix28
-rw-r--r--hm/soispha/conf/firefox/config/extensions/native_messaging_hosts/video-pauser.nix46
2 files changed, 74 insertions, 0 deletions
diff --git a/hm/soispha/conf/firefox/config/extensions/native_messaging_hosts/default.nix b/hm/soispha/conf/firefox/config/extensions/native_messaging_hosts/default.nix
new file mode 100644
index 00000000..053b6465
--- /dev/null
+++ b/hm/soispha/conf/firefox/config/extensions/native_messaging_hosts/default.nix
@@ -0,0 +1,28 @@
+{
+  pkgs,
+  video_pause,
+  ...
+}: let
+  video_pause_ext = import ./video-pauser.nix {inherit pkgs video_pause;};
+in
+  /*
+  ++ lib.optional (cfg.enableBrowserpass or false) (lib.getBin browserpass)
+  ++ lib.optional (cfg.enableBukubrow or false) bukubrow
+  ++ lib.optional (cfg.enableTridactylNative or false) tridactyl-native
+  ++ lib.optional (cfg.enableGnomeExtensions or false) gnome-browser-connector
+  ++ lib.optional (cfg.enableUgetIntegrator or false) uget-integrator
+  ++ lib.optional (cfg.enablePlasmaBrowserIntegration or false) plasma5Packages.plasma-browser-integration
+  ++ lib.optional (cfg.enableFXCastBridge or false) fx-cast-bridge
+  ++ lib.optional (cfg.enableKeePassXC or false) keepassxc
+
+
+  mkdir -p $out/lib/mozilla/native-messaging-hosts
+  for ext in ${toString nativeMessagingHosts}; do
+      ln -sLt $out/lib/mozilla/native-messaging-hosts $ext/lib/mozilla/native-messaging-hosts/*
+  done
+  */
+  with pkgs; [
+    video_pause_ext
+    tridactyl-native
+    keepassxc
+  ]
diff --git a/hm/soispha/conf/firefox/config/extensions/native_messaging_hosts/video-pauser.nix b/hm/soispha/conf/firefox/config/extensions/native_messaging_hosts/video-pauser.nix
new file mode 100644
index 00000000..a652b596
--- /dev/null
+++ b/hm/soispha/conf/firefox/config/extensions/native_messaging_hosts/video-pauser.nix
@@ -0,0 +1,46 @@
+{
+  pkgs,
+  video_pause,
+  ...
+}: let
+  extensions = builtins.fromJSON (builtins.readFile ../extensions.json);
+  inherit (extensions) video-pauser;
+in
+  /*
+  mkdir -p $out/lib/mozilla/native-messaging-hosts
+  for ext in ${toString nativeMessagingHosts}; do
+      ln -sLt $out/lib/mozilla/native-messaging-hosts $ext/lib/mozilla/native-messaging-hosts/*
+  done
+  */
+  pkgs.stdenv.mkDerivation {
+    inherit (video-pauser) pname version;
+    buildInputs = [
+      video_pause
+    ];
+    buildPhase = ''
+      mkdir -p $out/share/
+      cat << EOF > $out/share/"${video-pauser.pname}".json
+      {
+        "name": "${video-pauser.pname}",
+        "description": "Stop a video with a native hotkey",
+        "path": "${video_pause}/bin/video_pause",
+        "type": "stdio",
+        "allowed_extensions": ["${video-pauser.addonId}"]
+      }
+      EOF
+
+      nativeMessagingPaths="$(cat << EOF
+        lib/mozilla/native-messaging-hosts
+        lib/librewolf/native-messaging-hosts
+        etc/opt/chrome/native-messaging-hosts
+        etc/chromium/native-messaging-hosts
+        etc/vivaldi/native-messaging-hosts
+      EOF
+      )"
+
+      cat "$nativeMessagingPaths" | while read -r path; do
+        mkdir -p $out/$path;
+        cp $out/share/"${video-pauser.pname}".json $out/$path/
+      done
+    '';
+  }