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.
2 Likes
There’s an experimental feature called repl-flake
for that.
5 Likes
Thanks! This is what now works for me:
nix --extra-experimental-features repl-flake repl ".#nixosConfigurations.\"$NAME\""
1 Like
jappie
4
you can use the builtin getflake and use tab for completion:
nix repl
Welcome to Nix 2.13.3. Type :? for help.
nix-repl> x = builtins.getFlake "/home/jappie/projects/nixos-pi-zero-2"
> x.<tab>
which saves you having to enable yet another experimental flag (they really don’t want you to use flakes lol).
2 Likes
Great, thanks! With that I can make the command be just:
nix repl --expr "builtins.getFlake \"$PWD\""