1{
2 buildPythonPackage,
3 fetchFromGitHub,
4 legacy-cgi,
5 lib,
6 pyopenssl,
7 pytestCheckHook,
8 pythonAtLeast,
9 requests,
10}:
11
12buildPythonPackage rec {
13 pname = "servefile";
14 version = "0.5.4";
15 format = "setuptools";
16
17 src = fetchFromGitHub {
18 owner = "sebageek";
19 repo = "servefile";
20 tag = "v${version}";
21 hash = "sha256-hIqXwhmvstCslsCO973oK5FF2c8gZJ0wNUI/z8W+OjU=";
22 };
23
24 dependencies = [
25 pyopenssl
26 ]
27 ++ lib.optionals (pythonAtLeast "3.13") [ legacy-cgi ];
28
29 nativeCheckInputs = [
30 pytestCheckHook
31 requests
32 ];
33 # Test attempts to connect to a port on localhost which fails in nix build
34 # environment.
35 disabledTests = [
36 "test_abort_download"
37 "test_big_download"
38 "test_https_big_download"
39 "test_https"
40 "test_redirect_and_download"
41 "test_specify_port"
42 "test_upload_size_limit"
43 "test_upload"
44 ];
45 pythonImportsCheck = [ "servefile" ];
46
47 meta = with lib; {
48 description = "Serve files from shell via a small HTTP server";
49 mainProgram = "servefile";
50 homepage = "https://github.com/sebageek/servefile";
51 license = licenses.gpl3Plus;
52 maintainers = with maintainers; [ samuela ];
53 };
54}