diff --git a/.version b/.version new file mode 100644 index 000000000..22e84b802 --- /dev/null +++ b/.version @@ -0,0 +1 @@ +26.05 diff --git a/default.nix b/default.nix index 748ebf37d..8d15bce80 100644 --- a/default.nix +++ b/default.nix @@ -14,9 +14,6 @@ lib ? import "${sources.nixpkgs}/lib", }: let - version = "26.05"; - revision = flake.sourceInfo.shortRev or flake.sourceInfo.dirtyShortRev; - devLib = import ./pkgs/lib.nix { inherit lib sources system; }; flakeAttrs = default.import ./maintainers/flake { }; @@ -60,10 +57,19 @@ let }; manuals = self.call manuals/default.nix { - inherit revision version; + version = lib.strings.fileContents ./.version; + revision = flake.sourceInfo.shortRev or flake.sourceInfo.dirtyShortRev or "dev"; modulesPath = "${sources.nixpkgs}/nixos/modules"; }; + # Combined overview and HTML manual + overview-with-manual = pkgs.runCommand "overview-with-manual" { } '' + mkdir -p $out + cp -r ${default.overview}/* $out/ + mkdir -p $out/manual + cp -r ${default.manuals.html}/* $out/manual/ + ''; + nixos-modules = # TODO: this is a weird shape for what we need: ngipkgs, services, modules? { diff --git a/maintainers/flake/default.nix b/maintainers/flake/default.nix index e761c9fcb..6f4472de5 100644 --- a/maintainers/flake/default.nix +++ b/maintainers/flake/default.nix @@ -35,17 +35,12 @@ in }; # depends on the system (e.g. packages.x86_64-linux) - perSystem = rec { - packages = nonBrokenPackages // { - inherit (default) manuals overview; - - # Combined overview and html manual - overview-with-manual = pkgs.runCommand "overview-with-manual" { } '' - mkdir -p $out - cp -r ${default.overview}/* $out/ - mkdir -p $out/manual - cp -r ${default.manuals.html}/* $out/manual/ - ''; + perSystem = { + packages = { + inherit (default) + overview + overview-with-manual + ; # Configuration options in JSON options = @@ -57,7 +52,9 @@ in mkdir $out cp $build/share/doc/nixos/options.json $out/ ''; - }; + } + // nonBrokenPackages + // flattenFlakeAttrs { inherit (default) manuals; }; checks = default.import ./checks.nix { inherit nonBrokenPackages; }; diff --git a/maintainers/shells/commands/dev/devmode-manual.nix b/maintainers/shells/commands/dev/devmode-manual.nix new file mode 100644 index 000000000..2b0d719d3 --- /dev/null +++ b/maintainers/shells/commands/dev/devmode-manual.nix @@ -0,0 +1,17 @@ +# live overview+manual watcher +{ + lib, + devmode, + writeShellApplication, +}: +writeShellApplication { + name = "devmode-manual"; + text = '' + ${lib.getExe ( + devmode.override { + buildArgs = "-A overview-with-manual --show-trace -v"; + } + )} + ''; + meta.description = "watches files for changes and live reloads the overview with the manual"; +} diff --git a/manuals/_static/css/custom.css b/manuals/_static/css/custom.css index ba96c835d..3ceb8ab62 100644 --- a/manuals/_static/css/custom.css +++ b/manuals/_static/css/custom.css @@ -125,3 +125,17 @@ html[data-theme="dark"] details a { html[data-theme="light"] details a { color: #0042aa; } + +pre { + white-space:wrap; +} + +h1 code .pre, +h2 code .pre, +h3 code .pre, +h4 code .pre, +h5 code .pre, +h6 code .pre { + /* Enable wrapping in titles containing code */ + white-space:pre-wrap; +} diff --git a/manuals/_templates/about.html b/manuals/_templates/about.html index 65c1f3a6f..4d72928be 100644 --- a/manuals/_templates/about.html +++ b/manuals/_templates/about.html @@ -1,10 +1,11 @@ - -

NGIpkgs Manuals

diff --git a/manuals/_templates/download-links.html b/manuals/_templates/download-links.html deleted file mode 100644 index fa9ba62c3..000000000 --- a/manuals/_templates/download-links.html +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/manuals/conf.py b/manuals/conf.py index b5ce5456e..a274ee724 100644 --- a/manuals/conf.py +++ b/manuals/conf.py @@ -74,9 +74,9 @@ # The short X.Y version. release = "" -# Explanation: many options {option}`foo` are NixOS options, -# hence not available in NGIpkgs manuals. suppress_warnings = [ + # Explanation: many options {option}`foo` are NixOS options, + # hence not available in NGIpkgs manuals. "ref.option", ] @@ -141,6 +141,7 @@ "path_to_docs": "manuals", "use_repository_button": True, "show_navbar_depth": 2, + "max_navbar_depth": 100, } @@ -149,14 +150,15 @@ # The name for this set of Sphinx documents. # " v documentation" by default. -# html_title = 'nixpkgs-cookbook vrolling' +html_title = "NGIpkgs Manuals" # A shorter title for the navigation bar. Default is the same as html_title. -# html_short_title = None +html_short_title = "NGIpkgs" + # The name of an image file (relative to this directory) to place at the top # of the sidebar. -# html_logo = None +html_logo = "_static/_img/nix.svg" # The name of an image file (relative to this directory) to use as a favicon of # the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 @@ -186,17 +188,8 @@ html_sidebars = { "**": [ "about.html", - "search-field.html", + "search-button-field.html", "sbt-sidebar-nav.html", - "download-links.html", - ], -} - -singlehtml_sidebars = { - "**": [ - "about.html", - "sbt-sidebar-nav.html", - "download-links.html", ], } @@ -248,78 +241,6 @@ # Output file base name for HTML help builder. # htmlhelp_basename = 'nixpkgs-' -# -- Options for LaTeX output --------------------------------------------- - -# Documentation: https://www.sphinx-doc.org/en/master/latex.html -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - 'papersize': 'a4paper', - # The font size ('10pt', '11pt' or '12pt'). - #'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. - 'preamble': r''' - \setcounter{tocdepth}{0} - ''', - 'sphinxsetup': r'TitleColor={RGB}{87, 154, 202}', - # Latex figure (float) alignment - #'figure_align': 'htbp', - 'extrapackages': r''' - ''', -} - -# Grouping the document tree into LaTeX files. -# Documentation: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-latex_documents -latex_documents = [ - ( - "Contributor", - "NGIpkgs_Contributor_Manual.tex", - "NGIpkgs Contributor Manual", - "NGIpkgs Contributor", - "manual", - False, - ), - ( - "Options", - "NGIpkgs_Options.tex", - "NGIpkgs Options", - "NGIpkgs Contributors", - "howto", - False, - ), - ( - "User", - "NGIpkgs_User_Manual.tex", - "NGIpkgs User Manual", - "NGIpkgs Contributors", - "manual", - False, - ), -] - -latex_engine = "lualatex" -# The name of an image file (relative to this directory) to place at the top of -# the title page. -latex_logo = "_static/_img/nix.pdf" - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -# latex_use_parts = False - -latex_use_xindy = False - -# If true, show page references after internal links. -latex_show_pagerefs = True - -# If true, show URL addresses after external links. -latex_show_urls = 'footnote' - -# Documents to append as an appendix to all manuals. -# latex_appendices = [] - -# If false, no module index is generated. -# latex_domain_indices = True - - # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples diff --git a/manuals/default.nix b/manuals/default.nix index 2b654afb8..bec676337 100644 --- a/manuals/default.nix +++ b/manuals/default.nix @@ -1,7 +1,6 @@ { callPackage, fetchurl, - ghostscript, gnused, imagemagick, installShellFiles, @@ -12,7 +11,6 @@ revision, stdenv, texinfo, - texlive, version, ... }: @@ -32,7 +30,6 @@ let lib.any file.hasExt [ "md" "nix" - "svg" ] ) ../.) ./Makefile @@ -65,8 +62,9 @@ let done mkdir -p manuals/_static/_img - ln -s ${finalAttrs.passthru.logo.svg} manuals/_static/_img/nix.svg - magick ${finalAttrs.passthru.logo.svg} \ + ln -s ${finalAttrs.passthru.logos.ngi.png} manuals/_static/_img/ngi.png + ln -s ${finalAttrs.passthru.logos.nix.svg} manuals/_static/_img/nix.svg + magick ${finalAttrs.passthru.logos.nix.svg} \ -background transparent \ -define icon:auto-resize=32 \ -extent "%[fx:max(w,h)]x%[fx:max(w,h)]" \ @@ -91,9 +89,15 @@ let "Options" "User" ]; - logo.svg = fetchurl { - url = "https://brand.nixos.org/logos/nixos-logomark-default-gradient-minimal.svg"; - hash = "sha256-YrOle9qo0G92vvCjy9FAkyNOdyAz1DR+xoc+/CpK0yk="; + logos = { + nix.svg = fetchurl { + url = "https://brand.nixos.org/logos/nixos-logomark-default-gradient-minimal.svg"; + hash = "sha256-YrOle9qo0G92vvCjy9FAkyNOdyAz1DR+xoc+/CpK0yk="; + }; + ngi.png = fetchurl { + url = "https://ngi.eu/wp-content/uploads/sites/77/2019/06/Logo-NGI_Explicit-with-baseline-rgb.png"; + hash = "sha256-m5f2WVVj1b7dyxBle/Ug959DAJ7PYinK0OlkD/zxh0s="; + }; }; pythonPackages = python3.withPackages ( pyPkgs: with pyPkgs; [ @@ -146,62 +150,6 @@ lib.recurseIntoAttrs { ''; }); - latexpdf = common.overrideAttrs ( - finalAttrs: previousAttrs: { - nativeBuildInputs = previousAttrs.nativeBuildInputs or [ ] ++ [ - finalAttrs.passthru.texPackages - ghostscript - imagemagick - ]; - prePatch = previousAttrs.prePatch or "" + '' - mkdir -p manuals/_static/_img - magick ${finalAttrs.passthru.logo.svg} manuals/_static/_img/nix.pdf - ''; - installPhase = '' - runHook preInstall - pushd manuals/build/latex/ - mkdir -p $out - # Drastically reduce resulting PDF size - # by compressing embedded images (logo). - # - # FixMe(role): there may be a way to do it upfront using sphinx. - for pdf in NGIpkgs_*.pdf; do - ps2pdf \ - -dPDFSETTINGS="/default" \ - -dDownsampleGrayImages=false\ - -dAutoRotatePages=/None \ - -dColorImageResolution=600 \ - -dColorImageDownsampleType=/Bicubic \ - "$pdf" \ - "$out/$pdf" - done - popd - runHook postInstall - ''; - passthru = previousAttrs.passthru or { } // { - format = "latexpdf"; - # Those TeX packages are dependencies to provision - # for the build/latex/*.{tex,sty} files generated by sphinx, - # ./tex-env.nix has been generated with: - # nix -L develop -f. manuals.latexpdf - # nix run github:rgri/tex2nix -- build/latex/*.{tex,sty} - # nixfmt ./tex-env.nix - # It may have to be regenerated at some point the build is missing tex packages. - texPackages = callPackage ./tex-env.nix { - extraTexPackages = { - inherit (texlive) - latexmk - collection-fontsrecommended - collection-latexrecommended - collection-luatex - gnu-freefont # For FreeSerif.otf - ; - }; - }; - }; - } - ); - man = common.overrideAttrs (previousAttrs: { passthru = previousAttrs.passthru or { } // { format = "man"; @@ -213,20 +161,4 @@ lib.recurseIntoAttrs { runHook postInstall ''; }); - - singlehtml = common.overrideAttrs ( - finalAttrs: previousAttrs: { - passthru = previousAttrs.passthru or { } // { - format = "singlehtml"; - }; - installPhase = '' - runHook preInstall - cp -R manuals/build/singlehtml $out/ - cp -t $out \ - manuals/netlify.toml \ - manuals/robots.txt - runHook postInstall - ''; - } - ); } diff --git a/manuals/index.md b/manuals/index.md index 6bf997d67..5a9478bc3 100644 --- a/manuals/index.md +++ b/manuals/index.md @@ -1,5 +1,11 @@ +# Introduction + ```{toctree} +:hidden: true + User.md Contributor.md Options.md ``` + +ToDo(document): populate it with some NGIpkgs introduction diff --git a/manuals/tex-env.nix b/manuals/tex-env.nix deleted file mode 100644 index d3e450f79..000000000 --- a/manuals/tex-env.nix +++ /dev/null @@ -1,84 +0,0 @@ -# Generated with tex2nix 0.0.0 -{ - texlive, - extraTexPackages ? { }, -}: -(texlive.combine ( - { - inherit (texlive) scheme-small; - "amsmath" = texlive."amsmath"; - "atbegshi" = texlive."atbegshi"; - "auxhook" = texlive."auxhook"; - "bidi" = texlive."bidi"; - "bigintcalc" = texlive."bigintcalc"; - "bitset" = texlive."bitset"; - "booktabs" = texlive."booktabs"; - "capt-of" = texlive."capt-of"; - "changepage" = texlive."changepage"; - "cmap" = texlive."cmap"; - "colortbl" = texlive."colortbl"; - "ctablestack" = texlive."ctablestack"; - "etex" = texlive."etex"; - "etexcmds" = texlive."etexcmds"; - "etoolbox" = texlive."etoolbox"; - "fancyhdr" = texlive."fancyhdr"; - "fancyvrb" = texlive."fancyvrb"; - "float" = texlive."float"; - "fncychap" = texlive."fncychap"; - "fontspec" = texlive."fontspec"; - "footmisc" = texlive."footmisc"; - "framed" = texlive."framed"; - "geometry" = texlive."geometry"; - "gettitlestring" = texlive."gettitlestring"; - "hopatch" = texlive."hopatch"; - "hycolor" = texlive."hycolor"; - "hypcap" = texlive."hypcap"; - "hyperref" = texlive."hyperref"; - "ifmtarg" = texlive."ifmtarg"; - "iftex" = texlive."iftex"; - "infwarerr" = texlive."infwarerr"; - "intcalc" = texlive."intcalc"; - "kvdefinekeys" = texlive."kvdefinekeys"; - "kvoptions" = texlive."kvoptions"; - "kvsetkeys" = texlive."kvsetkeys"; - "letltxmacro" = texlive."letltxmacro"; - "listings" = texlive."listings"; - "ltxcmds" = texlive."ltxcmds"; - "luabidi" = texlive."luabidi"; - "luacode" = texlive."luacode"; - "luaotfload" = texlive."luaotfload"; - "luatexbase" = texlive."luatexbase"; - "luavlna" = texlive."luavlna"; - "marvosym" = texlive."marvosym"; - "minitoc" = texlive."minitoc"; - "natbib" = texlive."natbib"; - "needspace" = texlive."needspace"; - "notoccite" = texlive."notoccite"; - "ntheorem" = texlive."ntheorem"; - "paralist" = texlive."paralist"; - "parskip" = texlive."parskip"; - "pdfescape" = texlive."pdfescape"; - "pdftexcmds" = texlive."pdftexcmds"; - "placeins" = texlive."placeins"; - "polyglossia" = texlive."polyglossia"; - "ragged2e" = texlive."ragged2e"; - "refcount" = texlive."refcount"; - "rerunfilecheck" = texlive."rerunfilecheck"; - "setspace" = texlive."setspace"; - "showexpl" = texlive."showexpl"; - "stringenc" = texlive."stringenc"; - "tabulary" = texlive."tabulary"; - "tex4ht" = texlive."tex4ht"; - "titlesec" = texlive."titlesec"; - "uniquecounter" = texlive."uniquecounter"; - "upquote" = texlive."upquote"; - "url" = texlive."url"; - "varwidth" = texlive."varwidth"; - "wrapfig" = texlive."wrapfig"; - "xcolor" = texlive."xcolor"; - "xifthen" = texlive."xifthen"; - "xurl" = texlive."xurl"; - - } - // extraTexPackages -))