Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a quick way to check logs from nix build and nix-build #7364

Open
YellowOnion opened this issue Nov 29, 2022 · 5 comments
Open

Add a quick way to check logs from nix build and nix-build #7364

YellowOnion opened this issue Nov 29, 2022 · 5 comments
Labels
feature Feature request or proposal

Comments

@YellowOnion
Copy link

Pain point:

As per the issue below nix build truncates output and gives you a command to copy and paste or type, with a big long hash complicating things.

With nix-build it's possible to blow out your scrollback buffer on occasion, and then you have to google how to check logs in nix, it's not intuitive.

solutions:

A command like nix log --last

or

symlink the drv, so just like ./result we can quickly access the derivation, we can then just issue nix log implying nix log .

issue:
#2420

@YellowOnion YellowOnion added the feature Feature request or proposal label Nov 29, 2022
@Kha
Copy link
Contributor

Kha commented Nov 29, 2022

If nix build was the last thing you did, you don't need to copy the store path, you can just run the same command with build replaced with log (i.e. usually just nix log).

@SuperSandro2000
Copy link
Member

Or nix log ./result or you copy the nix log command from the error output.

@YellowOnion
Copy link
Author

YellowOnion commented Nov 29, 2022

@Kha that doesn't work:

❯ nix log
warning: Git tree '/mnt/home/daniel/dev/linux/bcachefs-tools' is dirty
error: path '/nix/store/0zy2awdims34v98glmqfwi1a6zsrzjbz-bcachefs-tools-src' is not valid

@SuperSandro2000 did you read what I described? copy-pasting is slow and cumbersome.

Also the ./result link isn't created if it's not built, so it's going to be stale or non-existent, and it's also outputs junk on completed build because we want the <hash>.drv folder, not the "output".

@Kha
Copy link
Contributor

Kha commented Nov 30, 2022

Ah, it doesn't work if it's a dependency that failed as I wrote in #2420 (comment). But the same is true for your second proposed solution, surely result/ should not point to a random failed dependency instead of the thing you actually wanted to build. And I definitely don't see Nix adopt a global(?) "last build" state as in your other proposal.

@mstone
Copy link

mstone commented Nov 30, 2022

Thinking about this: how would people feel about, say, a nix.conf option to tell nix to output "error" symlinks, analogous to the "result" symlinks that successful builds produce but here for failed builds, perhaps pointing to the relevant log file or to a shell script that runs the correct nix log invocation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request or proposal
Projects
None yet
Development

No branches or pull requests

4 participants