diff options
author | Rob Vermaas <rob.vermaas@gmail.com> | 2013-11-07 14:42:44 +0000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-04-28 15:46:49 +0200 |
commit | de1c182b0ab3a0e0efe30ea9ac41934bd378eae5 (patch) | |
tree | 5ecf27115c1d30cd5f08d3e05a414b111ba9d175 /nixos/maintainers | |
parent | 17336efdd8fcfdb830429683684e167d6443bd11 (diff) |
Fix EC2 creation script for latest nixops
(cherry picked from commit 361eb3a5f50aba4ecfe08bf37640179dfc2e6453)
Diffstat (limited to 'nixos/maintainers')
-rw-r--r-- | nixos/maintainers/scripts/ec2/amazon-base-config.nix | 5 | ||||
-rwxr-xr-x | nixos/maintainers/scripts/ec2/create-ebs-amis.py | 10 |
2 files changed, 11 insertions, 4 deletions
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 0000000000000..d23f15e828b25 --- /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 eab111a2665b2..4e1aea659803a 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).split(' ')[0] |