1

How do I diagnose a nix-build failing?

Currently I see output as:

nix build -v
warning: dumping very large path (> 256 MiB); this may run out of memory
building '/nix/store/fdrm6kbm68vld3bhfjizv684ck725lyf-blog.drv'...
builder for '/nix/store/fdrm6kbm68vld3bhfjizv684ck725lyf-blog.drv' failed with exit code 1; last 5 log lines:
  unpacking sources
  unpacking source archive /nix/store/s7r5vlvp49ad6a9d5hqhsiaxw691iyhf-Blog
  source root is Blog
  patching sources
  configuring
[0 built (1 failed), 0.0 MiB DL]
error: build of '/nix/store/fdrm6kbm68vld3bhfjizv684ck725lyf-blog.drv' failed

I'd expect to find some logs / errors of why it failed to build?


Following from https://stackoverflow.com/a/47264375/1663462:

I've tried adding build-cache-failures = true; to the default.nix however I still see no output from:

nix-store --read-log

And nix-store --query-failed-paths results in:

error: no operation specified
Try 'nix-store --help' for more information.
1

Reading log should work. Did you specify the derivation? /nix/store/fdrm6kbm68vld3bhfjizv684ck725lyf-blog.drv

  • 1
    If by that you mean nix-store --read-log /nix/store/fdrm6kbm68vld3bhfjizv684ck725lyf-blog.drv then yes this seems to add additional info. – Chris Stryczynski Feb 8 at 18:36
  • Sometimes it's also useful to build with --keep-failed to retain the temporary directory of the build. – Vladimír Čunát Feb 8 at 19:19
0

https://nixos.org/releases/nix/nix-1.7/manual/#idm47361538723648

Also there is a --debug flag you can pass...

Seems I've been using nix build instead of nix-build???.

Also might be this bug: https://github.com/NixOS/nix/issues/2176

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.