-
-
Notifications
You must be signed in to change notification settings - Fork 19.5k
Expand file tree
/
Copy pathpackage.nix
More file actions
171 lines (152 loc) · 3.79 KB
/
Copy pathpackage.nix
File metadata and controls
171 lines (152 loc) · 3.79 KB
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
{
lib,
stdenv,
python3Packages,
fetchFromGitHub,
qt6,
copyDesktopItems,
makeDesktopItem,
writableTmpDirAsHomeHook,
swftools,
ffmpeg,
miniupnpc,
enableSwftools ? false,
}:
python3Packages.buildPythonApplication (finalAttrs: {
pname = "hydrus";
version = "676";
pyproject = false;
src = fetchFromGitHub {
owner = "hydrusnetwork";
repo = "hydrus";
tag = "v${finalAttrs.version}";
hash = "sha256-/HFnWFkDAqKDFqXeuzHkx22KoRCqRjc2bzx/Tlsta18=";
};
nativeBuildInputs = [
qt6.wrapQtAppsHook
python3Packages.mkdocs-material
copyDesktopItems
];
buildInputs = [
qt6.qtbase
qt6.qtcharts
];
desktopItems = [
(makeDesktopItem {
name = "hydrus-client";
exec = "hydrus-client";
desktopName = "Hydrus Client";
icon = "hydrus-client";
comment = finalAttrs.meta.description;
terminal = false;
type = "Application";
categories = [
"FileTools"
"Utility"
];
})
];
dependencies = with python3Packages; [
beautifulsoup4
cbor2
chardet
cloudscraper
dateparser
html5lib
lxml
lz4
numpy
opencv4
olefile
pillow
pillow-heif
psutil
psd-tools
pympler
pyopenssl
pyqt6
pyqt6-charts
pysocks
python-dateutil
python3Packages.mpv
pyyaml
qtpy
requests
show-in-file-manager
send2trash
service-identity
twisted
];
nativeCheckInputs =
(with python3Packages; [
mock
httmock
])
++ [
writableTmpDirAsHomeHook
];
outputs = [
"out"
"doc"
];
installPhase = ''
runHook preInstall
# Move the hydrus module and related directories
mkdir -p $out/${python3Packages.python.sitePackages}
mv hydrus static $out/${python3Packages.python.sitePackages}
# Fix random files being marked with execute permissions
chmod -x $out/${python3Packages.python.sitePackages}/static/*.{png,svg,ico}
# Build docs
mkdocs build -d help
mkdir -p $doc/share/doc
mv help $doc/share/doc/hydrus
# install the hydrus binaries
mkdir -p $out/bin
install -m0755 hydrus_server.py $out/bin/hydrus-server
install -m0755 hydrus_client.py $out/bin/hydrus-client
install -m0755 hydrus_test.py $out/bin/hydrus-test
# desktop item
mkdir -p "$out/share/icons/hicolor/scalable/apps"
ln -s "$doc/share/doc/hydrus/assets/hydrus-white.svg" "$out/share/icons/hicolor/scalable/apps/hydrus-client.svg"
''
+ lib.optionalString enableSwftools ''
mkdir -p $out/${python3Packages.python.sitePackages}/bin
# swfrender seems to have to be called sfwrender_linux
# not sure if it can be loaded through PATH, but this is simpler
# $out/python3Packages.python.sitePackages/bin is correct NOT .../hydrus/bin
ln -s ${swftools}/bin/swfrender $out/${python3Packages.python.sitePackages}/bin/swfrender_linux
''
+ ''
runHook postInstall
'';
checkPhase = ''
runHook preCheck
export QT_QPA_PLATFORM=offscreen
$out/bin/hydrus-test
runHook postCheck
'';
# Tests crash even with __darwinAllowLocalNetworking enabled
# hydrus.core.HydrusExceptions.DataMissing: That service was not found!
doCheck = !stdenv.hostPlatform.isDarwin;
dontWrapQtApps = true;
preFixup = ''
makeWrapperArgs+=("''${qtWrapperArgs[@]}")
makeWrapperArgs+=(--prefix PATH : ${
lib.makeBinPath [
ffmpeg
miniupnpc
]
})
'';
meta = {
description = "Danbooru-like image tagging and searching system for the desktop";
license = lib.licenses.wtfpl;
homepage = "https://hydrusnetwork.github.io/hydrus/";
changelog = "https://github.com/hydrusnetwork/hydrus/releases/tag/${finalAttrs.src.tag}";
maintainers = with lib.maintainers; [
dandellion
evanjs
KunyaKud
];
};
})