Nix

如何診斷失敗的 nix-build?

  • October 16, 2021

如何診斷 nix-build 失敗?

目前我看到輸出為:

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

我希望找到一些關於它為什麼無法建構的日誌/錯誤?


來自https://stackoverflow.com/a/47264375/1663462

我已經嘗試添加build-cache-failures = true;到,default.nix但是我仍然看不到以下輸出:

nix-store --read-log

nix-store --query-failed-paths結果:

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

閱讀日誌應該可以工作。您是否指定了派生? /nix/store/fdrm6kbm68vld3bhfjizv684ck725lyf-blog.drv

有一個--debug選項以及一個--print-build-logs可以提供附加資訊的選項。

關於具體問題 - 可能是這個錯誤:https ://github.com/NixOS/nix/issues/2176

更多資訊

https://nixos.org/releases/nix/nix-1.7/manual/#idm47361538723648(連結現在壞了……)

引用自:https://unix.stackexchange.com/questions/498435