Skip to content

Commit af41ecc

Browse files
authored
Merge pull request #14469 from roberth/doc-check-link-fragments
Manual: fix and check link fragments
2 parents 6bd92d4 + 7e84ce3 commit af41ecc

File tree

33 files changed

+102
-59
lines changed

33 files changed

+102
-59
lines changed

ci/gha/tests/default.nix

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,29 @@ rec {
107107
};
108108
};
109109

110+
disable =
111+
let
112+
inherit (pkgs.stdenv) hostPlatform;
113+
in
114+
args@{
115+
pkgName,
116+
testName,
117+
test,
118+
}:
119+
lib.any (b: b) [
120+
# FIXME: Nix manual is impure and does not produce all settings on darwin
121+
(hostPlatform.isDarwin && pkgName == "nix-manual" && testName == "linkcheck")
122+
];
123+
110124
componentTests =
111125
(lib.concatMapAttrs (
112126
pkgName: pkg:
113-
lib.concatMapAttrs (testName: test: {
114-
"${componentTestsPrefix}${pkgName}-${testName}" = test;
115-
}) (pkg.tests or { })
127+
lib.concatMapAttrs (
128+
testName: test:
129+
lib.optionalAttrs (!disable { inherit pkgName testName test; }) {
130+
"${componentTestsPrefix}${pkgName}-${testName}" = test;
131+
}
132+
) (pkg.tests or { })
116133
) nixComponentsInstrumented)
117134
// lib.optionalAttrs (pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform) {
118135
"${componentTestsPrefix}nix-functional-tests" = nixComponentsInstrumented.nix-functional-tests;

doc/manual/anchors.jq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
def transform_anchors_html:
6-
. | gsub($empty_anchor_regex; "<a name=\"" + .anchor + "\"></a>")
6+
. | gsub($empty_anchor_regex; "<a id=\"" + .anchor + "\"></a>")
77
| gsub($anchor_regex; "<a href=\"#" + .anchor + "\" id=\"" + .anchor + "\">" + .text + "</a>");
88

99

doc/manual/package.nix

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
# Configuration Options
1919

2020
version,
21+
22+
# `tests` attribute
23+
testers,
2124
}:
2225

2326
let
@@ -87,6 +90,29 @@ mkMesonDerivation (finalAttrs: {
8790
echo "doc manual ''$out/share/doc/nix/manual" >> ''$out/nix-support/hydra-build-products
8891
'';
8992

93+
/**
94+
The root of the HTML manual.
95+
E.g. "${nix-manual.site}/index.html" exists.
96+
*/
97+
passthru.site = finalAttrs.finalPackage + "/share/doc/nix/manual";
98+
99+
passthru.tests = {
100+
# https://nixos.org/manual/nixpkgs/stable/index.html#tester-lycheeLinkCheck
101+
linkcheck = testers.lycheeLinkCheck {
102+
inherit (finalAttrs.finalPackage) site;
103+
extraConfig = {
104+
exclude = [
105+
# Exclude auto-generated JSON schema documentation which has
106+
# auto-generated fragment IDs that don't match the link references
107+
".*/protocols/json/.*\\.html"
108+
# Exclude undocumented builtins
109+
".*/language/builtins\\.html#builtins-addErrorContext"
110+
".*/language/builtins\\.html#builtins-appendContext"
111+
];
112+
};
113+
};
114+
};
115+
90116
meta = {
91117
platforms = lib.platforms.all;
92118
};

doc/manual/source/command-ref/nix-channel.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The moving parts of channels are:
1414
- The official channels listed at <https://nixos.org/channels>
1515
- The user-specific list of [subscribed channels](#subscribed-channels)
1616
- The [downloaded channel contents](#channels)
17-
- The [Nix expression search path](@docroot@/command-ref/conf-file.md#conf-nix-path), set with the [`-I` option](#opt-i) or the [`NIX_PATH` environment variable](#env-NIX_PATH)
17+
- The [Nix expression search path](@docroot@/command-ref/conf-file.md#conf-nix-path), set with the [`-I` option](#opt-I) or the [`NIX_PATH` environment variable](#env-NIX_PATH)
1818

1919
> **Note**
2020
>

doc/manual/source/command-ref/nix-env/upgrade.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ left untouched; this is not an error. It is also not an error if an
2222
element of *args* matches no installed derivations.
2323

2424
For a description of how *args* is mapped to a set of store paths, see
25-
[`--install`](#operation---install). If *args* describes multiple
25+
[`--install`](./install.md). If *args* describes multiple
2626
store paths with the same symbolic name, only the one with the highest
2727
version is installed.
2828

doc/manual/source/development/building.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ You can also build Nix for one of the [supported platforms](#platforms).
6666
This section assumes you are using Nix with the [`flakes`] and [`nix-command`] experimental features enabled.
6767

6868
[`flakes`]: @docroot@/development/experimental-features.md#xp-feature-flakes
69-
[`nix-command`]: @docroot@/development/experimental-features.md#xp-nix-command
69+
[`nix-command`]: @docroot@/development/experimental-features.md#xp-feature-nix-command
7070

7171
To build all dependencies and start a shell in which all environment variables are set up so that those dependencies can be found:
7272

@@ -256,7 +256,7 @@ You can use any of the other supported environments in place of `nix-cli-ccacheS
256256
## Editor integration
257257

258258
The `clangd` LSP server is installed by default on the `clang`-based `devShell`s.
259-
See [supported compilation environments](#compilation-environments) and instructions how to set up a shell [with flakes](#nix-with-flakes) or in [classic Nix](#classic-nix).
259+
See [supported compilation environments](#compilation-environments) and instructions how to set up a shell [with flakes](#building-nix-with-flakes) or in [classic Nix](#building-nix).
260260

261261
To use the LSP with your editor, you will want a `compile_commands.json` file telling `clangd` how we are compiling the code.
262262
Meson's configure always produces this inside the build directory.

doc/manual/source/development/testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ This will:
119119

120120
3. Stop the program when the test fails, allowing the user to then issue arbitrary commands to GDB.
121121

122-
### Characterisation testing { #characaterisation-testing-unit }
122+
### Characterisation testing { #characterisation-testing-unit }
123123

124124
See [functional characterisation testing](#characterisation-testing-functional) for a broader discussion of characterisation testing.
125125

doc/manual/source/glossary.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@
208208

209209
- [impure derivation]{#gloss-impure-derivation}
210210

211-
[An experimental feature](#@docroot@/development/experimental-features.md#xp-feature-impure-derivations) that allows derivations to be explicitly marked as impure,
211+
[An experimental feature](@docroot@/development/experimental-features.md#xp-feature-impure-derivations) that allows derivations to be explicitly marked as impure,
212212
so that they are always rebuilt, and their outputs not reused by subsequent calls to realise them.
213213

214214
- [Nix database]{#gloss-nix-database}
@@ -279,7 +279,7 @@
279279

280280
See [References](@docroot@/store/store-object.md#references) for details.
281281

282-
- [referrer]{#gloss-reference}
282+
- [referrer]{#gloss-referrer}
283283

284284
A reversed edge from one [store object] to another.
285285

@@ -367,8 +367,8 @@
367367

368368
Nix represents files as [file system objects][file system object], and how they belong together is encoded as [references][reference] between [store objects][store object] that contain these file system objects.
369369

370-
The [Nix language] allows denoting packages in terms of [attribute sets](@docroot@/language/types.md#attribute-set) containing:
371-
- attributes that refer to the files of a package, typically in the form of [derivation outputs](#output),
370+
The [Nix language] allows denoting packages in terms of [attribute sets](@docroot@/language/types.md#type-attrs) containing:
371+
- attributes that refer to the files of a package, typically in the form of [derivation outputs](#gloss-output),
372372
- attributes with metadata, such as information about how the package is supposed to be used.
373373

374374
The exact shape of these attribute sets is up to convention.
@@ -383,7 +383,7 @@
383383

384384
[string]: ./language/types.md#type-string
385385
[path]: ./language/types.md#type-path
386-
[attribute name]: ./language/types.md#attribute-set
386+
[attribute name]: ./language/types.md#type-attrs
387387

388388
- [base directory]{#gloss-base-directory}
389389

doc/manual/source/language/advanced-attributes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ Here is more information on the `output*` attributes, and what values they may b
333333
334334
`outputHashAlgo` can only be `null` when `outputHash` follows the SRI format, because in that case the choice of hash algorithm is determined by `outputHash`.
335335
336-
- [`outputHash`]{#adv-attr-outputHashAlgo}; [`outputHash`]{#adv-attr-outputHashMode}
336+
- [`outputHash`]{#adv-attr-outputHash}
337337
338338
This will specify the output hash of the single output of a [fixed-output derivation].
339339

doc/manual/source/language/derivations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ It outputs an attribute set, and produces a [store derivation] as a side effect
1616
- [`name`]{#attr-name} ([String](@docroot@/language/types.md#type-string))
1717

1818
A symbolic name for the derivation.
19-
See [derivation outputs](@docroot@/store/derivation/index.md#outputs) for what this is affects.
19+
See [derivation outputs](@docroot@/store/derivation/outputs/index.md#outputs) for what this is affects.
2020

2121
[store path]: @docroot@/store/store-path.md
2222

0 commit comments

Comments
 (0)