1 { config, lib, pkgs, ... }:
5 cfg = config.virtualisation.digitalOceanImage;
9 imports = [ ./digital-ocean-config.nix ];
12 virtualisation.digitalOceanImage.diskSize = mkOption {
13 type = with types; either (enum [ "auto" ]) int;
17 Size of disk image. Unit is MB.
21 virtualisation.digitalOceanImage.configFile = mkOption {
22 type = with types; nullOr path;
25 A path to a configuration file which will be placed at
26 `/etc/nixos/configuration.nix` and be used when switching
27 to a new configuration. If set to `null`, a default
28 configuration is used that imports
29 `(modulesPath + "/virtualisation/digital-ocean-config.nix")`.
33 virtualisation.digitalOceanImage.compressionMethod = mkOption {
34 type = types.enum [ "gzip" "bzip2" ];
38 Disk image compression method. Choose bzip2 to generate smaller images that
39 take longer to generate but will consume less metered storage space on your
40 Digital Ocean account.
48 system.build.digitalOceanImage = import ../../lib/make-disk-image.nix {
49 name = "digital-ocean-image";
53 "gzip" = "${pkgs.gzip}/bin/gzip";
54 "bzip2" = "${pkgs.bzip2}/bin/bzip2";
55 }.${cfg.compressionMethod};
57 ${compress} $diskImage
59 configFile = if cfg.configFile == null
60 then config.virtualisation.digitalOcean.defaultConfigFile
62 inherit (cfg) diskSize;
63 inherit config lib pkgs;
68 meta.maintainers = with maintainers; [ arianvp eamsden ];