diff --git a/default.nix b/default.nix index 9dd9b8772..0ebbc8370 100644 --- a/default.nix +++ b/default.nix @@ -16,21 +16,30 @@ let overlays = [ ]; inherit system; }; - + nix-dev-python-pkgs = with pkgs.python3.pkgs; [ + linkify-it-py + myst-parser + sphinx + sphinx-book-theme + sphinx-copybutton + sphinx-design + sphinx-notfound-page + sphinx-sitemap + pkgs.perl + ]; + # generated with nix run github:rgri/tex2nix -- *.tex *.sty + nix-dev-latex = [ (pkgs.callPackage ./nix/tex-env.nix { + extraTexPackages = { + inherit (pkgs.texlive) latexmk gnu-freefont; + }; + }) ]; nix-dev = pkgs.stdenv.mkDerivation { name = "nix-dev"; src = ./.; - nativeBuildInputs = with pkgs.python3.pkgs; [ - linkify-it-py - myst-parser - sphinx - sphinx-book-theme - sphinx-copybutton - sphinx-design - sphinx-notfound-page - sphinx-sitemap - pkgs.perl + nativeBuildInputs = [ + nix-dev-python-pkgs + nix-dev-latex ]; buildPhase = let @@ -42,6 +51,7 @@ let '' ${lib.optionalString withManuals "cp -f ${substitutedNixManualReference} source/reference/nix-manual.md"} make html + make latexpdf ''; installPhase = let @@ -68,6 +78,7 @@ let '' mkdir -p $out/manual/nix cp -R build/html/* $out/ + cp build/latex/nix-dev.pdf $out/ '' + lib.optionalString withManuals '' ${lib.concatStringsSep "\n" (lib.mapAttrsToList release releases.nixReleases)} ${lib.concatStringsSep "\n" (lib.mapAttrsToList mutableRedirect releases.mutableNixManualRedirects)} diff --git a/nix/tex-env.nix b/nix/tex-env.nix new file mode 100644 index 000000000..f6f55d91c --- /dev/null +++ b/nix/tex-env.nix @@ -0,0 +1,52 @@ +# Generated with tex2nix 0.0.0 +{ texlive, extraTexPackages ? {} }: +(texlive.combine ({ + inherit (texlive) scheme-small; + "amsmath" = texlive."amsmath"; + "atbegshi" = texlive."atbegshi"; + "atveryend" = texlive."atveryend"; + "bitset" = texlive."bitset"; + "capt-of" = texlive."capt-of"; + "cmap" = texlive."cmap"; + "colortbl" = texlive."colortbl"; + "etexcmds" = texlive."etexcmds"; + "etoolbox" = texlive."etoolbox"; + "fancyvrb" = texlive."fancyvrb"; + "float" = texlive."float"; + "fncychap" = texlive."fncychap"; + "fontspec" = texlive."fontspec"; + "framed" = texlive."framed"; + "geometry" = texlive."geometry"; + "gettitlestring" = texlive."gettitlestring"; + "hopatch" = texlive."hopatch"; + "hycolor" = texlive."hycolor"; + "hypcap" = texlive."hypcap"; + "hyperref" = texlive."hyperref"; + "iftex" = texlive."iftex"; + "infwarerr" = texlive."infwarerr"; + "intcalc" = texlive."intcalc"; + "kvdefinekeys" = texlive."kvdefinekeys"; + "kvoptions" = texlive."kvoptions"; + "kvsetkeys" = texlive."kvsetkeys"; + "letltxmacro" = texlive."letltxmacro"; + "ltxcmds" = texlive."ltxcmds"; + "minitoc" = texlive."minitoc"; + "needspace" = texlive."needspace"; + "ntheorem" = texlive."ntheorem"; + "parskip" = texlive."parskip"; + "pdfescape" = texlive."pdfescape"; + "pdftexcmds" = texlive."pdftexcmds"; + "polyglossia" = texlive."polyglossia"; + "refcount" = texlive."refcount"; + "rerunfilecheck" = texlive."rerunfilecheck"; + "stringenc" = texlive."stringenc"; + "tabulary" = texlive."tabulary"; + "titlesec" = texlive."titlesec"; + "uniquecounter" = texlive."uniquecounter"; + "upquote" = texlive."upquote"; + "url" = texlive."url"; + "varwidth" = texlive."varwidth"; + "wrapfig" = texlive."wrapfig"; + "xcolor" = texlive."xcolor"; + +} // extraTexPackages)) diff --git a/source/_static/_img/nix.pdf b/source/_static/_img/nix.pdf new file mode 100644 index 000000000..4c344d851 Binary files /dev/null and b/source/_static/_img/nix.pdf differ diff --git a/source/_templates/download-links.html b/source/_templates/download-links.html new file mode 100644 index 000000000..dcfb7de4a --- /dev/null +++ b/source/_templates/download-links.html @@ -0,0 +1 @@ +

nix.dev as PDF

diff --git a/source/conf.py b/source/conf.py index bdeb11f42..16dd719f0 100644 --- a/source/conf.py +++ b/source/conf.py @@ -201,6 +201,7 @@ "about.html", "search-field.html", "sbt-sidebar-nav.html", + "download-links.html", ], } @@ -260,9 +261,11 @@ # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. - 'preamble': '\setcounter{tocdepth}{3}', + 'preamble': r'\setcounter{tocdepth}{2}', + 'sphinxsetup': r'TitleColor={RGB}{87, 154, 202}', # Latex figure (float) alignment #'figure_align': 'htbp', + } # Grouping the document tree into LaTeX files. List of tuples @@ -271,17 +274,18 @@ latex_documents = [ ( master_doc, - "nixpkgs-cookbook.tex", - "nixpkgs-cookbook Documentation", + "nix-dev.tex", + "nix.dev", "nix.dev contributors", "manual", + True, # toctree only ), ] latex_engine = "xelatex" # The name of an image file (relative to this directory) to place at the top of # the title page. -# latex_logo = None +latex_logo = "_static/_img/nix.pdf" # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. @@ -290,10 +294,10 @@ latex_use_xindy = False # If true, show page references after internal links. -# latex_show_pagerefs = False +latex_show_pagerefs = True # If true, show URL addresses after external links. -# latex_show_urls = False +latex_show_urls = 'footnote' # Documents to append as an appendix to all manuals. # latex_appendices = []