diff --git a/pkgs/applications/blockchains/bitcoin/default.nix b/pkgs/applications/blockchains/bitcoin/default.nix index 1bcbab13b063..f5c3683dcbc7 100644 --- a/pkgs/applications/blockchains/bitcoin/default.nix +++ b/pkgs/applications/blockchains/bitcoin/default.nix @@ -2,7 +2,6 @@ lib, stdenv, fetchurl, - fetchpatch2, autoreconfHook, pkg-config, installShellFiles, @@ -21,6 +20,7 @@ qtbase ? null, qttools ? null, python3, + versionCheckHook, nixosTests, withGui, withWallet ? true, @@ -33,13 +33,13 @@ let sha256 = "0cpna0nxcd1dw3nnzli36nf9zj28d2g9jf5y0zl9j18lvanvniha"; }; in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = if withGui then "bitcoin" else "bitcoind"; version = "28.1"; src = fetchurl { urls = [ - "https://bitcoincore.org/bin/bitcoin-core-${version}/bitcoin-${version}.tar.gz" + "https://bitcoincore.org/bin/bitcoin-core-${finalAttrs.version}/bitcoin-${finalAttrs.version}.tar.gz" ]; # hash retrieved from signed SHA256SUMS sha256 = "c5ae2dd041c7f9d9b7c722490ba5a9d624f7e9a089c67090615e1ba4ad0883ba"; @@ -100,7 +100,7 @@ stdenv.mkDerivation rec { "--with-boost-libdir=${boost.out}/lib" "--disable-bench" ] - ++ lib.optionals (!doCheck) [ + ++ lib.optionals (!finalAttrs.doCheck) [ "--disable-tests" "--disable-gui-tests" ] @@ -124,11 +124,20 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; + __darwinAllowLocalNetworking = true; + + nativeInstallCheckInputs = [ + versionCheckHook + ]; + versionCheckProgram = "${placeholder "out"}/bin/bitcoin-cli"; + versionCheckProgramArg = [ "--version" ]; + doInstallCheck = true; + passthru.tests = { smoke-test = nixosTests.bitcoind; }; - meta = with lib; { + meta = { description = "Peer-to-peer electronic cash system"; longDescription = '' Bitcoin is a free open source peer-to-peer electronic cash system that is @@ -137,13 +146,13 @@ stdenv.mkDerivation rec { with each other, with the help of a P2P network to check for double-spending. ''; homepage = "https://bitcoin.org/en/"; - downloadPage = "https://bitcoincore.org/bin/bitcoin-core-${version}/"; - changelog = "https://bitcoincore.org/en/releases/${version}/"; - maintainers = with maintainers; [ + downloadPage = "https://bitcoincore.org/bin/bitcoin-core-${finalAttrs.version}/"; + changelog = "https://bitcoincore.org/en/releases/${finalAttrs.version}/"; + maintainers = with lib.maintainers; [ prusnak roconnor ]; - license = licenses.mit; - platforms = platforms.unix; + license = lib.licenses.mit; + platforms = lib.platforms.unix; }; -} +}) diff --git a/pkgs/applications/graphics/hydrus/default.nix b/pkgs/applications/graphics/hydrus/default.nix deleted file mode 100644 index b9988cb4b0b5..000000000000 --- a/pkgs/applications/graphics/hydrus/default.nix +++ /dev/null @@ -1,146 +0,0 @@ -{ lib -, fetchFromGitHub -, wrapQtAppsHook -, miniupnpc -, ffmpeg -, enableSwftools ? false -, swftools -, python3Packages -, pythonOlder -, qtbase -, qtcharts -, makeDesktopItem -, copyDesktopItems -}: - -python3Packages.buildPythonPackage rec { - pname = "hydrus"; - version = "609"; - format = "other"; - - src = fetchFromGitHub { - owner = "hydrusnetwork"; - repo = "hydrus"; - tag = "v${version}"; - hash = "sha256-yHRYGZ38H3nlOlo3NrSqG+2Z3kUiKMfHpMFvAM+T80U="; - }; - - nativeBuildInputs = [ - wrapQtAppsHook - python3Packages.mkdocs-material - copyDesktopItems - ]; - - buildInputs = [ - qtbase - qtcharts - ]; - - desktopItems = [ - (makeDesktopItem { - name = "hydrus-client"; - exec = "hydrus-client"; - desktopName = "Hydrus Client"; - icon = "hydrus-client"; - comment = meta.description; - terminal = false; - type = "Application"; - categories = [ "FileTools" "Utility" ]; - }) - ]; - - - propagatedBuildInputs = 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 - ]; - - outputs = [ "out" "doc" ]; - - 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 - - # 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 - export HOME=$(mktemp -d) - $out/bin/hydrus-test - - runHook postCheck - ''; - - dontWrapQtApps = true; - preFixup = '' - makeWrapperArgs+=("''${qtWrapperArgs[@]}") - 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 ]; - }; -} diff --git a/pkgs/by-name/hy/hydrus/package.nix b/pkgs/by-name/hy/hydrus/package.nix new file mode 100644 index 000000000000..2aa59e74eb9a --- /dev/null +++ b/pkgs/by-name/hy/hydrus/package.nix @@ -0,0 +1,171 @@ +{ + lib, + stdenv, + python3Packages, + fetchFromGitHub, + qt6, + copyDesktopItems, + makeDesktopItem, + writableTmpDirAsHomeHook, + swftools, + ffmpeg, + miniupnpc, + + enableSwftools ? false, +}: + +python3Packages.buildPythonApplication rec { + pname = "hydrus"; + version = "612"; + format = "other"; + + src = fetchFromGitHub { + owner = "hydrusnetwork"; + repo = "hydrus"; + tag = "v${version}"; + hash = "sha256-zRaabW1QwNNgA3F84CFSDbxyALV74T3t8u8WdL8GwG0="; + }; + + 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 = 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,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 + + # 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/v${version}"; + maintainers = with lib.maintainers; [ + dandellion + evanjs + ]; + }; +} diff --git a/pkgs/by-name/mi/miniupnpc/package.nix b/pkgs/by-name/mi/miniupnpc/package.nix index b8b2fc0234e3..2078657acda4 100644 --- a/pkgs/by-name/mi/miniupnpc/package.nix +++ b/pkgs/by-name/mi/miniupnpc/package.nix @@ -3,6 +3,7 @@ stdenv, fetchFromGitHub, cmake, + versionCheckHook, nixosTests, }: @@ -13,7 +14,7 @@ stdenv.mkDerivation rec { src = fetchFromGitHub { owner = "miniupnp"; repo = "miniupnp"; - rev = "miniupnpc_${lib.replaceStrings [ "." ] [ "_" ] version}"; + tag = "miniupnpc_${lib.replaceStrings [ "." ] [ "_" ] version}"; hash = "sha256-Fjd4JPk6Uc7cPPQu9NiBv82XArd11TW+7sTL3wC9/+s="; }; @@ -26,6 +27,12 @@ stdenv.mkDerivation rec { (lib.cmakeBool "UPNPC_BUILD_STATIC" stdenv.hostPlatform.isStatic) ]; + nativeInstallCheckInputs = [ + versionCheckHook + ]; + versionCheckProgram = "${placeholder "out"}/bin/upnpc"; + doInstallCheck = true; + doCheck = !stdenv.hostPlatform.isFreeBSD; postInstall = '' @@ -34,15 +41,17 @@ stdenv.mkDerivation rec { mv $out/bin/external-ip.sh $out/bin/external-ip ''; + __darwinAllowLocalNetworking = true; + passthru.tests = { inherit (nixosTests) upnp; }; - meta = with lib; { + meta = { homepage = "https://miniupnp.tuxfamily.org/"; description = "Client that implements the UPnP Internet Gateway Device (IGD) specification"; - platforms = with platforms; linux ++ freebsd ++ darwin; - license = licenses.bsd3; + platforms = with lib.platforms; linux ++ freebsd ++ darwin; + license = lib.licenses.bsd3; mainProgram = "upnpc"; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2d787cf1f43a..0045cd6a98ed 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13502,11 +13502,6 @@ with pkgs; gtk-pipe-viewer = perlPackages.callPackage ../applications/video/pipe-viewer { withGtk3 = true; }; - hydrus = python3Packages.callPackage ../applications/graphics/hydrus { - inherit miniupnpc swftools; - inherit (qt6) wrapQtAppsHook qtbase qtcharts; - }; - kemai = qt6Packages.callPackage ../applications/misc/kemai { }; jetbrains = (recurseIntoAttrs (callPackages ../applications/editors/jetbrains {