Commit graph

77 commits

Author SHA1 Message Date
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
pennae fc1b58b593 doc: inline doc-support to main drv
separating function docs out like this makes it less clear how library
documentation is generated and integrated into the build. if in the
future more parts of nixpkgs use nixdoc it will make sense to have all
information about library doc generation in the same place.
2023-07-01 20:59:30 +02:00
pennae 70cbd8c6c0 doc: pull option docs out of doc-support
this leaves doc-support as a simple wrapper around function docs. this
wrapper will go away very soon as well.
2023-07-01 20:59:30 +02:00
pennae f397309f4e doc: remove remnants of docbook times
all xml-related tooling can go away. shell.nix is no longer useful since
the makefile is gone and the build runs entirely via a derivation, and
gitignore is thus also no longer that useful. it may filter out some
swap files, but its main reason to exist (keeping generated files out of
a concurrent build of the derivation) has gone away.
2023-07-01 20:59:30 +02:00
pennae be4d19ff1a doc: render nixpkgs manual with nrd
also updates nixdoc to 2.3.0. the nixdoc update is not a separate commit
because that would leave the manual build broken for one commit,
potentially breaking bisects and rebases.
2023-07-01 20:59:29 +02:00
pennae b521f451a3 doc-support: don't expose locationsXml
nothing except function docs uses this, so we need not expose it. we'll
be reworking this entire section of the build anyway, with the target of
breaking up doc-support as it is now.
2023-07-01 20:27:29 +02:00
Robert Hensing 8054785157 lib/modules: Move class out of specialArgs 2023-05-06 18:32:58 +02:00
Robert Hensing 79703eef08 nixos,nixpkgs: Add module classes
This allows modules that declare their class to be checked.
While that's not most user modules, frameworks can take advantage
of this by setting declaring the module class for their users.
That way, the mistake of importing a module into the wrong hierarchy
can be reported more clearly in some cases.
2023-05-06 18:29:04 +02:00
Silvan Mosberger 019fd45537 doc: Fix the function locations always pointing to master
Instead of revisions as they should. This is (most-likely) caused by a
simple typo, because Hydra is where the revision should come from, but
it doesn't set `.revision` as the attribute, but rather `.rev`!
2023-04-13 20:33:39 +02:00
pennae bfc6975cbc nixos/manual: remove holdovers from docbook times
these files provided mainly or exclusively xml-related tooling and
support for editing the manual. since docbook is now an implementation
detail (except for still being allowed in option docs, for now) these
tools are no longer necessary, useful, or even functional.

xmlformat.conf is still used by the nixpkgs documentation, so we have to
keep it. there's no reason it can't go live with the nixpkgs docs though.
2023-02-12 14:23:38 +01:00
Silvan Mosberger 98fbcf1788 lib.path.subpath.isValid: init
The first path library function
2023-01-03 13:20:36 +01:00