diff --git a/nixos/maintainers/scripts/ec2/amazon-base-config.nix b/nixos/maintainers/scripts/ec2/amazon-base-config.nix new file mode 100644 index 000000000000..d23f15e828b2 --- /dev/null +++ b/nixos/maintainers/scripts/ec2/amazon-base-config.nix @@ -0,0 +1,5 @@ +{ modulesPath, ...}: +{ + imports = [ "${modulesPath}/virtualisation/amazon-config.nix" ]; + services.journald.rateLimitBurst = 0; +} diff --git a/nixos/maintainers/scripts/ec2/create-ebs-amis.py b/nixos/maintainers/scripts/ec2/create-ebs-amis.py index 93971ac9504d..e159d456b260 100755 --- a/nixos/maintainers/scripts/ec2/create-ebs-amis.py +++ b/nixos/maintainers/scripts/ec2/create-ebs-amis.py @@ -8,9 +8,11 @@ import nixops.util from nixops import deployment from boto.ec2.blockdevicemapping import BlockDeviceMapping, BlockDeviceType import boto.ec2 +from nixops.statefile import StateFile, get_default_state_file parser = argparse.ArgumentParser(description='Create an EBS-backed NixOS AMI') parser.add_argument('--region', dest='region', required=True, help='EC2 region to create the image in') +parser.add_argument('--channel', dest='channel', default="13.10", help='Channel to use') parser.add_argument('--keep', dest='keep', action='store_true', help='Keep NixOps machine after use') parser.add_argument('--hvm', dest='hvm', action='store_true', help='Create HVM image') parser.add_argument('--key', dest='key_name', action='store_true', help='Keypair used for HVM instance creation', default="rob") @@ -37,11 +39,11 @@ f.write('''{{ '''.format(args.region, ebs_size)) f.close() -db = deployment.open_database(deployment.get_default_state_file()) +db = StateFile(get_default_state_file()) try: - depl = deployment.open_deployment(db, "ebs-creator") + depl = db.open_deployment("ebs-creator") except Exception: - depl = deployment.create_deployment(db) + depl = db.create_deployment() depl.name = "ebs-creator" depl.auto_response = "y" depl.nix_exprs = [os.path.abspath("./ebs-creator.nix"), os.path.abspath("./ebs-creator-config.nix")] @@ -64,7 +66,7 @@ m.run_command("mkdir -p /mnt") m.run_command("mount {0} /mnt".format(device)) m.run_command("touch /mnt/.ebs") m.run_command("mkdir -p /mnt/etc/nixos") -m.run_command("nix-channel --add http://nixos.org/channels/nixos-unstable") +m.run_command("nix-channel --add http://nixos.org/channels/nixos-{} nixos".format(args.channel)) m.run_command("nix-channel --update") m.run_command("nixos-rebuild switch") version = m.run_command("nixos-version", capture_stdout=True).replace('"', '').rstrip()