1{ lib, stdenv, fetchFromGitHub, python3, pass }:
2
3stdenv.mkDerivation rec {
4 pname = "passff-host";
5 version = "1.2.2";
6
7 src = fetchFromGitHub {
8 owner = "passff";
9 repo = pname;
10 rev = version;
11 sha256 = "sha256-9q4onU/e/pzLp5lGQjf/ScOOCVMiMQRaLGEm8K8flX4=";
12 };
13
14 buildInputs = [ python3 ];
15 makeFlags = [ "VERSION=${version}" ];
16
17 patchPhase = ''
18 sed -i 's#COMMAND = "pass"#COMMAND = "${pass}/bin/pass"#' src/passff.py
19 '';
20
21 installPhase = ''
22 substituteInPlace bin/${version}/passff.json \
23 --replace PLACEHOLDER $out/share/passff-host/passff.py
24
25 install -Dt $out/share/passff-host \
26 bin/${version}/passff.{py,json}
27
28 nativeMessagingPaths=(
29 /lib/mozilla/native-messaging-hosts
30 /etc/opt/chrome/native-messaging-hosts
31 /etc/chromium/native-messaging-hosts
32 /etc/vivaldi/native-messaging-hosts
33 )
34
35 for manifestDir in "''${nativeMessagingPaths[@]}"; do
36 install -d $out$manifestDir
37 ln -s $out/share/passff-host/passff.json $out$manifestDir/
38 done
39 '';
40
41 meta = with lib; {
42 description = "Host app for the WebExtension PassFF";
43 homepage = "https://github.com/passff/passff-host";
44 license = licenses.gpl2;
45 maintainers = with maintainers; [ nadrieril ];
46 };
47}