morph
morph copied to clipboard
How to use repl to inspect configs?
trafficstars
Is there a way to inspect the system of a host given its .nix configuration?
Normally I do nix repl '<nixpkgs/nixos>' and then I can look at config. Now instead I need to somehow inject the host config in there.
I have been looking to do exactly the same to debug a faulty host configuration.
self-answer: You need to figure out where morph-lib is and then you can do this:
$ nix repl
Welcome to Nix 2.8.1. Type :? for help.
nix-repl> :b (import <nixpkgs> {}).morph
This derivation produced the following outputs:
lib -> /nix/store/7n9q6rd5aj2ir8pn1z31wll7f4ixxq4i-morph-1.7.0-lib
out -> /nix/store/n5c5ycnl8y0dax90kz335i1nc0k1bja8-morph-1.7.0
nix-repl> out = import /nix/store/7n9q6rd5aj2ir8pn1z31wll7f4ixxq4i-morph-1.7.0-lib/eval-machines.nix { networkExpr = ./my-morph-network.nix; }
Then you can look at out.nodes etc with tab completion.