feat: add TODO

This commit is contained in:
Ryan Yin 2023-07-16 13:24:04 +08:00
parent 1743f69532
commit bf3dda3084
2 changed files with 39 additions and 2 deletions

View file

@ -1,4 +1,6 @@
# Debugging with `nix repl`
# Debugging Derivations and Nix Expressions
## Debugging with `nix repl`
We have frequently used nix repl `<nixpkgs>` throughout this guide to examine the source code. It is a powerful tool that helps us understand how things work in Nix.
@ -141,3 +143,19 @@ outputs.nixosConfigurations.ai.config.home-manager.users.ryan.home.file..config/
```
As you can see, after loading your Nix flake into the REPL, you can check every attribute of the flake. This capability is very convenient for debugging purposes.
## Debugging functions provided by nixpkgs
TODO
## Debugging by using `NIX_DEBUG` in derivation
TODO
## References
- [How to make nix build display all commands executed by make?](https://www.reddit.com/r/NixOS/comments/14stdgy/how_to_make_nix_build_display_all_commands/)
- use `NIX_DEBUG=7` in derivation
- [Collection of functions useful for debugging broken nix expressions.](https://github.com/NixOS/nixpkgs/blob/master/lib/debug.nix)

View file

@ -1,4 +1,6 @@
# 通过 `nix repl` 查看源码、调试配置
# 调试 Derivation 跟 Nix 表达式
## 通过 `nix repl` 查看源码、调试配置
前面我们已经使用 `nix repl '<nixpkgs>'` 看过很多次源码了,这是一个非常强大的工具,可以帮助我们理解 Nix 的工作原理。
@ -137,3 +139,20 @@ outputs.nixosConfigurations.ai.config.home-manager.users.ryan.home.file..config/
```
能看到,通过 `nix repl` 加载好我的 flake 配置后,就能很方便地检查所有的配置项了,这对于调试非常有用。
## 使用 nixpkgs 中提供的调试函数
TODO
## 使用 derivation 的 `NIX_DEBUG` 参数调试
TODO
## 参考文档
- [How to make nix build display all commands executed by make?](https://www.reddit.com/r/NixOS/comments/14stdgy/how_to_make_nix_build_display_all_commands/)
- use `NIX_DEBUG=7` in derivation
- [Collection of functions useful for debugging broken nix expressions.](https://github.com/NixOS/nixpkgs/blob/master/lib/debug.nix)