nixos-generators
nixos-generators copied to clipboard
feat(qcow): add support for specifying contents in a qcow image via specialArgs
I wanted to be able to inject files into a qcow image using the content parameter in the qcow builder; I just passed it in via specialArgs.
Not really sure if this is the best way to do it, but it worked for me.
Here is an example of how it can be called:
let
fs = nixpkgs.lib.fileset;
sourceFiles = fs.unions [
./configuration.nix
./flake.nix
./README.md
];
in ...
qcow = nixos-generators.nixosGenerate {
system = "x86_64-linux";
modules = [ ./configuration.nix ];
format = "qcow";
specialArgs = {
qcow.contents = [
{
source = fs.toSource {
root = ./.;
fileset = sourceFiles;
};
target = "/root/nixos-config";
user = "root";
group = "root";
mode = "755";
}
];
};