nixos-generators
nixos-generators copied to clipboard
Expose nixdeploy as nix function in flake for automatic builds
Basically being able to do something like this
outputs = { nixdeploy, nixpkgs }:
{
defaultPackage = nixdeploy.format.lxc { configuration = ./configuration.nix; nixpkgs = nixpkgs; };
}
I just want to +1 this concept. I'm not sure if it's already possible, but I'd love to be able to do something like this where I can just nix build .# and my outputs are VM images.
So I'm somewhat out of my depth, but I added a nixosGenerate function to my fork which I'm testing here. It works basically like you suggest
outputs = { system, nixpkgs, nixosGenerate }: {
lxcImage = nixosGenerate{
inherit system pkgs;
modules = [ ./configuration.nix ];
format = "lxc";
};
}
I can run commands like nix build .#lxcImage and result is populated with the image.
This seems to work for several of the formats I've tried, but again I feel a little out of my depth. I opened #119 for comment.