nixpkgs/pkgs/by-name/mi/miniupnpc/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

49 lines
1.1 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
cmake,
nixosTests,
}:
stdenv.mkDerivation rec {
pname = "miniupnpc";
version = "2.2.8";
src = fetchFromGitHub {
owner = "miniupnp";
repo = "miniupnp";
rev = "miniupnpc_${lib.replaceStrings [ "." ] [ "_" ] version}";
hash = "sha256-kPH5nr+rIcF3mxl+L0kN5dn+9xvQccVa8EduwhuYboY=";
};
sourceRoot = "${src.name}/miniupnpc";
nativeBuildInputs = [ cmake ];
cmakeFlags = [
(lib.cmakeBool "UPNPC_BUILD_SHARED" (!stdenv.hostPlatform.isStatic))
(lib.cmakeBool "UPNPC_BUILD_STATIC" stdenv.hostPlatform.isStatic)
];
doCheck = !stdenv.hostPlatform.isFreeBSD;
postInstall = ''
mv $out/bin/upnpc-* $out/bin/upnpc
mv $out/bin/upnp-listdevices-* $out/bin/upnp-listdevices
mv $out/bin/external-ip.sh $out/bin/external-ip
'';
passthru.tests = {
inherit (nixosTests) upnp;
};
meta = with lib; {
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;
mainProgram = "upnpc";
};
}