openstack-image-zfs: use system.build.image

phaer 53e68e04 e04d4cc0

Changed files
+22 -8
nixos
maintainers
scripts
+22 -8
nixos/maintainers/scripts/openstack/openstack-image-zfs.nix
···
imports = [
../../../modules/virtualisation/openstack-config.nix
../../../modules/virtualisation/disk-size-option.nix
+
../../../modules/image/file-options.nix
(lib.mkRenamedOptionModuleWith {
sinceRelease = 2411;
from = [
···
"diskSize"
];
})
+
(lib.mkRenamedOptionModuleWith {
+
sinceRelease = 2505;
+
from = [
+
"openstackImage"
+
"name"
+
];
+
to = [
+
"image"
+
"baseName"
+
];
+
})
+
] ++ (lib.optional copyChannel ../../../modules/installer/cd-dvd/channel.nix);
options.openstackImage = {
-
name = mkOption {
-
type = types.str;
-
description = "The name of the generated derivation";
-
default = "nixos-openstack-image-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}";
-
};
-
ramMB = mkOption {
type = types.int;
default = (3 * 1024);
···
virtualisation.diskSize = lib.mkOverride 1490 (8 * 1024);
virtualisation.diskSizeAutoSupported = false;
+
image.extension = cfg.format;
+
system.nixos.tags = [
+
"openstack"
+
"zfs"
+
];
+
system.build.image = config.system.build.openstackImage;
system.build.openstackImage = import ../../../lib/make-single-disk-zfs-image.nix {
inherit lib config;
-
inherit (cfg) contents format name;
+
inherit (cfg) contents format;
+
name = config.image.baseName;
pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package
configFile = pkgs.writeText "configuration.nix" ''
···
postVM = ''
extension=''${rootDiskImage##*.}
-
friendlyName=$out/${cfg.name}
+
friendlyName=$out/${config.image.baseName}
rootDisk="$friendlyName.root.$extension"
mv "$rootDiskImage" "$rootDisk"