-
-
Notifications
You must be signed in to change notification settings - Fork 146
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
Allow generating image using existing nixosSystem #246
base: master
Are you sure you want to change the base?
Conversation
Accepts a new paramater nixosSystem if not null use extendModules rather than creating a new nixosSystem.
I may be missing something, but all the module does is let you include a variety of format that can be built. My personal opinion is that it tightly couples the image generation to the system generation. I'm not sure if or why this would be desirable. Here is my simple use case,
I can modify and tweak the VM generatotion, and the system config remains agnostic. If #241 can do this as simply as this patch can, you've sold me. |
Your example reminds me that a missing feature of #241 is to pass your own modules. I'll add that asap. Assuming we have that features, then the whole flake could look like this:
{
#...
outputs = {self, nixos-generators, ...} @ inputs: {
nixosConfigurations.radius-lab = {config, pkgs, ...}: {
imports = [
nixos-generators.nixosModules.all-formats
];
# all you normal system config here
# nixos-generators options for all possible formats
formats.vm = {
virtualisation = {
memorySize = 4096;
qemu.networkingOptions = [
"-net user,hostfwd=udp::1812-:1812"
];
};
};
};
};
# this line is just an alias, instead of an extra function call
radius-lab-vm = self.nixosConfigurations.system.formats.vm;
} Why is this better? |
So that sounds like it would be awesome, and probably would supersede #185 for my use cases. How close did #241 get to actually being able to do what you suggest? To start with |
I just opened #256 which implements the customization options similar to the example above and also allows adding new formats. |
Accepts a new paramater nixosSystem if not null use extendModules rather than creating a new nixosSystem.