Commit b890f62d authored by Gaetan Lepage's avatar Gaetan Lepage
Browse files

miniupnpc: modernize, add versionCheckHook

parent 5232aceb
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -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 = ''
@@ -40,11 +47,11 @@ stdenv.mkDerivation rec {
    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";
  };
}