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

feat(qcow): add support for specifying contents in a qcow image via specialArgs #303

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

seanrmurphy
Copy link

@seanrmurphy seanrmurphy commented Feb 26, 2024

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";
             }
           ];
         };

@seanrmurphy seanrmurphy changed the title feat(qcow): add support for specifying contents in a qcow image via s… feat(qcow): add support for specifying contents in a qcow image via specialArgs Feb 26, 2024
}: {
}:
let
contents = specialArgs.qcow.contents or [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lassulus why we do we now use specialArgs instead of defining cleaner nixos options?

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

Successfully merging this pull request may close these issues.

None yet

2 participants