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

Is it possible to set containers.<name>.config from one of the generated nixosConfigurations? #149

Open
bjeanes opened this issue Dec 28, 2024 · 2 comments

Comments

@bjeanes
Copy link

bjeanes commented Dec 28, 2024

I have a NixOS server configured via my snowfall-lib flake on which I want to run a systemd-nspawn machine via containers options. I'm curious if it is possible to wire in its config from a Snowfall-defined system. I see that systems is passed in as an argument to each system module, but in my brief experimentation I couldn't see how to reference one of those systems in a way that worked.

Is this possible?

Thanks for the great project :)

@jameslounds
Copy link

nixos modules get called with an inputs arg, which has inputs.self.nixosConfigurations. I use it to construct services.prometheus.scrapeConfigs by looking at all the config.services.prometheus.exporters for each configuration in inputs.self.nixosConfigurations.

Am I understanding correctly in saying you're trying to do something roughly analogous to:

containers.myContainer = {
  # ...
  config = inputs.self.nixosConfigurations.myOtherMachine;
};

@bjeanes
Copy link
Author

bjeanes commented Jan 7, 2025

Essentially, yes, though that was the first thing I tried and it didn't appear to comply with the expected interface.

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