Commit 052bb414 authored by pennae's avatar pennae
Browse files

doc: assign ids to many headings

without stable ids on headings we cannot generate stable links to these
headings. nrd complains about this, but the current docbook workflow
does not.

a few generated ids remain, mostly in examples and footnotes. most of
the examples are generated by nixdoc (which has since gained MD export
functions, and the MD export does generate IDs).
parent 4bb072f0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
Building software with Nix often requires downloading source code and other files from the internet.
`nixpkgs` provides *fetchers* for different protocols and services. Fetchers are functions that simplify downloading files.

## Caveats
## Caveats {#chap-pkgs-fetchers-caveats}

Fetchers create [fixed output derivations](https://nixos.org/manual/nix/stable/#fixed-output-drvs) from downloaded files.
Nix can reuse the downloaded files via the hash of the resulting derivation.
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ Nix packages are most commonly shared between machines using [HTTP, SSH, or S3](

Note that this function is meant for advanced use-cases. The more idiomatic way to work with flat-file binary caches is via the [nix-copy-closure](https://nixos.org/manual/nix/stable/command-ref/nix-copy-closure.html) command. You may also want to consider [dockerTools](#sec-pkgs-dockerTools) for your containerization needs.

## Example
## Example {#sec-pkgs-binary-cache-example}

The following derivation will construct a flat-file binary cache containing the closure of `hello`.

+2 −2
Original line number Diff line number Diff line
@@ -410,7 +410,7 @@ If the derivation is fully buildable (i.e. `nix-build` can be used on it), runni
The behavior doesn't match `nix-shell` or `nix-build` exactly and this function is known not to work correctly for e.g. fixed-output derivations, content-addressed derivations, impure derivations and other special types of derivations.
:::

### Arguments
### Arguments {#ssec-pkgs-dockerTools-buildNixShellImage-arguments}

`drv`

@@ -473,7 +473,7 @@ The behavior doesn't match `nix-shell` or `nix-build` exactly and this function

    *Default:* (none)

### Example
### Example {#ssec-pkgs-dockerTools-buildNixShellImage-example}

The following shows how to build the `pkgs.hello` package inside a Docker container built with `buildNixShellImage`.

+5 −5
Original line number Diff line number Diff line
@@ -12,12 +12,12 @@ Whereas for many web servers, applications, it is possible to work with a Nix st

NixOS tests also use this function when preparing the VM. The `cptofs` method is used when `virtualisation.useBootLoader` is false (the default). Otherwise the second method is used.

## Features
## Features {#sec-make-disk-image-features}

For reference, read the function signature source code for documentation on arguments: <https://github.com/NixOS/nixpkgs/blob/master/nixos/lib/make-disk-image.nix>.
Features are separated in various sections depending on if you opt for a Nix-store only image or a full NixOS image.

### Common
### Common {#sec-make-disk-image-features-common}

- arbitrary NixOS configuration
- automatic or bound disk size: `diskSize` parameter, `additionalSpace` can be set when `diskSize` is `auto` to add a constant of disk space
@@ -29,7 +29,7 @@ Features are separated in various sections depending on if you opt for a Nix-sto
- the current nixpkgs can be realized as a channel in the disk image, which will change the hash of the image when the sources are updated
- additional store paths can be provided through `additionalPaths`

### Full NixOS image
### Full NixOS image {#sec-make-disk-image-features-full-image}

- arbitrary contents with permissions can be placed in the target filesystem using `contents`
- a `/etc/nixpkgs/nixos/configuration.nix` can be provided through `configFile`
@@ -37,7 +37,7 @@ Features are separated in various sections depending on if you opt for a Nix-sto
- EFI variables can be mutated during image production and the result is exposed in `$out`
- boot partition size when partition table is `efi` or `hybrid`

### On bit-to-bit reproducibility
### On bit-to-bit reproducibility {#sec-make-disk-image-features-reproducibility}

Images are **NOT** deterministic, please do not hesitate to try to fix this, source of determinisms are (not exhaustive) :

@@ -47,7 +47,7 @@ Images are **NOT** deterministic, please do not hesitate to try to fix this, sou

A `deterministic` flag is available for best efforts determinism.

## Usage
## Usage {#sec-make-disk-image-usage}

To produce a Nix-store only image:
```nix
+2 −2
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ pkgs.makeSetupHook {
} ./script.sh
```

#### setup hook that depends on the hello package and runs hello and @shell@ is substituted with path to bash
#### setup hook that depends on the hello package and runs hello and @shell@ is substituted with path to bash {#sec-pkgs.makeSetupHook-usage-example}

```nix
pkgs.makeSetupHook {
@@ -27,7 +27,7 @@ pkgs.makeSetupHook {
'')
```

## Attributes
## Attributes {#sec-pkgs.makeSetupHook-attributes}

* `name` Set the name of the hook.
* `propagatedBuildInputs` Runtime dependencies (such as binaries) of the hook.
Loading