Nix設定で値を見つける方法

Nix設定で値を見つける方法

最近NixOSのバージョンを使い始めました23.05.885.bb8b5735d6f。構成にはいくつかの(事前定義された)式が表示されますが、これらの式にバインドされている実際の値が何であるかはわかりません。

たとえば、hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;に設定しましたが/etc/nixos/hardware-configuration.nix、実際の値が何であるかを知りたいですconfig.hardware.enableRedistributableFirmware。に設定したいからですtrue

config.hardware.enableRedistributableFirmware()コンソールで現在評価されているコンテンツ(または他のコンテンツ)を検索したり、他の方法を使用したりする方法はありますかBash

(この特定のケースの場合)これを確認する他の方法があります。

[x80486@uplink:~]$ journalctl --dmesg --grep microcode
Jun 26 08:19:28 uplink kernel: microcode: microcode updated early to revision 0xf2, date = 2023-01-12
Jun 26 08:19:28 uplink kernel: SRBDS: Mitigation: Microcode
Jun 26 08:19:28 uplink kernel: microcode: sig=0x906ea, pf=0x2, revision=0xf2
Jun 26 08:19:28 uplink kernel: microcode: Microcode Update Driver: v2.2.

...しかし、もう一度最終設定値が何であるかを理解できたらと思います。

ベストアンサー1

Nix REPLで確認できます。

$ nix repl --file '<nixpkgs/nixos>'
Welcome to Nix 2.13.3. Type :? for help.

Loading installable ''...
Added 6 variables.
nix-repl> config.hardware.enableRedistributableFirmware
true

おすすめ記事