Nix build --keep-build-log

Hello all,

I’m looking for a way to have nix build logs stored as as matter of course - this is is for a work environment where we may need them for audit purposes. There seems to be a “–keep-build-log” option for nix build, which may very well be exactly what I want, but I can’t see that it has any documentation (nor any documentation generally on when build logs are retained or garbage collected). Does anyone know anything more about it?

Thanks!

A bit more googling has shown that this is also a nix.conf setting, but there’s still not a lot more information on how build logs are handled: nix.conf - Nix Reference Manual

It seems that build logs are kept by default (so far as I can make out), but only if they have

  • the build has been done on the local machine, or
  • the build has been requested by the local machine, and done on a remote builder
    so not if
  • the package already exists on a binary cache elsewhere, and it was not you who first caused it to be built
    There is a --store parameter for the nix log command so I am attempting to see if this can be used to obtain log files from the remote builder.