mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-13 09:17:07 +03:00
nixos/azure: add diskSize module option
This commit is contained in:
parent
c76bad0ec0
commit
f37aa7dd69
@ -2,27 +2,37 @@
|
|||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
diskSize = 2048;
|
cfg = config.virtualisation.azureImage;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
system.build.azureImage = import ../../lib/make-disk-image.nix {
|
|
||||||
name = "azure-image";
|
|
||||||
postVM = ''
|
|
||||||
${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -o subformat=fixed,force_size -O vpc $diskImage $out/disk.vhd
|
|
||||||
'';
|
|
||||||
configFile = ./azure-config-user.nix;
|
|
||||||
format = "raw";
|
|
||||||
inherit diskSize;
|
|
||||||
inherit config lib pkgs;
|
|
||||||
};
|
|
||||||
|
|
||||||
imports = [ ./azure-common.nix ];
|
imports = [ ./azure-common.nix ];
|
||||||
|
|
||||||
|
options = {
|
||||||
|
virtualisation.azureImage.diskSize = mkOption {
|
||||||
|
type = with types; int;
|
||||||
|
default = 2048;
|
||||||
|
description = ''
|
||||||
|
Size of disk image. Unit is MB.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = {
|
||||||
|
system.build.azureImage = import ../../lib/make-disk-image.nix {
|
||||||
|
name = "azure-image";
|
||||||
|
postVM = ''
|
||||||
|
${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -o subformat=fixed,force_size -O vpc $diskImage $out/disk.vhd
|
||||||
|
'';
|
||||||
|
configFile = ./azure-config-user.nix;
|
||||||
|
format = "raw";
|
||||||
|
inherit (cfg) diskSize;
|
||||||
|
inherit config lib pkgs;
|
||||||
|
};
|
||||||
|
|
||||||
# Azure metadata is available as a CD-ROM drive.
|
# Azure metadata is available as a CD-ROM drive.
|
||||||
fileSystems."/metadata".device = "/dev/sr0";
|
fileSystems."/metadata".device = "/dev/sr0";
|
||||||
|
|
||||||
systemd.services.fetch-ssh-keys =
|
systemd.services.fetch-ssh-keys = {
|
||||||
{ description = "Fetch host keys and authorized_keys for root user";
|
description = "Fetch host keys and authorized_keys for root user";
|
||||||
|
|
||||||
wantedBy = [ "sshd.service" "waagent.service" ];
|
wantedBy = [ "sshd.service" "waagent.service" ];
|
||||||
before = [ "sshd.service" "waagent.service" ];
|
before = [ "sshd.service" "waagent.service" ];
|
||||||
@ -54,6 +64,6 @@ in
|
|||||||
serviceConfig.RemainAfterExit = true;
|
serviceConfig.RemainAfterExit = true;
|
||||||
serviceConfig.StandardError = "journal+console";
|
serviceConfig.StandardError = "journal+console";
|
||||||
serviceConfig.StandardOutput = "journal+console";
|
serviceConfig.StandardOutput = "journal+console";
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user