Home Explore Blog Models CI



nix

src/nix/log.md
9bbe8955a6bf349f2053849542eb76b631aed15780247dd80000000300000400
R""(

# Examples

* Get the build log of GNU Hello:

  ```console
  # nix log nixpkgs#hello
  ```

* Get the build log of a specific store path:

  ```console
  # nix log /nix/store/lmngj4wcm9rkv3w4dfhzhcyij3195hiq-thunderbird-52.2.1
  ```

* Get a build log from a specific binary cache:

  ```console
  # nix log --store https://cache.nixos.org nixpkgs#hello
  ```

# Description

This command prints the log of a previous build of the [*installable*](./nix.md#installables) on standard output.

Nix looks for build logs in two places:

* In the directory `/nix/var/log/nix/drvs`, which contains logs for
  locally built derivations.

* In the binary caches listed in the `substituters` setting. Logs
  should be named `<cache>/log/<base-name-of-store-path>`, where
  `store-path` is a derivation,
  e.g. `https://cache.nixos.org/log/dvmig8jgrdapvbyxb1rprckdmdqx08kv-hello-2.10.drv`.
  For non-derivation store paths, Nix will first try to determine the
  deriver by fetching the `.narinfo` file for this store path.

)""

Chunks
41c1a5f0 (1st chunk of `src/nix/log.md`)
Title: Retrieving Build Logs with `nix log`
Summary
This document describes the `nix log` command, which is used to print the build log of a previous Nix build to standard output. It provides examples for getting logs of installables (like `nixpkgs#hello`), specific store paths, or from a particular binary cache. The command searches for logs locally in `/nix/var/log/nix/drvs` and in configured binary caches (specified by the `substituters` setting), where logs are typically stored at `<cache>/log/<base-name-of-store-path>`. For non-derivation store paths, Nix attempts to determine the deriver by fetching its `.narinfo` file.