constellation/cli/internal/libvirt/BUILD.bazel
Malte Poll fb735419ac bazel: provide runtime dependencies of libvirt where needed
This adds nix store paths to container images that have binaries linking
against libvirt from nix.
2023-12-01 09:35:33 +01:00

77 lines
1.8 KiB
Python

load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@rules_oci//oci:defs.bzl", "oci_image")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_files", "strip_prefix")
go_library(
name = "libvirt",
srcs = ["libvirt.go"],
importpath = "github.com/edgelesssys/constellation/v2/cli/internal/libvirt",
visibility = ["//:__subpackages__"],
deps = [
"//internal/file",
"@com_github_docker_docker//api/types",
"@com_github_docker_docker//api/types/container",
"@com_github_docker_docker//api/types/filters",
"@com_github_docker_docker//client",
"@com_github_spf13_afero//:afero",
],
)
pkg_files(
name = "etc",
srcs = [
"//cli/internal/libvirt/etc:passwd_db",
],
attributes = pkg_attributes(
group = "root",
mode = "0644",
owner = "root",
),
prefix = "etc",
strip_prefix = strip_prefix.from_pkg(),
)
pkg_files(
name = "nvram",
srcs = [
"//cli/internal/libvirt/nvram:nvram_vars",
],
prefix = "usr/share/OVMF",
strip_prefix = strip_prefix.from_pkg(),
)
pkg_files(
name = "libvirt_conf",
srcs = [
"libvirtd.conf",
"qemu.conf",
],
prefix = "/etc/libvirt",
)
pkg_tar(
name = "start",
srcs = [
"start.sh",
":etc",
":libvirt_conf",
":nvram",
],
mode = "0755",
)
oci_image(
name = "constellation_libvirt",
architecture = "amd64",
entrypoint = ["/start.sh"],
os = "linux",
tars = [
# TODO(malt3): test if libvirt works before merging this change!!!
"@libvirt_x86_64-linux//:closure.tar",
"@libvirt_x86_64-linux//:bin-linktree.tar",
":start",
],
visibility = ["//visibility:public"],
)