ctucx.git: nixfiles

ctucx' nixfiles

commit e6e89754a0fcc417a0c9a5a798cb9573faa830b6
parent 0a60a86e1666c5d7accfcfcff1ca90460b8d06a7
Author: Leah (ctucx) <leah@ctu.cx>
Date: Tue, 18 Jan 2022 15:41:30 +0100

programs/firefox: add ff2mpv
1 file changed, 30 insertions(+), 1 deletion(-)
M
configurations/programs/firefox.nix
|
31
++++++++++++++++++++++++++++++-
diff --git a/configurations/programs/firefox.nix b/configurations/programs/firefox.nix
@@ -1,8 +1,37 @@
 { pkgs, ... }:
 
-{
+let
+  ff2mpv = pkgs.stdenv.mkDerivation {
+    name = "ff2mpv";
+    src = pkgs.fetchFromGitHub{
+      owner  = "woodruffw";
+      repo   = "ff2mpv";
+      rev    = "refs/tags/v3.9.1";
+      sha256 = "0g18wf6dlnqhypmlpzn35jk3ya1vycxd6vv4nngvcx2s30fn6rcg";
+    };
+
+    buildInputs = with pkgs; [
+      python3
+    ];
+
+    installPhase = ''
+      mkdir -p $out/bin;
+      mkdir -p $out/lib/mozilla/native-messaging-hosts;
+
+      cp $src/ff2mpv.py   $out/bin/ff2mpv;
+
+      chmod +x $out/bin/ff2mpv;
+      substitute $src/ff2mpv.json $out/lib/mozilla/native-messaging-hosts/ff2mpv.json \
+        --replace "/home/william/scripts/ff2mpv" "$out/bin/ff2mpv" \
+    '';
+  };
+
+in {
   home-manager.users.leah = {
     home = {
+      file = {
+        ".mozilla/native-messaging-hosts/ff2mpv.json".source = "${ff2mpv}/lib/mozilla/native-messaging-hosts/ff2mpv.json";
+      };
       sessionVariables = {
         BROWSER = "firefox";
       };