about summary refs log tree commit diff
path: root/pkgs/by-name/ff/ff2mpv-rust/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/ff/ff2mpv-rust/package.nix')
-rw-r--r--pkgs/by-name/ff/ff2mpv-rust/package.nix48
1 files changed, 36 insertions, 12 deletions
diff --git a/pkgs/by-name/ff/ff2mpv-rust/package.nix b/pkgs/by-name/ff/ff2mpv-rust/package.nix
index bbc7f303f1d39..2ffd89d1ef0b1 100644
--- a/pkgs/by-name/ff/ff2mpv-rust/package.nix
+++ b/pkgs/by-name/ff/ff2mpv-rust/package.nix
@@ -3,35 +3,59 @@
 , fetchFromGitHub
 }:
 
+let
+  firefoxPaths = [
+    "lib/mozilla/native-messaging-hosts"
+
+    # wrapFirefox only links lib/mozilla path, so this is ineffective
+    # Still the above path works, despite documentation stating otherwise
+    # See: https://librewolf.net/docs/faq/#how-do-i-get-native-messaging-to-work
+    # "lib/librewolf/native-messaging-hosts"
+  ];
+
+  chromiumPaths = [
+    "etc/chromium/native-messaging-hosts"
+    "etc/opt/vivaldi/native-messaging-hosts"
+    "etc/opt/chrome/native-messaging-hosts"
+    "etc/opt/edge/native-messaging-hosts"
+  ];
+in
+
 rustPlatform.buildRustPackage rec {
   pname = "ff2mpv-rust";
-  version = "1.1.1";
+  version = "1.1.5";
 
   src = fetchFromGitHub {
     owner = "ryze312";
     repo = "ff2mpv-rust";
     rev = version;
-    hash = "sha256-sofv5uRLNbMT+w+ZDGjtKqBjYJk+UDzUDQrOiWvl5Hs=";
-  };
-
-  cargoLock = {
-    lockFile = ./Cargo.lock;
+    hash = "sha256-hAhHfNiHzrzACrijpVkzpXqrqGYKI3HIJZtUuTrRIcQ=";
   };
 
-  postPatch = ''
-    ln -s ${./Cargo.lock} Cargo.lock
-  '';
+  cargoHash = "sha256-EKmysiq1NTv1aQ1DZGS8bziY4lRr+KssBgXa8MO76Ac=";
 
   postInstall = ''
-    mkdir -p $out/lib/mozilla/native-messaging-hosts/
-    $out/bin/ff2mpv-rust manifest > $out/lib/mozilla/native-messaging-hosts/ff2mpv.json
+    $out/bin/ff2mpv-rust manifest > manifest.json
+    $out/bin/ff2mpv-rust manifest_chromium > manifest_chromium.json
+
+    for path in ${toString firefoxPaths}
+    do
+        mkdir -p "$out/$path"
+        cp manifest.json "$out/$path/ff2mpv.json"
+    done
+
+    for path in ${toString chromiumPaths}
+    do
+        mkdir -p "$out/$path"
+        cp manifest_chromium.json "$out/$path/ff2mpv.json"
+    done
   '';
 
   meta = with lib; {
     description = "Native messaging host for ff2mpv written in Rust";
     homepage = "https://github.com/ryze312/ff2mpv-rust";
     license = licenses.gpl3Only;
-    maintainers = with maintainers; [ arthsmn ];
+    maintainers = with maintainers; [ arthsmn ryze ];
     mainProgram = "ff2mpv-rust";
   };
 }