diff options
author | Cole Mickens <cole.mickens@gmail.com> | 2019-11-18 12:39:18 -0800 |
---|---|---|
committer | Jon <jonringer@users.noreply.github.com> | 2020-03-29 13:56:55 -0700 |
commit | f37aa7dd69fde18e8f1602444e2530c23d4480f9 (patch) | |
tree | 35b32d6ebcf28a4720a430f10a87188f867f119c | |
parent | c76bad0ec06eed1fc387e9e610f037313a4cdde9 (diff) | |
download | nixpkgs-f37aa7dd69fde18e8f1602444e2530c23d4480f9.tar nixpkgs-f37aa7dd69fde18e8f1602444e2530c23d4480f9.tar.gz nixpkgs-f37aa7dd69fde18e8f1602444e2530c23d4480f9.tar.bz2 nixpkgs-f37aa7dd69fde18e8f1602444e2530c23d4480f9.tar.lz nixpkgs-f37aa7dd69fde18e8f1602444e2530c23d4480f9.tar.xz nixpkgs-f37aa7dd69fde18e8f1602444e2530c23d4480f9.tar.zst nixpkgs-f37aa7dd69fde18e8f1602444e2530c23d4480f9.zip |
nixos/azure: add diskSize module option
-rw-r--r-- | nixos/modules/virtualisation/azure-image.nix | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/nixos/modules/virtualisation/azure-image.nix b/nixos/modules/virtualisation/azure-image.nix index e91dd72ff5d..94c48b59a7d 100644 --- a/nixos/modules/virtualisation/azure-image.nix +++ b/nixos/modules/virtualisation/azure-image.nix @@ -2,27 +2,37 @@ with lib; let - diskSize = 2048; + cfg = config.virtualisation.azureImage; 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 ]; + + 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. - fileSystems."/metadata".device = "/dev/sr0"; + # Azure metadata is available as a CD-ROM drive. + fileSystems."/metadata".device = "/dev/sr0"; - systemd.services.fetch-ssh-keys = - { description = "Fetch host keys and authorized_keys for root user"; + systemd.services.fetch-ssh-keys = { + description = "Fetch host keys and authorized_keys for root user"; wantedBy = [ "sshd.service" "waagent.service" ]; before = [ "sshd.service" "waagent.service" ]; @@ -54,6 +64,6 @@ in serviceConfig.RemainAfterExit = true; serviceConfig.StandardError = "journal+console"; serviceConfig.StandardOutput = "journal+console"; - }; - + }; + }; } |