nixpkgs/pkgs/applications/graphics/hydrus/default.nix

115 lines
2.8 KiB
Nix
Raw Normal View History

{ lib
2020-10-18 18:48:54 +00:00
, fetchFromGitHub
, wrapQtAppsHook
, miniupnpc_2
, ffmpeg
2021-06-01 16:42:04 +00:00
, enableSwftools ? false
2020-10-18 18:48:54 +00:00
, swftools
, python3Packages
2020-10-18 18:48:54 +00:00
}:
python3Packages.buildPythonPackage rec {
2020-10-18 18:48:54 +00:00
pname = "hydrus";
2021-11-11 03:04:30 +00:00
version = "461";
2020-10-18 18:48:54 +00:00
format = "other";
src = fetchFromGitHub {
owner = "hydrusnetwork";
repo = "hydrus";
2021-03-05 06:35:58 +00:00
rev = "v${version}";
2021-11-11 03:04:30 +00:00
sha256 = "sha256-fVqMSzQ4VhiRh6gDFApln1jioIDs80ceyV+ClNRhjKA=";
2020-10-18 18:48:54 +00:00
};
nativeBuildInputs = [
wrapQtAppsHook
];
propagatedBuildInputs = with python3Packages; [
2020-10-18 18:48:54 +00:00
beautifulsoup4
chardet
cloudscraper
2020-10-18 18:48:54 +00:00
html5lib
lxml
lz4
nose
2020-10-18 18:48:54 +00:00
numpy
opencv4
pillow
psutil
pylzma
2020-10-18 18:48:54 +00:00
pyopenssl
pyside2
pysocks
pythonPackages.mpv
2020-10-18 18:48:54 +00:00
pyyaml
qtpy
2020-10-18 18:48:54 +00:00
requests
send2trash
service-identity
six
2020-10-18 18:48:54 +00:00
twisted
];
checkInputs = with python3Packages; [ nose mock httmock ];
2020-10-18 18:48:54 +00:00
# most tests are failing, presumably because we are not using test.py
checkPhase = ''
nosetests $src/hydrus/test \
-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 \
2021-10-01 21:19:51 +00:00
-e TestHydrusNetwork \
2020-10-18 18:48:54 +00:00
-e TestHydrusNATPunch \
-e TestHydrusSerialisable \
-e TestHydrusServer \
-e TestHydrusSessions \
-e TestServer \
'';
2021-04-12 15:36:15 +00:00
outputs = [ "out" "doc" ];
2020-10-18 18:48:54 +00:00
installPhase = ''
# Move the hydrus module and related directories
mkdir -p $out/${python3Packages.python.sitePackages}
mv {hydrus,static} $out/${python3Packages.python.sitePackages}
2020-10-18 18:48:54 +00:00
mv help $out/doc/
# install the hydrus binaries
mkdir -p $out/bin
install -m0755 server.py $out/bin/hydrus-server
install -m0755 client.py $out/bin/hydrus-client
'' + 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
2020-10-18 18:48:54 +00:00
'';
dontWrapQtApps = true;
preFixup = ''
makeWrapperArgs+=("''${qtWrapperArgs[@]}")
makeWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ ffmpeg miniupnpc_2 ]})
2020-10-18 18:48:54 +00:00
'';
meta = with lib; {
2020-10-18 18:48:54 +00:00
description = "Danbooru-like image tagging and searching system for the desktop";
license = licenses.wtfpl;
homepage = "https://hydrusnetwork.github.io/hydrus/";
2021-07-23 16:44:56 +00:00
maintainers = with maintainers; [ dandellion evanjs ];
2020-10-18 18:48:54 +00:00
};
}