From a775105c5fa4e0a073569789ea295aac3fbb6a8e Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Thu, 6 Mar 2025 10:24:36 +0100 Subject: [PATCH] hydrus: format --- pkgs/applications/graphics/hydrus/default.nix | 109 ++++++++++-------- 1 file changed, 63 insertions(+), 46 deletions(-) diff --git a/pkgs/applications/graphics/hydrus/default.nix b/pkgs/applications/graphics/hydrus/default.nix index b9988cb4b0b5..51bcfadb4151 100644 --- a/pkgs/applications/graphics/hydrus/default.nix +++ b/pkgs/applications/graphics/hydrus/default.nix @@ -1,16 +1,17 @@ -{ lib -, fetchFromGitHub -, wrapQtAppsHook -, miniupnpc -, ffmpeg -, enableSwftools ? false -, swftools -, python3Packages -, pythonOlder -, qtbase -, qtcharts -, makeDesktopItem -, copyDesktopItems +{ + lib, + fetchFromGitHub, + wrapQtAppsHook, + miniupnpc, + ffmpeg, + enableSwftools ? false, + swftools, + python3Packages, + pythonOlder, + qtbase, + qtcharts, + makeDesktopItem, + copyDesktopItems, }: python3Packages.buildPythonPackage rec { @@ -45,11 +46,13 @@ python3Packages.buildPythonPackage rec { comment = meta.description; terminal = false; type = "Application"; - categories = [ "FileTools" "Utility" ]; + categories = [ + "FileTools" + "Utility" + ]; }) ]; - propagatedBuildInputs = with python3Packages; [ beautifulsoup4 cbor2 @@ -87,39 +90,45 @@ python3Packages.buildPythonPackage rec { httmock ]; - outputs = [ "out" "doc" ]; + outputs = [ + "out" + "doc" + ]; - installPhase = '' - runHook preInstall + installPhase = + '' + runHook preInstall - # Move the hydrus module and related directories - mkdir -p $out/${python3Packages.python.sitePackages} - mv {hydrus,static,db} $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 + # Move the hydrus module and related directories + mkdir -p $out/${python3Packages.python.sitePackages} + mv {hydrus,static,db} $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 + # 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 - ''; + # 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 @@ -134,13 +143,21 @@ python3Packages.buildPythonPackage rec { dontWrapQtApps = true; preFixup = '' makeWrapperArgs+=("''${qtWrapperArgs[@]}") - makeWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ ffmpeg miniupnpc ]}) + makeWrapperArgs+=(--prefix PATH : ${ + lib.makeBinPath [ + ffmpeg + miniupnpc + ] + }) ''; meta = with lib; { description = "Danbooru-like image tagging and searching system for the desktop"; license = licenses.wtfpl; homepage = "https://hydrusnetwork.github.io/hydrus/"; - maintainers = with maintainers; [ dandellion evanjs ]; + maintainers = with maintainers; [ + dandellion + evanjs + ]; }; }