mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
virtualisation/digital-ocean: use system.build.image
This commit is contained in:
parent
41db5209c7
commit
77fce1dc58
1 changed files with 46 additions and 24 deletions
|
@ -14,6 +14,7 @@ in
|
||||||
imports = [
|
imports = [
|
||||||
./digital-ocean-config.nix
|
./digital-ocean-config.nix
|
||||||
./disk-size-option.nix
|
./disk-size-option.nix
|
||||||
|
../image/file-options.nix
|
||||||
(lib.mkRenamedOptionModuleWith {
|
(lib.mkRenamedOptionModuleWith {
|
||||||
sinceRelease = 2411;
|
sinceRelease = 2411;
|
||||||
from = [
|
from = [
|
||||||
|
@ -57,32 +58,53 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
#### implementation
|
#### implementation
|
||||||
config = {
|
config =
|
||||||
system.build.digitalOceanImage = import ../../lib/make-disk-image.nix {
|
let
|
||||||
name = "digital-ocean-image";
|
|
||||||
format = "qcow2";
|
format = "qcow2";
|
||||||
postVM =
|
in
|
||||||
let
|
{
|
||||||
compress =
|
image.extension = lib.concatStringsSep "." [
|
||||||
{
|
format
|
||||||
"gzip" = "${pkgs.gzip}/bin/gzip";
|
(
|
||||||
"bzip2" = "${pkgs.bzip2}/bin/bzip2";
|
{
|
||||||
}
|
"gzip" = "gz";
|
||||||
.${cfg.compressionMethod};
|
"bzip2" = "bz2";
|
||||||
in
|
}
|
||||||
''
|
.${cfg.compressionMethod}
|
||||||
${compress} $diskImage
|
)
|
||||||
'';
|
];
|
||||||
configFile =
|
system.nixos.tags = [ "digital-ocean" ];
|
||||||
if cfg.configFile == null then
|
system.build.image = config.system.build.digitalOceanImage;
|
||||||
config.virtualisation.digitalOcean.defaultConfigFile
|
system.build.digitalOceanImage = import ../../lib/make-disk-image.nix {
|
||||||
else
|
name = "digital-ocean-image";
|
||||||
cfg.configFile;
|
inherit (config.image) baseName;
|
||||||
inherit (config.virtualisation) diskSize;
|
inherit (config.virtualisation) diskSize;
|
||||||
inherit config lib pkgs;
|
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; [
|
meta.maintainers = with maintainers; [
|
||||||
arianvp
|
arianvp
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue