1 { stdenv, lib, fetchurl, iptables-legacy, libuuid, openssl, pkg-config
2 , which, iproute2, gnused, coreutils, gnugrep, gawk, makeWrapper
4 , firewall ? "iptables", nftables, libmnl, libnftnl
8 scriptBinEnv = lib.makeBinPath {
10 # needed for dirname in ip{,6}tables_*.sh
12 # used in miniupnpd_functions.sh:
21 # needed for dirname in nft_*.sh & cat in nft_init.sh
23 # used in miniupnpd_functions.sh:
29 stdenv.mkDerivation rec {
34 url = "https://miniupnp.tuxfamily.org/files/miniupnpd-${version}.tar.gz";
35 sha256 = "sha256-+91VAQOXMPBKhCDqL49Ut99j+fBM3i3Gf6c3HoBHe74=";
38 buildInputs = [ iptables-legacy libuuid openssl ]
39 ++ lib.optionals (firewall == "nftables") [ libmnl libnftnl ];
40 nativeBuildInputs= [ pkg-config makeWrapper ];
42 # ./configure is not a standard configure file, errors with:
43 # Option not recognized : --prefix=
46 "--firewall=${firewall}"
47 # allow using various config options
56 installFlags = [ "PREFIX=$(out)" "INSTALLPREFIX=$(out)" ];
59 # Ideally we'd prefer using system's config.firewall.package here for iptables,
60 # however for some reason switching --prefix to --suffix breaks the script
62 for script in $out/etc/miniupnpd/ip{,6}tables_{init,removeall}.sh
64 wrapProgram $script --prefix PATH : '${scriptBinEnv}:$PATH'
68 for script in $out/etc/miniupnpd/nft_{delete_chain,flush,init,removeall}.sh
70 wrapProgram $script --suffix PATH : '${scriptBinEnv}:$PATH'
76 bittorrent-integration = nixosTests.bittorrent;
77 inherit (nixosTests) upnp;
81 homepage = "https://miniupnp.tuxfamily.org/";
82 description = "Daemon that implements the UPnP Internet Gateway Device (IGD) specification";
83 platforms = platforms.linux;
84 license = licenses.bsd3;
85 mainProgram = "miniupnpd";