# TODO http_archive line
load("@com_github_rules_packer//:packer_config.bzl", "packer_configure")
# NOTE your packer_configure targets go here
load("@com_github_rules_packer//:packer_dependencies.bzl", "packer_dependencies")
packer_dependencies()
load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies")
aspect_bazel_lib_dependencies()
packer_configure(
packer_version = "1.8.6",
qemu_version = "wip", # TODO: is it possible to load our own qemu like this?
global_substitutions = {
'{headless}': "false",
'{http_dir}': ".",
'{accelerator}': "kvm",
'{vga}': "qxl",
'{display}': "gtk",
'{cpu}': "Cascadelake-Server-v4" # NOTE: change this to whatever your virtualization target is
},
debug = True
)
packer_configure(
packer_version = "1.8.6",
qemu_version = "wip",
global_substitutions = {
'{headless}': "true",
'{http_dir}': ".",
'{accelerator}': "kvm",
'{vga}': "none",
'{display}': "none",
'{cpu}': "Cascadelake-Server-v4" # NOTE: change this to whatever your virtualization target is
}
)
packer_configure(
packer_version = "1.8.6",
qemu_version = "wip", # TODO: is it possible to load our own qemu like this?
global_substitutions = {
'{http_dir}': ".",
'{accelerator}': "tcg", # TODO: confirm hvm works here
'{vga}': "cirrus",
'{display}': "cocoa",
'{cpu}': "Cascadelake-Server-v4"
},
debug = True # This enables better errors in packer, but is not needed (PACKER_LOG=1)
)
You should set headless
to false
, and supply a VGA adapter like qxl
in vga
and set the display
to be gtk
using cocoa
and cirrus
for the qemuargs
’s display
and vga
arguments appears to let this work on MacOS
github action to publish this needs to be set up in order for the usual http_archive
bazel installation to work
load("@com_github_rules_packer//:packer_config.bzl", "packer_configure")
packer_configure(
packer_version = "1.8.6",
qemu_version = "wip", # TODO: is it possible to load our own qemu like this?
global_substitutions = {
'"{$foo}"': "bar",
'{http_dir}': ".",
'{accelerator}': "kvm",
'{vga}': "qxl",
'{display}': "gtk",
'{cpu}': "Cascadelake-Server-v4"
},
debug = True
)
load("@com_github_rules_packer//:packer_dependencies.bzl", "packer_dependencies")
packer_dependencies()
load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies")
aspect_bazel_lib_dependencies()
There are several special variables and facilities for getting the packer experience to be more ergonomic
interpolation | meaning | where |
---|---|---|
$(location depfile) | any file in deps can be accessed this way | in substitutions or vars or env |
$(location output) | the output directory (packer’s output_directory ) | in substitutions or vars |
{iso_sha} | ||
{input_img} | the target path of the input_img argument | in substitutions or vars or env |
{iso} | the substitution of the input_img | in your packerfile or varfile |