diff options
Diffstat (limited to 'nixpkgs/pkgs/servers/wsdd')
-rw-r--r-- | nixpkgs/pkgs/servers/wsdd/default.nix | 44 | ||||
-rw-r--r-- | nixpkgs/pkgs/servers/wsdd/increase_timeout.patch | 13 |
2 files changed, 57 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/servers/wsdd/default.nix b/nixpkgs/pkgs/servers/wsdd/default.nix new file mode 100644 index 000000000000..6b99e6c59373 --- /dev/null +++ b/nixpkgs/pkgs/servers/wsdd/default.nix @@ -0,0 +1,44 @@ +{ lib, stdenv, fetchFromGitHub, installShellFiles, makeWrapper, nixosTests, python3 }: + +stdenv.mkDerivation rec { + pname = "wsdd"; + version = "0.7.1"; + + src = fetchFromGitHub { + owner = "christgau"; + repo = pname; + rev = "v${version}"; + hash = "sha256-xfZVGi3OxuRI+Zh6L3Ru4J4j5BB1EAN3fllRCVA/c5o="; + }; + + outputs = [ "out" "man" ]; + + nativeBuildInputs = [ installShellFiles makeWrapper ]; + + buildInputs = [ python3 ]; + + patches = [ + # Increase timeout to socket urlopen + # See https://github.com/christgau/wsdd/issues/80#issuecomment-76848906 + ./increase_timeout.patch + ]; + + installPhase = '' + install -Dm0555 src/wsdd.py $out/bin/wsdd + installManPage man/wsdd.8 + wrapProgram $out/bin/wsdd --prefix PYTHONPATH : "$PYTHONPATH" + ''; + + passthru = { + tests.samba-wsdd = nixosTests.samba-wsdd; + }; + + meta = with lib; { + homepage = "https://github.com/christgau/wsdd"; + description = "A Web Service Discovery (WSD) host daemon for SMB/Samba"; + maintainers = with maintainers; [ izorkin ]; + license = licenses.mit; + platforms = platforms.all; + mainProgram = "wsdd"; + }; +} diff --git a/nixpkgs/pkgs/servers/wsdd/increase_timeout.patch b/nixpkgs/pkgs/servers/wsdd/increase_timeout.patch new file mode 100644 index 000000000000..ac619f705d8e --- /dev/null +++ b/nixpkgs/pkgs/servers/wsdd/increase_timeout.patch @@ -0,0 +1,13 @@ +diff --git a/src/wsdd.py b/src/wsdd.py +index 88a7a2a..360e4f7 100755 +--- a/src/wsdd.py ++++ b/src/wsdd.py +@@ -699,7 +699,7 @@ class WSDClient(WSDUDPMessageHandler): + request.add_header('Host', host) + + try: +- with urllib.request.urlopen(request, None, 2.0) as stream: ++ with urllib.request.urlopen(request, None, 5.0) as stream: + self.handle_metadata(stream.read(), endpoint, xaddr) + except urllib.error.URLError as e: + logger.warning('could not fetch metadata from: {} {}'.format(url, e)) |