Unverified Commit 68116591 authored by github-actions[bot]'s avatar github-actions[bot] Committed by GitHub
Browse files

Merge master into staging-next

parents a90b3d5d dbb88284
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -10154,12 +10154,6 @@
    githubId = 57130301;
    keys = [ { fingerprint = "1CC5 B67C EB9A 13A5 EDF6 F10E 0B4A 3662 FC58 9202"; } ];
  };
  jonafato = {
    email = "jon@jonafato.com";
    github = "jonafato";
    githubId = 392720;
    name = "Jon Banafato";
  };
  jonas-w = {
    email = "nixpkgs@03j.de";
    github = "jonas-w";
@@ -16250,6 +16244,11 @@
    githubId = 13309623;
    name = "Philipp Herzog";
  };
  PhilVoel = {
    github = "PhilVoel";
    githubId = 56931301;
    name = "Philipp Völler";
  };
  phip1611 = {
    email = "phip1611@gmail.com";
    github = "phip1611";
+143 −106
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 {

  imports = [ ../../../modules/virtualisation/amazon-image.nix ];
  virtualisationOptions = import ../../../modules/virtualisation/virtualisation-options.nix;

in
{
  imports = [
    ../../../modules/virtualisation/amazon-image.nix
    virtualisationOptions.diskSize
    (lib.mkRenamedOptionModuleWith {
      sinceRelease = 2411;
      from = [
        "virtualisation"
        "amazonImage"
        "sizeMB"
      ];
      to = [
        "virtualisation"
        "diskSize"
      ];
    })
  ];

  # Amazon recommends setting this to the highest possible value for a good EBS
  # 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 {
@@ -41,23 +67,23 @@ in {
      '';
    };

    sizeMB = mkOption {
      type = with types; either (enum [ "auto" ]) int;
      default = 3072;
      example = 8192;
      description = "The size in MB of the image";
    };

    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.virtualisation.diskSize = lib.mkDefault (3 * 1024);
  config.virtualisation.diskSizeAutoSupported = !config.ec2.zfs.enable;

  config.system.build.amazonImage =
    let
      configFile = pkgs.writeText "configuration.nix" ''
        { modulesPath, ... }: {
          imports = [ "''${modulesPath}/virtualisation/amazon-image.nix" ];
          ${optionalString config.ec2.efi ''
@@ -71,14 +97,19 @@ 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;

        bootSize = 1000; # 1G is the minimum EBS volume

      rootSize = cfg.sizeMB;
        rootSize = config.virtualisation.diskSize;
        rootPoolProperties = {
          ashift = 12;
          autoexpand = "on";
@@ -119,14 +150,19 @@ in {
      };

      extBuilder = import ../../../lib/make-disk-image.nix {
      inherit lib config configFile pkgs;
        inherit
          lib
          config
          configFile
          pkgs
          ;

        inherit (cfg) contents format name;

        fsType = "ext4";
        partitionTableType = if config.ec2.efi then "efi" else "legacy+gpt";

      diskSize = cfg.sizeMB;
        inherit (config.virtualisation) diskSize;

        postVM = ''
           extension=''${diskImage##*.}
@@ -154,7 +190,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 ];
}
+36 −18
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;
  cfg = config.openstackImage;
  imageBootMode = if config.openstack.efi then "uefi" else "legacy-bios";
  virtualisationOptions = import ../../../modules/virtualisation/virtualisation-options.nix;
in
{
  imports = [
    ../../../modules/virtualisation/openstack-config.nix
  ] ++ (lib.optional copyChannel ../../../modules/installer/cd-dvd/channel.nix);
    virtualisationOptions.diskSize
    (lib.mkRenamedOptionModuleWith {
      sinceRelease = 2411;
      from = [
        "virtualisation"
        "openstackImage"
        "sizeMB"
      ];
      to = [
        "virtualisation"
        "diskSize"
      ];
    })

  ] ++ (lib.optional copyChannel ../../../modules/installer/cd-dvd/channel.nix);

  options.openstackImage = {
    name = mkOption {
@@ -22,18 +41,15 @@ in

    ramMB = mkOption {
      type = types.int;
      default = 1024;
      default = (3 * 1024);
      description = "RAM allocation for build VM";
    };

    sizeMB = mkOption {
      type = types.int;
      default = 8192;
      description = "The size in MB of the image";
    };

    format = mkOption {
      type = types.enum [ "raw" "qcow2" ];
      type = types.enum [
        "raw"
        "qcow2"
      ];
      default = "qcow2";
      description = "The image format to output";
    };
@@ -54,13 +70,15 @@ in
      };
    };

    virtualisation.diskSize = lib.mkDefault (8 * 1024);
    virtualisation.diskSizeAutoSupported = false;

    system.build.openstackImage = import ../../../lib/make-single-disk-zfs-image.nix {
      inherit lib config;
      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;
@@ -71,7 +89,7 @@ in

      bootSize = 1000;
      memSize = cfg.ramMB;
      rootSize = cfg.sizeMB;
      rootSize = config.virtualisation.diskSize;
      rootPoolProperties = {
        ashift = 12;
        autoexpand = "on";
+66 −37
Original line number Diff line number Diff line
{ config, lib, options, ... }:
{
  config,
  lib,
  options,
  ...
}:

let
  keysDirectory = "/var/keys";
@@ -15,6 +20,19 @@ in
  imports = [
    ../virtualisation/qemu-vm.nix

    (lib.mkRenamedOptionModuleWith {
      sinceRelease = 2411;
      from = [
        "virtualisation"
        "darwin-builder"
        "diskSize"
      ];
      to = [
        "virtualisation"
        "diskSize"
      ];
    })

    # Avoid a dependency on stateVersion
    {
      disabledModules = [
@@ -23,17 +41,16 @@ in
      ];
      # swraid's default depends on stateVersion
      config.boot.swraid.enable = false;
      options.boot.isContainer = lib.mkOption { default = false; internal = true; };
      options.boot.isContainer = lib.mkOption {
        default = false;
        internal = true;
      };
    }
  ];

  options.virtualisation.description = "The maximum disk space allocated to the runner in megabytes";

  options.virtualisation.darwin-builder = with lib; {
    diskSize = mkOption {
      default = 20 * 1024;
      type = types.int;
      example = 30720;
      description = "The maximum disk space allocated to the runner in MB";
    };
    memorySize = mkOption {
      default = 3 * 1024;
      type = types.int;
@@ -158,13 +175,20 @@ in
        script = hostPkgs.writeShellScriptBin "create-builder" (
          ''
            set -euo pipefail
          '' +
          ''
          +
            # When running as non-interactively as part of a DarwinConfiguration the working directory
            # must be set to a writeable directory.
        (if cfg.workingDirectory != "." then ''
            (
              if cfg.workingDirectory != "." then
                ''
                  ${hostPkgs.coreutils}/bin/mkdir --parent "${cfg.workingDirectory}"
                  cd "${cfg.workingDirectory}"
        '' else "") + ''
                ''
              else
                ""
            )
          + ''
            KEYS="''${KEYS:-./keys}"
            ${hostPkgs.coreutils}/bin/mkdir --parent "''${KEYS}"
            PRIVATE_KEY="''${KEYS}/${user}_${keyType}"
@@ -177,7 +201,8 @@ in
              (set -x; sudo --reset-timestamp ${installCredentials} "''${KEYS}")
            fi
            KEYS="$(${hostPkgs.nix}/bin/nix-store --add "$KEYS")" ${lib.getExe config.system.build.vm}
        '');
          ''
        );

      in
      script.overrideAttrs (old: {
@@ -223,12 +248,16 @@ in
    '';

    virtualisation = {
      diskSize = cfg.diskSize;
      diskSize = lib.mkDefault (20 * 1024);

      memorySize = cfg.memorySize;

      forwardPorts = [
        { from = "host"; guest.port = 22; host.port = cfg.hostPort; }
        {
          from = "host";
          guest.port = 22;
          host.port = cfg.hostPort;
        }
      ];

      # Disable graphics for the builder since users will likely want to run it
+0 −1
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@ let

  env =
    { NIX_REMOTE = "daemon";
      SSL_CERT_FILE = "/etc/ssl/certs/ca-certificates.crt"; # Remove in 16.03
      PGPASSFILE = "${baseDir}/pgpass";
      NIX_REMOTE_SYSTEMS = lib.concatStringsSep ":" cfg.buildMachinesFiles;
    } // lib.optionalAttrs (cfg.smtpHost != null) {
Loading