NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.54k stars 1.5k forks source link

Scoped logs for Nix builds #3117

Open matthew-piziak opened 5 years ago

matthew-piziak commented 5 years ago

When I run nixos-rebuild switch , sometimes I get a lot of logs. It is not obvious which derivations these come from.

…
checking for struct ifreq.ifr_addr.sa_len... no         << what's happening now?
checking whether gcc understands -MMD -MF... yes
stripping FHS paths in `./certs/Makefile'...                  
stripping FHS paths in `./crypto/async_tx/Makefile'...  << driver dependencies maybe??
stripping FHS paths in `./crypto/Makefile'...
stripping FHS paths in `./crypto/asymmetric_keys/Makefile'... 
…

When a job fails it's usually possible to figure out which package is responsible, but it's much harder to figure out why a particular build is taking so long. It's also hard to debug a build when logs from multiple jobs are interleaved.

Something like this on the other hand…

[emacs-speed-type-20190526.953.drv] unpacking sources
[emacs-speed-type-20190526.953.drv] source root is source
[nvidia-x11-435.21-4.19.76.drv    ] checking whether gcc understands -MMD -MF... yes
[nvidia-x11-435.21-4.19.76.drv    ] stripping FHS paths in `./crypto/Makefile'...
[emacs-speed-type-20190526.953.drv] patching sources
[emacs-speed-type-20190526.953.drv] configuring
[emacs-speed-type-20190526.953.drv] no configure script, doing nothing
[emacs-speed-type-20190526.953.drv] building
[emacs-speed-type-20190526.953.drv] installing

…would be more comfortable.

arcnmx commented 5 years ago

As of nix 2.3 nix build -L already has this feature, so adding this to nix-build seems reasonable? Also https://github.com/NixOS/nixpkgs/pull/45919 (closed but using nix build would get you scoped logs with nixpkgs today) and/or https://github.com/NixOS/nixpkgs/issues/54188 may be relevant.

bonus round (don't actually do this?):

nix run -I nixos-config=/etc/nixos/configuration.nix -Lf '<nixpkgs/nixos>' system -c switch-to-configuration switch
zimbatm commented 5 years ago

3073 also makes the -L option available to nix-build

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

stale[bot] commented 2 years ago

I closed this issue due to inactivity. → More info