make separate section for builder execution

This commit is contained in:
Valentin Gagarin 2023-07-18 13:49:59 +02:00
parent b19bd4f348
commit 541890463d

View file

@ -93,16 +93,18 @@ wrapper around `derivation` that adds a default value for `system` and
always uses Bash as the builder, to which the supplied builder is passed always uses Bash as the builder, to which the supplied builder is passed
as a command-line argument. See the Nixpkgs manual for details. as a command-line argument. See the Nixpkgs manual for details.
The builder is executed as follows: ## Builder execution
- A temporary directory is created under the directory specified by The [`builder`](#attr-builder) is executed as follows:
- A temporary directory is created under the directory specified by
`TMPDIR` (default `/tmp`) where the build will take place. The `TMPDIR` (default `/tmp`) where the build will take place. The
current directory is changed to this directory. current directory is changed to this directory.
- The environment is cleared and set to the derivation attributes, as - The environment is cleared and set to the derivation attributes, as
specified above. specified above.
- In addition, the following variables are set: - In addition, the following variables are set:
- `NIX_BUILD_TOP` contains the path of the temporary directory for - `NIX_BUILD_TOP` contains the path of the temporary directory for
this build. this build.
@ -131,26 +133,26 @@ The builder is executed as follows:
attribute and the output name. (The output name is omitted if attribute and the output name. (The output name is omitted if
its `out`.) its `out`.)
- If an output path already exists, it is removed. Also, locks are - If an output path already exists, it is removed. Also, locks are
acquired to prevent multiple Nix instances from performing the same acquired to prevent multiple Nix instances from performing the same
build at the same time. build at the same time.
- A log of the combined standard output and error is written to - A log of the combined standard output and error is written to
`/nix/var/log/nix`. `/nix/var/log/nix`.
- The builder is executed with the arguments specified by the - The builder is executed with the arguments specified by the
attribute `args`. If it exits with exit code 0, it is considered to attribute `args`. If it exits with exit code 0, it is considered to
have succeeded. have succeeded.
- The temporary directory is removed (unless the `-K` option was - The temporary directory is removed (unless the `-K` option was
specified). specified).
- If the build was successful, Nix scans each output path for - If the build was successful, Nix scans each output path for
references to input paths by looking for the hash parts of the input references to input paths by looking for the hash parts of the input
paths. Since these are potential runtime dependencies, Nix registers paths. Since these are potential runtime dependencies, Nix registers
them as dependencies of the output paths. them as dependencies of the output paths.
- After the build, Nix sets the last-modified timestamp on all files - After the build, Nix sets the last-modified timestamp on all files
in the build result to 1 (00:00:01 1/1/1970 UTC), sets the group to in the build result to 1 (00:00:01 1/1/1970 UTC), sets the group to
the default group, and sets the mode of the file to 0444 or 0555 the default group, and sets the mode of the file to 0444 or 0555
(i.e., read-only, with execute permission enabled if the file was (i.e., read-only, with execute permission enabled if the file was