|
| 1 | +{ |
| 2 | + lib, |
| 3 | + python3, |
| 4 | + fetchPypi, |
| 5 | + nixosTests, |
| 6 | + |
| 7 | + defaultSpecificationFile ? null, |
| 8 | +}: |
| 9 | + |
| 10 | +let |
| 11 | + python = python3; |
| 12 | +in |
| 13 | +python.pkgs.buildPythonApplication rec { |
| 14 | + pname = "open-web-calendar"; |
| 15 | + version = "1.41"; |
| 16 | + pyproject = true; |
| 17 | + |
| 18 | + disabled = python.pythonOlder "3.9"; |
| 19 | + |
| 20 | + src = fetchPypi { |
| 21 | + inherit version; |
| 22 | + pname = "open_web_calendar"; |
| 23 | + hash = "sha256-3D1bGAioKCD1XZQVwtMVXi67VzzdJQnRLS6RF+dJNL4="; |
| 24 | + }; |
| 25 | + |
| 26 | + # The Pypi tarball doesn't contain open_web_calendars/features |
| 27 | + postPatch = '' |
| 28 | + ln -s $PWD/features open_web_calendar/features |
| 29 | + ''; |
| 30 | + |
| 31 | + postInstall = lib.optionalString (defaultSpecificationFile != null) '' |
| 32 | + install -D ${defaultSpecificationFile} $out/$defaultSpecificationPath |
| 33 | + ''; |
| 34 | + |
| 35 | + build-system = with python.pkgs; [ |
| 36 | + hatchling |
| 37 | + hatch-vcs |
| 38 | + ]; |
| 39 | + |
| 40 | + dependencies = |
| 41 | + with python.pkgs; |
| 42 | + [ |
| 43 | + flask-caching |
| 44 | + flask-allowed-hosts |
| 45 | + flask |
| 46 | + icalendar |
| 47 | + requests |
| 48 | + pyyaml |
| 49 | + recurring-ical-events |
| 50 | + gunicorn |
| 51 | + lxml |
| 52 | + beautifulsoup4 |
| 53 | + lxml-html-clean |
| 54 | + pytz |
| 55 | + ] |
| 56 | + ++ requests.optional-dependencies.socks; |
| 57 | + |
| 58 | + nativeCheckInputs = with python.pkgs; [ pytestCheckHook ]; |
| 59 | + |
| 60 | + pytestFlagsArray = [ "open_web_calendar/test" ]; |
| 61 | + |
| 62 | + pythonImportsCheck = [ "open_web_calendar.app" ]; |
| 63 | + |
| 64 | + defaultSpecificationPath = "${python.sitePackages}/open_web_calendar/default_specification.yml"; |
| 65 | + |
| 66 | + passthru = { |
| 67 | + inherit python; |
| 68 | + tests = { |
| 69 | + inherit (nixosTests) open-web-calendar; |
| 70 | + }; |
| 71 | + }; |
| 72 | + |
| 73 | + meta = with lib; { |
| 74 | + description = "Highly customizable web calendar that can be embedded into websites using ICal source links"; |
| 75 | + homepage = "https://open-web-calendar.quelltext.eu"; |
| 76 | + changelog = |
| 77 | + let |
| 78 | + v = builtins.replaceStrings [ "." ] [ "" ] version; |
| 79 | + in |
| 80 | + "https://open-web-calendar.quelltext.eu/changelog/#v${v}"; |
| 81 | + license = with licenses; [ |
| 82 | + gpl2Only |
| 83 | + cc-by-sa-40 |
| 84 | + cc0 |
| 85 | + ]; |
| 86 | + platforms = platforms.linux; |
| 87 | + maintainers = with maintainers; [ erictapen ]; |
| 88 | + mainProgram = "open-web-calendar"; |
| 89 | + }; |
| 90 | +} |
0 commit comments