diff --git a/nixos/modules/virtualisation/digital-ocean-image.nix b/nixos/modules/virtualisation/digital-ocean-image.nix index b6ef01516e343..3d9fe52bb0db7 100644 --- a/nixos/modules/virtualisation/digital-ocean-image.nix +++ b/nixos/modules/virtualisation/digital-ocean-image.nix @@ -14,6 +14,7 @@ in imports = [ ./digital-ocean-config.nix ./disk-size-option.nix + ../image/file-options.nix (lib.mkRenamedOptionModuleWith { sinceRelease = 2411; from = [ @@ -57,32 +58,53 @@ in }; #### implementation - config = { - system.build.digitalOceanImage = import ../../lib/make-disk-image.nix { - name = "digital-ocean-image"; + config = + let format = "qcow2"; - postVM = - let - compress = - { - "gzip" = "${pkgs.gzip}/bin/gzip"; - "bzip2" = "${pkgs.bzip2}/bin/bzip2"; - } - .${cfg.compressionMethod}; - in - '' - ${compress} $diskImage - ''; - configFile = - if cfg.configFile == null then - config.virtualisation.digitalOcean.defaultConfigFile - else - cfg.configFile; - inherit (config.virtualisation) diskSize; - inherit config lib pkgs; - }; + in + { + image.extension = lib.concatStringsSep "." [ + format + ( + { + "gzip" = "gz"; + "bzip2" = "bz2"; + } + .${cfg.compressionMethod} + ) + ]; + system.nixos.tags = [ "digital-ocean" ]; + system.build.image = config.system.build.digitalOceanImage; + system.build.digitalOceanImage = import ../../lib/make-disk-image.nix { + name = "digital-ocean-image"; + inherit (config.image) baseName; + inherit (config.virtualisation) diskSize; + inherit + config + lib + pkgs + format + ; + postVM = + let + compress = + { + "gzip" = "${pkgs.gzip}/bin/gzip"; + "bzip2" = "${pkgs.bzip2}/bin/bzip2"; + } + .${cfg.compressionMethod}; + in + '' + ${compress} $diskImage + ''; + configFile = + if cfg.configFile == null then + config.virtualisation.digitalOcean.defaultConfigFile + else + cfg.configFile; + }; - }; + }; meta.maintainers = with maintainers; [ arianvp