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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion formats/qcow.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
modulesPath,
specialArgs,
...
}: {
}:
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?

Choose a reason for hiding this comment

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

I was thinking about this also when making pr for #387 Is there a better way of exposing parameters of the upstream imports?

Copy link
Member

@phaer phaer Oct 30, 2024

Choose a reason for hiding this comment

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

Missed this PR and comment before, but just answered in #387: The "parameters" to upstream imports are often just "module options" - you should be able to just set them in an argument to modules in nixosGenerate.

See #387 (comment) for an example of this.

In this PR though, content is not exposed as an option upstream but just a parameter to the function in make-disk-image.nix. So one would need to lib.mkOption a new one in formats/qcow.nix

in {
# for virtio kernel drivers
imports = [
"${toString modulesPath}/profiles/qemu-guest.nix"
Expand Down Expand Up @@ -33,6 +36,7 @@
diskSize = specialArgs.diskSize or "auto";
format = "qcow2";
partitionTableType = "hybrid";
contents = contents;
};

formatAttr = "qcow";
Expand Down