nixpkgs/pkgs/applications/graphics/hydrus/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

113 lines
2.5 KiB
Nix

{ lib, stdenv
, fetchFromGitHub
, lzma
, qt5
, wrapQtAppsHook
, miniupnpc_2
, swftools
, pythonPackages
}:
pythonPackages.buildPythonPackage {
pname = "hydrus";
version = "420";
format = "other";
src = fetchFromGitHub {
owner = "hydrusnetwork";
repo = "hydrus";
rev = "067c4862a0ed8dd9264b464c69975b520139809f";
sha256 = "12x0rv2yxsczdaxvpb5ggf4jwzjd1vd7ml0r61s4342zwvjrhji9";
};
nativeBuildInputs = [
wrapQtAppsHook
];
propagatedBuildInputs = with pythonPackages; [
beautifulsoup4
html5lib
lxml
numpy
opencv4
pillow
psutil
pyopenssl
pyyaml
requests
send2trash
service-identity
twisted
lz4
lzma
pysocks
matplotlib
qtpy
pyside2
];
checkInputs = with pythonPackages; [ nose httmock ];
# 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 \
-e TestHydrusNATPunch \
-e TestHydrusSerialisable \
-e TestHydrusServer \
-e TestHydrusSessions \
-e TestServer \
'';
extraOutputsToLink = [ "doc" ];
postPatch = ''
sed 's;os\.path\.join(\sHC\.BIN_DIR,.*;"${miniupnpc_2}/bin/upnpc";' \
-i ./hydrus/core/HydrusNATPunch.py
sed 's;os\.path\.join(\sHC\.BIN_DIR,.*;"${swftools}/bin/swfrender";' \
-i ./hydrus/core/HydrusFlashHandling.py
'';
#doCheck = true;
installPhase = ''
# Move the hydrus module and related directories
mkdir -p $out/${pythonPackages.python.sitePackages}
mv {hydrus,static} $out/${pythonPackages.python.sitePackages}
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
'';
dontWrapQtApps = true;
preFixup = ''
makeWrapperArgs+=("''${qtWrapperArgs[@]}")
'';
meta = with lib; {
description = "Danbooru-like image tagging and searching system for the desktop";
license = licenses.wtfpl;
homepage = "https://hydrusnetwork.github.io/hydrus/";
maintainers = [ maintainers.evanjs ];
};
}