@@ -0,0 +1,44 @@
1+{ stdenv
2+, fetchFromGitHub
3+, python3
4+}:
5+
6+stdenv.mkDerivation rec {
7+ pname = "tridactyl-native";
8+ # this is actually the version of tridactyl itself; the native messenger will
9+ # probably not change with every tridactyl version
10+ version = "1.14.9";
11+
12+ src = fetchFromGitHub {
13+ owner = "tridactyl";
14+ repo = "tridactyl";
15+ rev = version;
16+ sha256 = "0d80c744qfv6jd03cmdp3p71xaj8lq8jzsa2m24jxv9q4ks2dcmj";
17+ };
18+ sourceRoot = "source/native";
19+
20+ nativeBuildInputs = [
21+ python3.pkgs.wrapPython
22+ ];
23+
24+ buildPhase = ''
25+ sed -i -e "s|REPLACE_ME_WITH_SED|$out/share/tridactyl/native_main.py|" "tridactyl.json"
26+ '';
27+
28+ installPhase = ''
29+ mkdir -p "$out/lib/mozilla/native-messaging-hosts"
30+ cp tridactyl.json "$out/lib/mozilla/native-messaging-hosts/"
31+
32+ mkdir -p "$out/share/tridactyl"
33+ cp native_main.py "$out/share/tridactyl"
34+ wrapPythonProgramsIn "$out/share/tridactyl"
35+ '';
36+
37+ meta = with stdenv.lib; {
38+ description = "Tridactyl native messaging host application";
39+ homepage = https://github.com/tridactyl/tridactyl;
40+ license = licenses.asl20;
41+ platforms = platforms.all;
42+ maintainers = with maintainers; [ timokau ];
43+ };
44+}