Commit Graph

87 Commits

Author SHA1 Message Date
Johannes Kirschbauer
f34ca9940a pkgs/nixos-render-docs: add prepend content via 'experimental-config'
This new mode is supposed to absorb content that is currently added via --infile and recursive {=include=}
As we restructure the nixpkgs manual we are going to add pages to this file
As a result we end up with a config file that describes the sidebar structure and what files map to which entry
This is needed for 'docs.nixos.org' navigation cutover; which will consume this file along with the .md files and render it into the portal
2026-08-05 15:14:08 +02:00
Johannes Kirschbauer
7c1a8c45bf nixos/doc: inject custom header via nixos-render-docs --header 2026-07-13 15:04:31 +02:00
Johannes Kirschbauer
4388cd791a doc/doc-support: inject custom header via nixos-render-docs --header 2026-07-13 14:30:39 +02:00
Johannes Kirschbauer
e4f7bfed18 pkgs/nixos-render-docs: add sidebar-open and popover for mobile support 2026-07-02 17:17:25 +02:00
Johannes Kirschbauer
ad97f5573d pkgs/nixos-render-docs: replace inlince tocs with collapsible sidebar
tables of contents disconnect headings from body text.
decouples heading levels from include type (part,chapter,part etc.)
structure of the sidebar is derived from the include type for now.
Can be changed to a meta file later.

sidebar now uses proper ol-, li-, span-, a-tags
definition tables are not ideal for navigation and accessibility

breaking change:
--toc-depth, --chunk-toc-depth, --section-toc-depth is
now collapsed into --sidebar-depth
2026-07-02 15:44:56 +02:00
Stefan Frijters
33a3189064 nixpkgs-manual.epub: use structuredAttrs instead of passAsFile 2026-05-02 02:29:16 +02:00
jopejoe1
58c1ec779f treewide: replace lib.trivial.version with lib.trivial.release 2026-02-16 09:45:06 +01:00
Hythera
a49f171236 nixpkgs-manual: set pname and version 2026-02-06 17:02:11 +01:00
Silvan Mosberger
91ff1ffa45 ci: Don't run non-reproducible doc urls check
Causes non-reproducible CI failures: https://github.com/NixOS/nixpkgs/actions/runs/21102527291/job/60688698991?pr=480436
2026-01-20 20:51:55 +01:00
Valentin Gagarin
14699ab9b6 fix escaping in documentation helper shell 2025-12-15 09:26:47 +01:00
Soumyadip Sarkar
60e29dadae doc: fixed typo in python-interpreter-table.nix 2025-10-15 20:45:40 +05:30
Wolfgang Walther
91a8fee3aa treewide: remove redundant parentheses
Auto-fixed by nixf-diagnose.
2025-10-05 10:52:03 +02:00
NAHO
854c5a5460 doc: remove optional builtins prefixes from prelude functions
Remove optional builtins prefixes from prelude functions by running:

    builtins=(
      abort
      baseNameOf
      break
      derivation
      derivationStrict
      dirOf
      false
      fetchGit
      fetchMercurial
      fetchTarball
      fetchTree
      fromTOML
      import
      isNull
      map
      null
      placeholder
      removeAttrs
      scopedImport
      throw
      toString
      true
    )

    fd --type file . doc --exec-batch sed --in-place --regexp-extended "
      s/\<builtins\.($(
        printf '%s\n' "${builtins[@]}" |
          paste --delimiter '|' --serial -
      ))\>/\1/g
    "

    nix fmt
2025-09-30 09:02:03 +02:00
Robert Hensing
e9f9e2dab1 doc: Add Modules, modules.generic.meta-maintainers 2025-08-17 20:46:22 +02:00
Wolfgang Walther
a7b3b2584a ci/treefmt: add markdown-code-runner
This was run as a test in `doc/tests/check-nix-code-blocks.nix` before,
but its DX can be improved: By including it in `treefmt` we get better
error reporting and auto-fixing, as well as running it on *all* markdown
files (including READMEs etc.) for free.
2025-08-05 17:30:41 +02:00
Philip Taron
b3b4fccfea doc: do-nothing change to trigger a nixpkgs-manual rebuild 2025-06-10 16:37:54 -07:00
Niklas Hambüchen
ee6c2bd2eb doc: Fix missing pre/post hooks everywhere 2025-05-24 13:22:41 +00:00
anthony
b5bd640a92 doc: fix nixpkgs-manual not being built under index.html (#400816)
This fixes the anchor links referencing `index.html` while being in `manual.html`.
2025-05-20 13:10:36 +02:00
Matt Sturgeon
4c638c2735 doc/packages/treefmt: add option reference docs
Add a `treefmt.optionsDoc` passthru, which is included on the treefmt
section of the nixpkgs manual.

This generates reference docs for options declared in
`treefmt.evalConfig`.
2025-05-20 07:52:11 +02:00
Matt Sturgeon
301824d216 doc/packages/treefmt: add function reference docs
Add a `treefmt.functionsDoc` passthru, which is included on the treefmt
section of the nixpkgs manual.

This generates reference docs for functions defined in
`pkgs/by-name/tr/treefmt/lib.nix`, using `nixdoc`.
2025-05-20 07:52:11 +02:00
Marcell Tóth
c11863f1e9 doc, nixos/doc: include roboto font
Roboto was already set as the font for the manuals,
but without a way to get it, so people who didn't
happen to have it installed saw their default font
2025-04-21 13:18:05 +02:00
Pol Dellaiera
47f000d991 doc: add missing phase hooks 2025-04-21 07:02:49 +02:00
Pol Dellaiera
58cdd4e315 {nixpkgs-manual, nixos-manual}: add new test check-nix-code-blocks 2025-04-17 01:30:34 +02:00
Valentin Gagarin
61235d4471 docs: fix devmode for manuals
hard-coding a relative path will use the calling process's working
directory, but we want the path relative to the Nix expression.
2025-01-24 18:05:03 +01:00
FliegendeWurst
59725b22ae doc: fix pypy39 removal 2025-01-07 22:06:19 +01:00
Silvan Mosberger
82d084b914 release: forbid use of lib.fileset in Nixpkgs (#369694) 2025-01-01 06:51:48 +01:00
Emily
2eae7d63e2 nixpkgs-manual: avoid lib.fileset
I don’t love this, and I’m not convinced it doesn’t have the
same pitfalls as filesets, but see the `flattenReferencesGraph`
commit for reasoning.

It may be better to ban the relevant builtins entirely and just move
things into subdirectories when needed, but I didn’t want to do
more surgery to this part of the tree than necessary to solve the
immediate problem.
2024-12-31 02:30:18 +00:00
nicoo
8ee77c6da4 doc: include nixdoc for lib.fetchers (#362453)
Closes #362196

Many thanks to @NixOS/documentation-team for the help  🖤
2024-12-30 13:35:35 +00:00
sternenseemann
a0a35b6c24 Fix cross eval issues (#362546) 2024-12-14 22:14:52 +01:00
Artturin
8a6ca8f17c nixpkgs-manual.{lib-docs,tests}: Fix cross build 2024-12-12 21:09:56 +02:00
Silvan Mosberger
4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
Priyanshu Tripathi
836d207c6c nixos-render-docs-redirects: init (#357383)
Co-authored-by: Valentin Gagarin <valentin@gagarin.work>
2024-11-29 15:03:08 +01:00
GetPsyched
5b8a714968 nixos-render-docs: init redirects system
Co-authored-by: Valentin Gagarin <valentin@gagarin.work>
2024-11-15 14:09:21 +01:00
Valentin Gagarin
50ff833cd8 devmode: move to pkgs/by-name
now one can use `devmode` from anywhere Nixpkgs is available:

    devmode = pkgs.devmode.override {
      buildArgs = toString ./.;
      open = "/index.html";
    };
2024-11-12 10:16:58 +01:00
Valentin Gagarin
b94f54b7a0 devmode: make reusable
the `devmode` helper made for the Nixpkgs/NixOS manual was exposed wrapped
in `mkShell`, which made it impossible to reuse.

this change strips that wrapper and reproduces it at the call site.

now one can use `devmode` from anywhere Nixpkgs is available:

    devmode = pkgs.callPackage "${pkgs.path}/pkgs/tools/nix/web-devmode.nix" {
      buildArgs = toString ./.;
      open = "/index.html";
    };
2024-11-12 10:16:58 +01:00
Samuel Tardieu
1e4395e769 docs: fix typo "derivaton" → "derivation" (×3) 2024-10-28 13:29:09 +01:00
Nathan Henrie
1218148c55 nixpkgs-manual.lib-docs: fix sandboxed build on darwin
The darwin sandbox prevents this nix call from accessing `/nix/
store/.links` resulting in a build failure:

```
> error: getting status of '/nix/store/.links': Operation not permitted
```

Thanks to @emilazy for the workaround!

Fixes https://github.com/NixOS/nixpkgs/issues/339808
2024-09-12 12:44:17 -06:00
Philip Taron
587f64a264 nixpkgs-manual: use injected revision only
`lib.trivial.revisionWithDefault` will change with every Git commit, which causes the manual to be rebuilt on every since PR.

Using `nixpkgs.rev` (or the dummy value "master" if it's not present) means that the manual will contain the revision if built on Hydra, but will not otherwise.

Why?

1. https://hydra.nixos.org/jobset/nixos/trunk-combined#tabs-configuration shows that `pkgs/top-level/release.nix` is passed the `nixpkgs` attrset, which is a "Git checkout".
2. Git checkouts come from [`builtins.fetchGit`](https://nix.dev/manual/nix/2.18/language/builtins#builtins-fetchGit) and include the `rev` attribute.
3. The `rev` attribute is what `lib.trivial.revisionWithDefault` would have returned.

So, using `nixpkgs.rev or "master"` exclusively will cause the rebuilds on every commit to cease, but will allow "official" nixpkgs manual built on Hydra to continue to reference a specific commit.
2024-07-29 11:29:15 -07:00
Philip Taron
b846df0a2e nixpkgs-manual: inline common.nix 2024-07-26 13:46:13 -07:00
Philip Taron
eaa7811104 nixpkgs-manual: move shell to package 2024-07-26 13:46:12 -07:00
Philip Taron
b5dc82844f nixpkgs-manual: init 2024-07-26 13:46:12 -07:00
Philip Taron
4252286f21 doc: extract nixpkgs-manual into its own package
Also, use `finalAttrs` style and pass through all the helper derivations.
2024-07-26 13:44:04 -07:00
Philip Taron
2266280af7 doc: reshape python-interpreter-table.nix into a normal callPackage
Before, it produced a string, not a derivation.
2024-07-26 13:44:04 -07:00
Philip Taron
eac67316dc doc: extract optionsDoc into its own package 2024-07-26 13:44:04 -07:00
Philip Taron
ee6a243ea4 doc: extract epub manual stub into its own package 2024-07-26 13:44:04 -07:00
Philip Taron
87b8931d74 doc: make ./doc-support/lib-function-docs.nix callPackage style
Move `libsets` over to it, since it's the only user.

Format with `nixfmt` since we're changing it so dramatically.
2024-07-26 13:44:04 -07:00
Silvan Mosberger
f01573b6ee doc: Prevent evaluation warnings
Problem: `nix-build doc` gives a bunch of warnings because it inspects
`lib` to figure out where all the symbols are.

Solution: Move the step of figuring out where the symbols are to
a Nix evaluation inside a derivation instead.
2024-07-18 23:33:29 +02:00
Alejandro Sánchez Medina
0cb4674319 doc: autogenerate python interpreter table (#313408)
* doc: autogenerate python interpreter table

This serves as a practical example on generating documentation by
inspection of the evaluated Nixpkgs tree.

Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2024-05-23 10:36:15 +02:00
Johannes Kirschbauer
48a2178434 adds block_args for autogenerated ids from trustworthy sources 2024-01-29 22:29:39 +01:00
Robert Hensing
aa1beb0ab5 doc: Render lib.fixedPoints 2023-07-08 18:46:08 +02:00