1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 pythonOlder,
7 setuptools,
8 sphinx,
9 sphinx-autoapi,
10 sphinx-prompt,
11 sphinx-rtd-theme,
12 sphinx-tabs,
13 sphinxemoji,
14 sphinxHook,
15}:
16
17# Latest tagged release release "1.1.2" (Nov 2018) does not contain
18# documentation, it was added in commits Aug 10, 2019. Repository does not have
19# any activity since then.
20buildPythonPackage {
21 pname = "sphinx-version-warning";
22 version = "unstable-2019-08-10";
23 pyproject = true;
24
25 disabled = pythonOlder "3.7";
26
27 outputs = [
28 "out"
29 "doc"
30 ];
31
32 postPatch = ''
33 substituteInPlace docs/conf.py --replace-fail "sphinx-prompt" "sphinx_prompt"
34 '';
35
36 src = fetchFromGitHub {
37 owner = "humitos";
38 repo = "sphinx-version-warning";
39 rev = "a82156c2ea08e5feab406514d0ccd9d48a345f48";
40 hash = "sha256-WnJYMk1gPLT0dBn7lmxVDNVkLYkDCgQOtM9fQ3kc6k0=";
41 };
42
43 # It tries to write to file relative to it own location at runtime
44 # and gets permission denied, since Nix store is immutable.
45 patches = [
46 (fetchpatch {
47 url = "https://github.com/humitos/sphinx-version-warning/commit/cb1b47becf2a0d3b2570ca9929f42f7d7e472b6f.patch";
48 hash = "sha256-Vj0QAHIBmc0VxE+TTmJePzvr5nc45Sn2qqM+C/pkgtM=";
49 })
50 ];
51
52 nativeBuildInputs = [
53 sphinx-autoapi
54 sphinx-prompt
55 sphinx-rtd-theme
56 sphinx-tabs
57 sphinxemoji
58 sphinxHook
59 setuptools
60 ];
61
62 buildInputs = [ sphinx ];
63
64 pythonImportsCheck = [ "versionwarning" ];
65
66 meta = with lib; {
67 description = "Sphinx extension to show a warning banner at the top of your documentation";
68 homepage = "https://github.com/humitos/sphinx-version-warning";
69 changelog = "https://github.com/humitos/sphinx-version-warning/blob/${version}/CHANGELOG.rst";
70 license = licenses.mit;
71 maintainers = with maintainers; [ kaction ];
72 };
73}