Use repl to inspect a flake

I’d like to make it easy to inspect a node configuration in deploy-rs.

Normally, I’d do nix repl and then :lf . followed by n=nixosConfigurations.myNodeName.config.

Is there a way to automate this so I can run a command and immediately have n defined?

I tried nix repl --expr ':lf .' but that doesn’t work, and I can’t find a builtin that loads a flake.

1 Like

There’s an experimental feature called repl-flake for that.

3 Likes

Thanks! This is what now works for me:

nix --extra-experimental-features repl-flake repl ".#nixosConfigurations.\"$NAME\""