2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2020-10-19 23:25:03 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, wrapQtAppsHook
|
2022-11-02 22:02:43 +00:00
|
|
|
, miniupnpc
|
2021-08-05 21:33:18 +00:00
|
|
|
, ffmpeg
|
2021-06-04 09:07:49 +00:00
|
|
|
, enableSwftools ? false
|
2020-10-19 23:25:03 +00:00
|
|
|
, swftools
|
2021-08-05 21:33:18 +00:00
|
|
|
, python3Packages
|
2023-03-15 16:39:30 +00:00
|
|
|
, qtbase
|
|
|
|
, qtcharts
|
2024-05-15 15:35:15 +00:00
|
|
|
, makeDesktopItem
|
|
|
|
, copyDesktopItems
|
2020-10-19 23:25:03 +00:00
|
|
|
}:
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
python3Packages.buildPythonPackage rec {
|
2020-10-19 23:25:03 +00:00
|
|
|
pname = "hydrus";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "572";
|
2020-10-19 23:25:03 +00:00
|
|
|
format = "other";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "hydrusnetwork";
|
|
|
|
repo = "hydrus";
|
2022-04-27 09:35:20 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-mLb4rUsoMDxl7lPrrRJq/bWSqZlgg94efHJzgykZJ/g=";
|
2020-10-19 23:25:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
wrapQtAppsHook
|
2022-03-30 09:31:56 +00:00
|
|
|
python3Packages.mkdocs-material
|
2024-05-15 15:35:15 +00:00
|
|
|
copyDesktopItems
|
2020-10-19 23:25:03 +00:00
|
|
|
];
|
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
buildInputs = [
|
|
|
|
qtbase
|
|
|
|
qtcharts
|
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "hydrus-client";
|
|
|
|
exec = "hydrus-client";
|
|
|
|
desktopName = "Hydrus Client";
|
|
|
|
icon = "hydrus-client";
|
|
|
|
comment = meta.description;
|
|
|
|
terminal = false;
|
|
|
|
type = "Application";
|
|
|
|
categories = [ "FileTools" "Utility" ];
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
propagatedBuildInputs = with python3Packages; [
|
2020-10-19 23:25:03 +00:00
|
|
|
beautifulsoup4
|
2022-03-30 09:31:56 +00:00
|
|
|
cbor2
|
2021-08-05 21:33:18 +00:00
|
|
|
chardet
|
|
|
|
cloudscraper
|
2023-10-09 19:29:22 +00:00
|
|
|
dateparser
|
2020-10-19 23:25:03 +00:00
|
|
|
html5lib
|
|
|
|
lxml
|
2021-08-05 21:33:18 +00:00
|
|
|
lz4
|
2020-10-19 23:25:03 +00:00
|
|
|
numpy
|
|
|
|
opencv4
|
|
|
|
pillow
|
2023-10-09 19:29:22 +00:00
|
|
|
pillow-heif
|
2020-10-19 23:25:03 +00:00
|
|
|
psutil
|
2023-10-09 19:29:22 +00:00
|
|
|
psd-tools
|
2023-03-15 16:39:30 +00:00
|
|
|
pympler
|
2020-10-19 23:25:03 +00:00
|
|
|
pyopenssl
|
2023-03-15 16:39:30 +00:00
|
|
|
pyqt6
|
|
|
|
pyqt6-charts
|
2021-08-05 21:33:18 +00:00
|
|
|
pysocks
|
2022-10-21 18:38:19 +00:00
|
|
|
python-dateutil
|
2022-07-18 16:21:45 +00:00
|
|
|
python3Packages.mpv
|
2020-10-19 23:25:03 +00:00
|
|
|
pyyaml
|
2021-08-05 21:33:18 +00:00
|
|
|
qtpy
|
2020-10-19 23:25:03 +00:00
|
|
|
requests
|
|
|
|
send2trash
|
|
|
|
service-identity
|
|
|
|
twisted
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = with python3Packages; [
|
2022-10-21 18:38:19 +00:00
|
|
|
nose
|
|
|
|
mock
|
|
|
|
httmock
|
|
|
|
];
|
2020-10-19 23:25:03 +00:00
|
|
|
|
|
|
|
# most tests are failing, presumably because we are not using test.py
|
|
|
|
checkPhase = ''
|
2023-11-16 04:20:00 +00:00
|
|
|
runHook preCheck
|
|
|
|
|
2020-10-19 23:25:03 +00:00
|
|
|
nosetests $src/hydrus/test \
|
2023-11-16 04:20:00 +00:00
|
|
|
-e TestClientAPI \
|
|
|
|
-e TestClientConstants \
|
|
|
|
-e TestClientDaemons \
|
|
|
|
-e TestClientData \
|
|
|
|
-e TestClientDB \
|
|
|
|
-e TestClientDBDuplicates \
|
|
|
|
-e TestClientDBTags \
|
|
|
|
-e TestClientImageHandling \
|
|
|
|
-e TestClientImportOptions \
|
|
|
|
-e TestClientListBoxes \
|
|
|
|
-e TestClientMigration \
|
|
|
|
-e TestClientNetworking \
|
|
|
|
-e TestClientTags \
|
|
|
|
-e TestClientThreading \
|
|
|
|
-e TestDialogs \
|
|
|
|
-e TestFunctions \
|
|
|
|
-e TestHydrusNetwork \
|
|
|
|
-e TestHydrusNATPunch \
|
|
|
|
-e TestHydrusSerialisable \
|
|
|
|
-e TestHydrusServer \
|
|
|
|
-e TestHydrusSessions \
|
|
|
|
-e TestServer \
|
|
|
|
-e TestClientMetadataMigration \
|
|
|
|
-e TestClientFileStorage \
|
|
|
|
|
|
|
|
runHook postCheck
|
2020-10-19 23:25:03 +00:00
|
|
|
'';
|
|
|
|
|
2021-04-13 19:44:15 +00:00
|
|
|
outputs = [ "out" "doc" ];
|
2020-10-19 23:25:03 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2024-05-15 15:35:15 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2020-10-19 23:25:03 +00:00
|
|
|
# Move the hydrus module and related directories
|
2021-08-05 21:33:18 +00:00
|
|
|
mkdir -p $out/${python3Packages.python.sitePackages}
|
2024-01-02 11:29:13 +00:00
|
|
|
mv {hydrus,static,db} $out/${python3Packages.python.sitePackages}
|
2023-10-09 19:29:22 +00:00
|
|
|
# Fix random files being marked with execute permissions
|
|
|
|
chmod -x $out/${python3Packages.python.sitePackages}/static/*.{png,svg,ico}
|
|
|
|
# Build docs
|
2022-03-30 09:31:56 +00:00
|
|
|
mkdocs build -d help
|
2023-11-16 04:20:00 +00:00
|
|
|
mkdir -p $doc/share/doc
|
|
|
|
mv help $doc/share/doc/hydrus
|
2020-10-19 23:25:03 +00:00
|
|
|
|
|
|
|
# install the hydrus binaries
|
|
|
|
mkdir -p $out/bin
|
2023-10-09 19:29:22 +00:00
|
|
|
install -m0755 hydrus_server.py $out/bin/hydrus-server
|
|
|
|
install -m0755 hydrus_client.py $out/bin/hydrus-client
|
2024-05-15 15:35:15 +00:00
|
|
|
|
|
|
|
# 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"
|
2021-08-05 21:33:18 +00:00
|
|
|
'' + 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
|
2024-05-15 15:35:15 +00:00
|
|
|
'' + ''
|
|
|
|
runHook postInstall
|
2020-10-19 23:25:03 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
dontWrapQtApps = true;
|
|
|
|
preFixup = ''
|
|
|
|
makeWrapperArgs+=("''${qtWrapperArgs[@]}")
|
2022-11-02 22:02:43 +00:00
|
|
|
makeWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ ffmpeg miniupnpc ]})
|
2020-10-19 23:25:03 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-10-19 23:25:03 +00:00
|
|
|
description = "Danbooru-like image tagging and searching system for the desktop";
|
|
|
|
license = licenses.wtfpl;
|
|
|
|
homepage = "https://hydrusnetwork.github.io/hydrus/";
|
2021-08-05 21:33:18 +00:00
|
|
|
maintainers = with maintainers; [ dandellion evanjs ];
|
2020-10-19 23:25:03 +00:00
|
|
|
};
|
|
|
|
}
|