Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repl reflection #1543

Open
cmm opened this issue Oct 21, 2022 · 2 comments
Open

repl reflection #1543

cmm opened this issue Oct 21, 2022 · 2 comments

Comments

@cmm
Copy link
Member

cmm commented Oct 21, 2022

Is there any way to make NixOps machine definitions inspectable using nix repl?

To illustrate where I'm coming from here: suppose you have a flake with NixOS definitions, i.e. there is a nixosConfigurations output. If you arrange to create a repl file that binds self like this: self = builtins.getFlake (toString ${inputs.self.outPath});, then you can reach inside self.outputs all the way down to nixosConfigurations.<machine>.config, and inspect those configs.

No such luck with a NixOps flake though, as the nixopsConfigurations output does not contain anything interesting (stands to reason, since its fields do not result from a function application, unlike your usual nixosConfigurations). NixOS machine definitions are obviously created when you deploy, however, but I don't see any way at all to reflect on their configs conveniently?

@cmm
Copy link
Member Author

cmm commented Oct 21, 2022

(I know about nixops show-option, but it's not terribly convenient. I guess I'm spoiled)

@roberth
Copy link
Member

roberth commented Oct 21, 2022

A NixOps network can not be evaluated without accessing or even creating some resources. Because of this, a normal nix repl will not be capable of doing this.
In this regard, nixopsConfigurations is more like nixosModules than nixosConfigurations.
NixOps itself can implement this feature by providing nix repl with the "physical" information of an existing deployment using the nix repl file argument and --argstr. (Not --expr for now because it doesn't support --argstr NixOS/nix#2678)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants