Loading nixos/maintainers/scripts/ec2/amazon-image.nix +122 −96 Original line number Diff line number Diff line { config, lib, pkgs, ... }: { config, lib, pkgs, ... }: let inherit (lib) mkOption optionalString types versionAtLeast; inherit (lib) mkOption optionalString types versionAtLeast ; inherit (lib.options) literalExpression; cfg = config.amazonImage; amiBootMode = if config.ec2.efi then "uefi" else "legacy-bios"; in { in { imports = [ ../../../modules/virtualisation/amazon-image.nix ]; Loading @@ -14,11 +25,11 @@ in { # experience, which prior to 4.15 was 255. # https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nvme-ebs-volumes.html#timeout-nvme-ebs-volumes config.boot.kernelParams = let timeout = if versionAtLeast config.boot.kernelPackages.kernel.version "4.15" then "4294967295" else "255"; in [ "nvme_core.io_timeout=${timeout}" ]; let timeout = if versionAtLeast config.boot.kernelPackages.kernel.version "4.15" then "4294967295" else "255"; in [ "nvme_core.io_timeout=${timeout}" ]; options.amazonImage = { name = mkOption { Loading Loading @@ -49,15 +60,19 @@ in { }; format = mkOption { type = types.enum [ "raw" "qcow2" "vpc" ]; type = types.enum [ "raw" "qcow2" "vpc" ]; default = "vpc"; description = "The image format to output"; }; }; config.system.build.amazonImage = let configFile = pkgs.writeText "configuration.nix" '' config.system.build.amazonImage = let configFile = pkgs.writeText "configuration.nix" '' { modulesPath, ... }: { imports = [ "''${modulesPath}/virtualisation/amazon-image.nix" ]; ${optionalString config.ec2.efi '' Loading @@ -71,7 +86,12 @@ in { ''; zfsBuilder = import ../../../lib/make-multi-disk-zfs-image.nix { inherit lib config configFile pkgs; inherit lib config configFile pkgs ; inherit (cfg) contents format name; includeChannel = true; Loading Loading @@ -119,7 +139,12 @@ in { }; extBuilder = import ../../../lib/make-disk-image.nix { inherit lib config configFile pkgs; inherit lib config configFile pkgs ; inherit (cfg) contents format name; Loading Loading @@ -154,7 +179,8 @@ in { ' > $out/nix-support/image-info.json ''; }; in if config.ec2.zfs.enable then zfsBuilder else extBuilder; in if config.ec2.zfs.enable then zfsBuilder else extBuilder; meta.maintainers = with lib.maintainers; [ arianvp ]; } nixos/maintainers/scripts/openstack/openstack-image-zfs.nix +16 −10 Original line number Diff line number Diff line # nix-build '<nixpkgs/nixos>' -A config.system.build.openstackImage --arg configuration "{ imports = [ ./nixos/maintainers/scripts/openstack/openstack-image.nix ]; }" { config, lib, pkgs, ... }: { config, lib, pkgs, ... }: let inherit (lib) mkOption types; copyChannel = true; Loading @@ -12,7 +17,6 @@ in ../../../modules/virtualisation/openstack-config.nix ] ++ (lib.optional copyChannel ../../../modules/installer/cd-dvd/channel.nix); options.openstackImage = { name = mkOption { type = types.str; Loading @@ -33,7 +37,10 @@ in }; format = mkOption { type = types.enum [ "raw" "qcow2" ]; type = types.enum [ "raw" "qcow2" ]; default = "qcow2"; description = "The image format to output"; }; Loading @@ -59,8 +66,7 @@ in inherit (cfg) contents format name; pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package configFile = pkgs.writeText "configuration.nix" '' configFile = pkgs.writeText "configuration.nix" '' { modulesPath, ... }: { imports = [ "''${modulesPath}/virtualisation/openstack-config.nix" ]; openstack.zfs.enable = true; Loading nixos/modules/virtualisation/azure-image.nix +12 −2 Original line number Diff line number Diff line { config, lib, pkgs, ... }: { config, lib, pkgs, ... }: with lib; let Loading Loading @@ -35,7 +40,12 @@ in }; vmGeneration = mkOption { type = with types; enum [ "v1" "v2" ]; type = with types; enum [ "v1" "v2" ]; default = "v1"; description = '' VM Generation to use. Loading nixos/modules/virtualisation/digital-ocean-image.nix +31 −14 Original line number Diff line number Diff line { config, lib, pkgs, ... }: { config, lib, pkgs, ... }: with lib; let Loading Loading @@ -31,7 +36,10 @@ in }; virtualisation.digitalOceanImage.compressionMethod = mkOption { type = types.enum [ "gzip" "bzip2" ]; type = types.enum [ "gzip" "bzip2" ]; default = "gzip"; example = "bzip2"; description = '' Loading @@ -48,23 +56,32 @@ in system.build.digitalOceanImage = import ../../lib/make-disk-image.nix { name = "digital-ocean-image"; format = "qcow2"; postVM = let compress = { postVM = let compress = { "gzip" = "${pkgs.gzip}/bin/gzip"; "bzip2" = "${pkgs.bzip2}/bin/bzip2"; }.${cfg.compressionMethod}; in '' } .${cfg.compressionMethod}; in '' ${compress} $diskImage ''; configFile = if cfg.configFile == null then config.virtualisation.digitalOcean.defaultConfigFile else cfg.configFile; configFile = if cfg.configFile == null then config.virtualisation.digitalOcean.defaultConfigFile else cfg.configFile; inherit (cfg) diskSize; inherit config lib pkgs; }; }; meta.maintainers = with maintainers; [ arianvp eamsden ]; meta.maintainers = with maintainers; [ arianvp eamsden ]; } nixos/modules/virtualisation/google-compute-image.nix +13 −2 Original line number Diff line number Diff line { config, lib, pkgs, ... }: { config, lib, pkgs, ... }: with lib; let Loading Loading @@ -64,7 +69,13 @@ in system.build.googleComputeImage = import ../../lib/make-disk-image.nix { name = "google-compute-image"; postVM = '' PATH=$PATH:${with pkgs; lib.makeBinPath [ gnutar gzip ]} PATH=$PATH:${ with pkgs; lib.makeBinPath [ gnutar gzip ] } pushd $out mv $diskImage disk.raw tar -Sc disk.raw | gzip -${toString cfg.compressionLevel} > \ Loading Loading
nixos/maintainers/scripts/ec2/amazon-image.nix +122 −96 Original line number Diff line number Diff line { config, lib, pkgs, ... }: { config, lib, pkgs, ... }: let inherit (lib) mkOption optionalString types versionAtLeast; inherit (lib) mkOption optionalString types versionAtLeast ; inherit (lib.options) literalExpression; cfg = config.amazonImage; amiBootMode = if config.ec2.efi then "uefi" else "legacy-bios"; in { in { imports = [ ../../../modules/virtualisation/amazon-image.nix ]; Loading @@ -14,11 +25,11 @@ in { # experience, which prior to 4.15 was 255. # https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nvme-ebs-volumes.html#timeout-nvme-ebs-volumes config.boot.kernelParams = let timeout = if versionAtLeast config.boot.kernelPackages.kernel.version "4.15" then "4294967295" else "255"; in [ "nvme_core.io_timeout=${timeout}" ]; let timeout = if versionAtLeast config.boot.kernelPackages.kernel.version "4.15" then "4294967295" else "255"; in [ "nvme_core.io_timeout=${timeout}" ]; options.amazonImage = { name = mkOption { Loading Loading @@ -49,15 +60,19 @@ in { }; format = mkOption { type = types.enum [ "raw" "qcow2" "vpc" ]; type = types.enum [ "raw" "qcow2" "vpc" ]; default = "vpc"; description = "The image format to output"; }; }; config.system.build.amazonImage = let configFile = pkgs.writeText "configuration.nix" '' config.system.build.amazonImage = let configFile = pkgs.writeText "configuration.nix" '' { modulesPath, ... }: { imports = [ "''${modulesPath}/virtualisation/amazon-image.nix" ]; ${optionalString config.ec2.efi '' Loading @@ -71,7 +86,12 @@ in { ''; zfsBuilder = import ../../../lib/make-multi-disk-zfs-image.nix { inherit lib config configFile pkgs; inherit lib config configFile pkgs ; inherit (cfg) contents format name; includeChannel = true; Loading Loading @@ -119,7 +139,12 @@ in { }; extBuilder = import ../../../lib/make-disk-image.nix { inherit lib config configFile pkgs; inherit lib config configFile pkgs ; inherit (cfg) contents format name; Loading Loading @@ -154,7 +179,8 @@ in { ' > $out/nix-support/image-info.json ''; }; in if config.ec2.zfs.enable then zfsBuilder else extBuilder; in if config.ec2.zfs.enable then zfsBuilder else extBuilder; meta.maintainers = with lib.maintainers; [ arianvp ]; }
nixos/maintainers/scripts/openstack/openstack-image-zfs.nix +16 −10 Original line number Diff line number Diff line # nix-build '<nixpkgs/nixos>' -A config.system.build.openstackImage --arg configuration "{ imports = [ ./nixos/maintainers/scripts/openstack/openstack-image.nix ]; }" { config, lib, pkgs, ... }: { config, lib, pkgs, ... }: let inherit (lib) mkOption types; copyChannel = true; Loading @@ -12,7 +17,6 @@ in ../../../modules/virtualisation/openstack-config.nix ] ++ (lib.optional copyChannel ../../../modules/installer/cd-dvd/channel.nix); options.openstackImage = { name = mkOption { type = types.str; Loading @@ -33,7 +37,10 @@ in }; format = mkOption { type = types.enum [ "raw" "qcow2" ]; type = types.enum [ "raw" "qcow2" ]; default = "qcow2"; description = "The image format to output"; }; Loading @@ -59,8 +66,7 @@ in inherit (cfg) contents format name; pkgs = import ../../../.. { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package configFile = pkgs.writeText "configuration.nix" '' configFile = pkgs.writeText "configuration.nix" '' { modulesPath, ... }: { imports = [ "''${modulesPath}/virtualisation/openstack-config.nix" ]; openstack.zfs.enable = true; Loading
nixos/modules/virtualisation/azure-image.nix +12 −2 Original line number Diff line number Diff line { config, lib, pkgs, ... }: { config, lib, pkgs, ... }: with lib; let Loading Loading @@ -35,7 +40,12 @@ in }; vmGeneration = mkOption { type = with types; enum [ "v1" "v2" ]; type = with types; enum [ "v1" "v2" ]; default = "v1"; description = '' VM Generation to use. Loading
nixos/modules/virtualisation/digital-ocean-image.nix +31 −14 Original line number Diff line number Diff line { config, lib, pkgs, ... }: { config, lib, pkgs, ... }: with lib; let Loading Loading @@ -31,7 +36,10 @@ in }; virtualisation.digitalOceanImage.compressionMethod = mkOption { type = types.enum [ "gzip" "bzip2" ]; type = types.enum [ "gzip" "bzip2" ]; default = "gzip"; example = "bzip2"; description = '' Loading @@ -48,23 +56,32 @@ in system.build.digitalOceanImage = import ../../lib/make-disk-image.nix { name = "digital-ocean-image"; format = "qcow2"; postVM = let compress = { postVM = let compress = { "gzip" = "${pkgs.gzip}/bin/gzip"; "bzip2" = "${pkgs.bzip2}/bin/bzip2"; }.${cfg.compressionMethod}; in '' } .${cfg.compressionMethod}; in '' ${compress} $diskImage ''; configFile = if cfg.configFile == null then config.virtualisation.digitalOcean.defaultConfigFile else cfg.configFile; configFile = if cfg.configFile == null then config.virtualisation.digitalOcean.defaultConfigFile else cfg.configFile; inherit (cfg) diskSize; inherit config lib pkgs; }; }; meta.maintainers = with maintainers; [ arianvp eamsden ]; meta.maintainers = with maintainers; [ arianvp eamsden ]; }
nixos/modules/virtualisation/google-compute-image.nix +13 −2 Original line number Diff line number Diff line { config, lib, pkgs, ... }: { config, lib, pkgs, ... }: with lib; let Loading Loading @@ -64,7 +69,13 @@ in system.build.googleComputeImage = import ../../lib/make-disk-image.nix { name = "google-compute-image"; postVM = '' PATH=$PATH:${with pkgs; lib.makeBinPath [ gnutar gzip ]} PATH=$PATH:${ with pkgs; lib.makeBinPath [ gnutar gzip ] } pushd $out mv $diskImage disk.raw tar -Sc disk.raw | gzip -${toString cfg.compressionLevel} > \ Loading