nix icon indicating copy to clipboard operation
nix copied to clipboard

`nix log --last`

Open peterbecich opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. Common workflow is

$ nix build

[error, read derivation path]
For full logs, run 'nix-store -l /nix/store/abcdef.....

$ nix log /nix/store/abcdef...[TAB]

Describe the solution you'd like

nix log --last

jumping to the last failed build. No need to type the first letters of the failed build's path.

Or perhaps, even shorter:

nix log

Describe alternatives you've considered

Additional context

Priorities

Add :+1: to issues you find important.

peterbecich avatar Jul 23 '24 03:07 peterbecich

Ideas to consider

  • current behavior is for nix log to interpret no argument as the "default installable", the current directory flake. So in many cases this will accidentally be the right thing, but then again, often not.
  • with NIX_CONFIG = log-location = .logs , then nix build would create a symlink. Subsequent nix log without any installable would, by default, look in the log-location. NIX_LOG_DIR has
  • a nix log can do something like this just looking for the latest log on the computer
bzcat $(find /nix/var/log/nix/drvs -type f -printf '%C@ %p\n' | awk '$1>a{a=$1;b=$2}END{print b}' )
  • NIX_LOG_DIR can be used, but this is a daemon setting, we'd want to avoid writing files/directories by root permissions requested by untrusted user... ew.

attn: @jeremiahsecrist

tomberek avatar Aug 14 '24 02:08 tomberek

current behavior is for nix log to interpret no argument as the "default installable", the current directory flake. So in many cases this will accidentally be the right thing, but then again, often not.

LoL, I didn't actually know that nix log is sufficient (for me, in a Flake) - Thank You for mentioning this here.

IMHO the UX for Noobs would already be greatly improved if only a nix build or nix run would simply say:

For full logs, run: nix log

instead of the current:

For full logs, run:                                                                                                   
    nix log /nix/store/v6ilgq22107mhqlcbsqj72klqmfrxnyb-enola-4c02203.drv

Just my 2 cents.

vorburger avatar Sep 20 '25 08:09 vorburger