summary refs log tree commit diff
path: root/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix/default.nix
blob: ff6a7d947411930f1d7d9a226c7a3c3275407423 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{ buildPythonPackage, stdenv, python, fetchFromGitHub,
  pyopenssl, webcolors, future, atomicwrites,
  attrs, Logbook, pygments, cachetools, matrix-nio }:

let
  matrixUploadPython = python.withPackages (ps: with ps; [
    magic
  ]);
in buildPythonPackage {
  pname = "weechat-matrix";
  version = "unstable-2019-11-10";

  src = fetchFromGitHub {
    owner = "poljar";
    repo = "weechat-matrix";
    rev = "69ad2a9c03d516c212d3d0700dbb2bfe654f6365";
    sha256 = "1mfbkag5np2lgv6f31nyfnvavyh67jrrx6gxhzb8m99dd43lgs8c";
  };

  propagatedBuildInputs = [
    pyopenssl
    webcolors
    future
    atomicwrites
    attrs
    Logbook
    pygments
    cachetools
    matrix-nio
  ];

  passthru.scripts = [ "matrix.py" ];

  dontBuild = true;
  doCheck = false;

  installPhase = ''
    mkdir -p $out/share $out/bin
    cp $src/main.py $out/share/matrix.py

    cp $src/contrib/matrix_upload $out/bin/
    substituteInPlace $out/bin/matrix_upload \
      --replace '/usr/bin/env -S python3 -u' '${matrixUploadPython}/bin/python -u' 
  
    mkdir -p $out/${python.sitePackages}
    cp -r $src/matrix $out/${python.sitePackages}/matrix
  '';

  dontPatchShebangs = true;

  meta = with stdenv.lib; {
    description = "A Python plugin for Weechat that lets Weechat communicate over the Matrix protocol";
    homepage = "https://github.com/poljar/weechat-matrix";
    license = licenses.isc;
    platforms = platforms.linux;
    maintainers = [ maintainers.tilpner ];
  };
}