mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-05 21:03:40 +00:00
nixos/proxmox-image: add cloudImage build output (#429178)
This commit is contained in:
@@ -231,33 +231,6 @@ with lib;
|
||||
|| partitionTableType == "legacy+gpt";
|
||||
hasBootPartition = partitionTableType == "efi" || partitionTableType == "hybrid";
|
||||
hasNoFsPartition = partitionTableType == "hybrid" || partitionTableType == "legacy+gpt";
|
||||
in
|
||||
{
|
||||
assertions = [
|
||||
{
|
||||
assertion = config.boot.loader.systemd-boot.enable -> config.proxmox.qemuConf.bios == "ovmf";
|
||||
message = "systemd-boot requires 'ovmf' bios";
|
||||
}
|
||||
{
|
||||
assertion = partitionTableType == "efi" -> config.proxmox.qemuConf.bios == "ovmf";
|
||||
message = "'efi' disk partitioning requires 'ovmf' bios";
|
||||
}
|
||||
{
|
||||
assertion = partitionTableType == "legacy" -> config.proxmox.qemuConf.bios == "seabios";
|
||||
message = "'legacy' disk partitioning requires 'seabios' bios";
|
||||
}
|
||||
{
|
||||
assertion = partitionTableType == "legacy+gpt" -> config.proxmox.qemuConf.bios == "seabios";
|
||||
message = "'legacy+gpt' disk partitioning requires 'seabios' bios";
|
||||
}
|
||||
];
|
||||
image.baseName = lib.mkDefault "vzdump-qemu-${cfg.filenameSuffix}";
|
||||
image.extension = "vma.zst";
|
||||
system.build.image = config.system.build.VMA;
|
||||
system.build.VMA = import ../../lib/make-disk-image.nix {
|
||||
name = "proxmox-${cfg.filenameSuffix}";
|
||||
baseName = config.image.baseName;
|
||||
inherit (cfg) partitionTableType;
|
||||
postVM =
|
||||
let
|
||||
# Build qemu with PVE's patch that adds support for the VMA format
|
||||
@@ -315,11 +288,47 @@ with lib;
|
||||
mkdir -p $out/nix-support
|
||||
echo "file vma $out/${config.image.fileName}" > $out/nix-support/hydra-build-products
|
||||
'';
|
||||
pveBaseConfigs = {
|
||||
name = config.image.baseName;
|
||||
baseName = config.image.baseName;
|
||||
inherit (cfg) partitionTableType;
|
||||
inherit (cfg.qemuConf) additionalSpace bootSize;
|
||||
inherit (config.virtualisation) diskSize;
|
||||
format = "raw";
|
||||
inherit config lib pkgs;
|
||||
};
|
||||
in
|
||||
{
|
||||
assertions = [
|
||||
{
|
||||
assertion = config.boot.loader.systemd-boot.enable -> config.proxmox.qemuConf.bios == "ovmf";
|
||||
message = "systemd-boot requires 'ovmf' bios";
|
||||
}
|
||||
{
|
||||
assertion = partitionTableType == "efi" -> config.proxmox.qemuConf.bios == "ovmf";
|
||||
message = "'efi' disk partitioning requires 'ovmf' bios";
|
||||
}
|
||||
{
|
||||
assertion = partitionTableType == "legacy" -> config.proxmox.qemuConf.bios == "seabios";
|
||||
message = "'legacy' disk partitioning requires 'seabios' bios";
|
||||
}
|
||||
{
|
||||
assertion = partitionTableType == "legacy+gpt" -> config.proxmox.qemuConf.bios == "seabios";
|
||||
message = "'legacy+gpt' disk partitioning requires 'seabios' bios";
|
||||
}
|
||||
];
|
||||
image.baseName = lib.mkDefault "vzdump-qemu-${cfg.filenameSuffix}";
|
||||
image.extension = "vma.zst";
|
||||
system.build = {
|
||||
cloudImage = import ../../lib/make-disk-image.nix pveBaseConfigs;
|
||||
VMA = import ../../lib/make-disk-image.nix (
|
||||
pveBaseConfigs
|
||||
// {
|
||||
inherit postVM;
|
||||
}
|
||||
);
|
||||
image = config.system.build.VMA;
|
||||
};
|
||||
|
||||
boot = {
|
||||
growPartition = true;
|
||||
|
||||
@@ -307,7 +307,7 @@ rec {
|
||||
);
|
||||
|
||||
# KVM image for proxmox in VMA format
|
||||
proxmoxImage = forMatchingSystems [ "x86_64-linux" ] (
|
||||
proxmoxVMA = forMatchingSystems [ "x86_64-linux" ] (
|
||||
system:
|
||||
with import ./.. { inherit system; };
|
||||
|
||||
@@ -321,6 +321,25 @@ rec {
|
||||
)
|
||||
);
|
||||
|
||||
# Keeping the old name for compatibility
|
||||
proxmoxImage = proxmoxVMA;
|
||||
|
||||
# cloud-init image compatible with instructions given here:
|
||||
# https://pve.proxmox.com/wiki/Cloud-Init_Support
|
||||
proxmoxCloudImage = forMatchingSystems [ "x86_64-linux" ] (
|
||||
system:
|
||||
with import ./.. { inherit system; };
|
||||
|
||||
hydraJob (
|
||||
(import lib/eval-config.nix {
|
||||
inherit system;
|
||||
modules = [
|
||||
./modules/virtualisation/proxmox-image.nix
|
||||
];
|
||||
}).config.system.build.cloudImage
|
||||
)
|
||||
);
|
||||
|
||||
# LXC tarball for proxmox
|
||||
proxmoxLXC = forMatchingSystems [ "x86_64-linux" ] (
|
||||
system:
|
||||
|
||||
Reference in New Issue
Block a user