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