about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/networking/onionshare/default.nix
blob: 77d08692f625a803ceb454419693ca80ac3c01fc (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
{
  lib,
  buildPythonApplication,
  stdenv,
  substituteAll,
  fetchFromGitHub,
  isPy3k,
  flask,
  flask-httpauth,
  stem,
  pyqt5,
  pycrypto,
  pysocks,
  pytest,
  qt5,
  requests,
  tor,
  obfs4,
}:

let
  version = "2.2";
  src = fetchFromGitHub {
    owner = "micahflee";
    repo = "onionshare";
    rev = "v${version}";
    sha256 = "0m8ygxcyp3nfzzhxs2dfnpqwh1vx0aws44lszpnnczz4fks3a5j4";
  };
  meta = with lib; {
    description = "Securely and anonymously send and receive files";
    longDescription = ''
    OnionShare is an open source tool for securely and anonymously sending
    and receiving files using Tor onion services. It works by starting a web
    server directly on your computer and making it accessible as an
    unguessable Tor web address that others can load in Tor Browser to
    download files from you, or upload files to you. It doesn't require
    setting up a separate server, using a third party file-sharing service,
    or even logging into an account.

    Unlike services like email, Google Drive, DropBox, WeTransfer, or nearly
    any other way people typically send files to each other, when you use
    OnionShare you don't give any companies access to the files that you're
    sharing. So long as you share the unguessable web address in a secure way
    (like pasting it in an encrypted messaging app), no one but you and the
    person you're sharing with can access the files.
    '';

    homepage = "https://onionshare.org/";

    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ lourkeur ];
  };

  common = buildPythonApplication {
    pname = "onionshare-common";
    inherit version meta src;

    disable = !isPy3k;
    propagatedBuildInputs = [
      flask
      flask-httpauth
      stem
      pyqt5
      pycrypto
      pysocks
      requests
    ];
    buildInputs = [
      tor
      obfs4
    ];

    patches = [
      (substituteAll {
        src = ./fix-paths.patch;
        inherit tor obfs4;
        inherit (tor) geoip;
      })
    ];
    postPatch = "substituteInPlace onionshare/common.py --subst-var-by common $out";

    doCheck = false;
  };
in
{
  onionshare = stdenv.mkDerivation {
    pname = "onionshare";
    inherit version meta;

    dontUnpack = true;

    inherit common;
    installPhase = ''
      mkdir -p $out/bin
      cp $common/bin/onionshare -t $out/bin
    '';
  };
  onionshare-gui = stdenv.mkDerivation {
    pname = "onionshare-gui";
    inherit version meta;

    nativeBuildInputs = [ qt5.wrapQtAppsHook ];

    dontUnpack = true;

    inherit common;
    installPhase = ''
      mkdir -p $out/bin
      cp $common/bin/onionshare-gui -t $out/bin
      wrapQtApp $out/bin/onionshare-gui
    '';
  };
}