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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
{ lib
, stdenv
, buildPythonApplication
, cepa
, colorama
, fetchFromGitHub
, flask
, flask-compress
, flask-httpauth
, flask-socketio
, gevent-socketio
, gevent-websocket
, obfs4
, psutil
, pycrypto
, pynacl
, pyqt5
, pyside6
, pysocks
, pytestCheckHook
, qrcode
, qt5
, requests
, snowflake
, substituteAll
, tor
, unidecode
, waitress
}:
let
version = "2.6.1";
src = fetchFromGitHub {
owner = "onionshare";
repo = "onionshare";
rev = "v${version}";
sha256 = "sha256-LR3Ao4Q8kEDwrFV+gYdMSEeYF4hDtEa1rJgvRRrJMwc=";
};
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; [ bbjubjub ];
};
# TODO: package meek https://support.torproject.org/glossary/meek/
meek = "/meek-not-available";
in
rec {
onionshare = buildPythonApplication {
pname = "onionshare-cli";
inherit version;
src = "${src}/cli";
patches = [
# hardcode store paths of dependencies
(substituteAll {
src = ./fix-paths.patch;
inherit tor meek obfs4 snowflake;
inherit (tor) geoip;
})
];
propagatedBuildInputs = [
cepa
colorama
flask
flask-compress
flask-httpauth
flask-socketio
gevent-socketio
gevent-websocket
psutil
pycrypto
pynacl
pyside6
qrcode
requests
unidecode
waitress
];
buildInputs = [
obfs4
tor
];
nativeCheckInputs = [
pytestCheckHook
];
preCheck = ''
# Tests use the home directory
export HOME="$(mktemp -d)"
'';
disabledTests = lib.optionals stdenv.isLinux [
"test_get_tor_paths_linux" # expects /usr instead of /nix/store
] ++ lib.optionals stdenv.isDarwin [
# requires meek-client which is not packaged
"test_get_tor_paths_darwin"
# on darwin (and only on darwin) onionshare attempts to discover
# user's *real* homedir via /etc/passwd, making it more painful
# to fake
"test_receive_mode_webhook"
];
meta = meta // {
mainProgram = "onionshare-cli";
};
};
onionshare-gui = buildPythonApplication {
pname = "onionshare";
inherit version;
src = "${src}/desktop";
patches = [
# hardcode store paths of dependencies
(substituteAll {
src = ./fix-paths-gui.patch;
inherit tor meek obfs4 snowflake;
inherit (tor) geoip;
})
];
propagatedBuildInputs = [
onionshare
psutil
pyqt5
pyside6
pysocks
qrcode
];
nativeBuildInputs = [ qt5.wrapQtAppsHook ];
postInstall = ''
mkdir -p $out/share/{appdata,applications,icons}
cp $src/org.onionshare.OnionShare.desktop $out/share/applications
cp $src/org.onionshare.OnionShare.svg $out/share/icons
cp $src/org.onionshare.OnionShare.appdata.xml $out/share/appdata
'';
dontWrapQtApps = true;
preFixup = ''
makeWrapperArgs+=("''${qtWrapperArgs[@]}")
'';
doCheck = false;
pythonImportsCheck = [ "onionshare" ];
meta = meta // {
mainProgram = "onionshare";
};
};
}
|