-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtg-archive.nix
185 lines (170 loc) · 4.65 KB
/
tg-archive.nix
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
176
177
178
179
180
181
182
183
184
185
/*
nix-build -E 'with import <nixpkgs> { }; callPackage ./tg-archive.nix { }'
./result/bin/tg-archive
*/
{ lib
, python3Packages
, fetchFromGitHub
, fetchpatch
, gtk3
, wrapGAppsHook
, gdk-pixbuf
, gobject-introspection
, gettext
, gst_all_1
, gspell
, isocodes
, intltool
, rustPlatform
, file # libmagic
}:
let
fetchPypi = python3Packages.fetchPypi;
cryptg = python3Packages.buildPythonPackage rec {
pname = "cryptg";
#version = "0.3.1"; # ERROR: The Cargo.lock file doesn't exist
version = "0.3.1.unstable-2022-05-10";
src = fetchFromGitHub {
owner = "cher-nov";
repo = "cryptg";
rev = "e5a86364e9fd77cadbea94d48e28fded0f2a6e1a";
sha256 = "sha256-0v+GmwjWierq7a4c548hFLuq1dSDo8PvDlii5HK7MWk=";
};
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
#inherit src sourceRoot;
name = "${pname}-${version}";
sha256 = "sha256-StTCVh0NBEE6J7fV+sCq2eOmhuRDgyS711qZDwduWm0=";
};
#sourceRoot = "source/bindings/python";
nativeBuildInputs = /*[ python3Packages.setuptools-rust ] ++*/ (with rustPlatform; [
cargoSetupHook
rust.cargo
rust.rustc
]);
buildInputs = (with python3Packages; [
#importlib-resources
setuptools-rust
]);
propagatedBuildInputs = (with python3Packages; [
#jsonschema
#h_matchers
]);
checkInputs = with python3Packages; [
];
meta = with lib; {
homepage = "https://github.com/cher-nov/cryptg";
description = "Cryptographic utilities for Telegram";
license = licenses.cc0;
};
};
python-magic = python3Packages.buildPythonPackage rec {
pname = "python-magic";
version = "0.4.26";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-gmLBMAH5BK1bck04teW18X7ARQriSd7zmKYuTjMQilA=";
};
buildInputs = (with python3Packages; [
#importlib-resources
]);
# https://github.com/ahupp/python-magic/blob/master/magic/loader.py#L34
postPatch = ''
sed -i "s|yield 'libmagic.so.1'|yield '${file}/lib/libmagic.so.1'|" magic/loader.py
'';
propagatedBuildInputs = (with python3Packages; [
#jsonschema
#h_matchers
file # libmagic
]);
checkInputs = with python3Packages; [
file # libmagic
];
meta = with lib; {
homepage = "http://github.com/ahupp/python-magic";
description = "File type identification using libmagic";
license = licenses.mit;
};
};
in
python3Packages.buildPythonApplication rec {
pname = "tg-archive";
version = "unstable-2022-06-14";
src = fetchFromGitHub {
owner = "knadh";
repo = "tg-archive";
rev = "c410b07859af4e3254bdd5ac65c8200251682202";
sha256 = "sha256-eSilX35sUGEbj/6FAvYfupq2wolhmNMXBlQRsPy0jvg=";
};
#src = ./src/tg-archive;
patches = [
(fetchpatch {
url = "https://github.com/knadh/tg-archive/pull/69.diff";
sha256 = "sha256-XnN0QdCgEazjo62AyWrLpccTgM14oSoLAgWBZP3KIFE=";
})
];
propagatedBuildInputs = with python3Packages; [
#python-telegram-bot # gi
(telethon.overridePythonAttrs (old: {
# "Closing current connection to begin reconnect" can hang forever
# https://github.com/LonamiWebs/Telethon/issues/3917
src = fetchFromGitHub {
owner = "LonamiWebs";
repo = "Telethon";
rev = "346a3f0ef5652111c7bc167d4ccef5eb851c7901";
sha256 = "sha256-CACC/D4pcXog4cXX07zyAXCqJql9FN8f/FDOGYXEd/U=";
};
}))
jinja2
pyyaml # PyYAML
cryptg
pillow # Pillow
feedgen
python-magic
#pkg_resources
setuptools # pkg_resources
];
buildInputs = [
/*
gtk3 # Pango
gobject-introspection # Pango
# optional
gspell
isocodes
python3Packages.chardet
#python3Packages.distutils_extra
# optional: internal video player
gst_all_1.gstreamer
#gst_all_1.gstreamer.dev # gst-inspect
gst_all_1.gst-plugins-base # playbin
(gst_all_1.gst-plugins-good.override { gtkSupport = true; }) # gtksink
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-ugly
gst_all_1.gst-libav
*/
];
nativeBuildInputs = [
/*
gettext # msgfmt
wrapGAppsHook
gobject-introspection
#intltool
*/
];
/*
postInstall = ''
cat >>$out/lib/python3.9/site-packages/aeidon/paths.py <<EOF
DATA_DIR = '$out/share/gaupol'
LOCALE_DIR = '$out/share/locale'
EOF
'';
*/
#doCheck = false; # tests are failing: Unable to init server: Could not connect: Connection refused
meta = with lib; {
homepage = "https://github.com/knadh/tg-archive";
description = "export Telegram group chats into static websites to preserve chat history like mailing list archives";
#maintainers = [];
license = licenses.mit;
#platforms = platforms.linux;
};
}