diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2016-04-07 14:35:03 +0200 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2016-04-07 14:40:51 +0200 |
commit | d1df28f8e5b98be01417ffc1032020415390f2a0 (patch) | |
tree | 0e2024acd74c6ce3fb4614eadb04abe632835f71 /nixos/modules/virtualisation | |
parent | 056b5a1a5f2a4096dd39db2265e5ca369c03ec15 (diff) | |
parent | c55cfe0cb3425fb926219cf7dde8714f3d143744 (diff) | |
download | nixlib-d1df28f8e5b98be01417ffc1032020415390f2a0.tar nixlib-d1df28f8e5b98be01417ffc1032020415390f2a0.tar.gz nixlib-d1df28f8e5b98be01417ffc1032020415390f2a0.tar.bz2 nixlib-d1df28f8e5b98be01417ffc1032020415390f2a0.tar.lz nixlib-d1df28f8e5b98be01417ffc1032020415390f2a0.tar.xz nixlib-d1df28f8e5b98be01417ffc1032020415390f2a0.tar.zst nixlib-d1df28f8e5b98be01417ffc1032020415390f2a0.zip |
Merge 'staging' into closure-size
This is mainly to get the update of bootstrap tools. Otherwise there were mysterious segfaults: https://github.com/NixOS/nixpkgs/pull/7701#issuecomment-203389817
Diffstat (limited to 'nixos/modules/virtualisation')
-rw-r--r-- | nixos/modules/virtualisation/amazon-grow-partition.nix | 30 | ||||
-rw-r--r-- | nixos/modules/virtualisation/amazon-image.nix | 3 | ||||
-rw-r--r-- | nixos/modules/virtualisation/ec2-amis.nix | 92 | ||||
-rw-r--r-- | nixos/modules/virtualisation/growpart-util-linux-2.26.patch | 88 | ||||
-rw-r--r-- | nixos/modules/virtualisation/xe-guest-utilities.nix | 52 |
5 files changed, 147 insertions, 118 deletions
diff --git a/nixos/modules/virtualisation/amazon-grow-partition.nix b/nixos/modules/virtualisation/amazon-grow-partition.nix index 44a9fa93e7ec..69b80d900bad 100644 --- a/nixos/modules/virtualisation/amazon-grow-partition.nix +++ b/nixos/modules/virtualisation/amazon-grow-partition.nix @@ -4,37 +4,13 @@ { config, lib, pkgs, ... }: -with lib; - -let - - growpart = pkgs.stdenv.mkDerivation { - name = "growpart"; - src = pkgs.fetchurl { - url = "https://launchpad.net/cloud-utils/trunk/0.27/+download/cloud-utils-0.27.tar.gz"; - sha256 = "16shlmg36lidp614km41y6qk3xccil02f5n3r4wf6d1zr5n4v8vd"; - }; - patches = [ ./growpart-util-linux-2.26.patch ]; - buildPhase = '' - cp bin/growpart $out - sed -i 's|awk|gawk|' $out - sed -i 's|sed|gnused|' $out - ''; - dontInstall = true; - dontPatchShebangs = true; - }; - -in - { - - config = mkIf config.ec2.hvm { - + config = lib.mkIf config.ec2.hvm { boot.initrd.extraUtilsCommands = '' copy_bin_and_libs ${pkgs.gawk}/bin/gawk copy_bin_and_libs ${pkgs.gnused}/bin/sed copy_bin_and_libs ${pkgs.utillinux}/sbin/sfdisk - cp -v ${growpart} $out/bin/growpart + cp -v ${pkgs.cloud-utils}/bin/growpart $out/bin/growpart ln -s sed $out/bin/gnused ''; @@ -44,7 +20,5 @@ in udevadm settle fi ''; - }; - } diff --git a/nixos/modules/virtualisation/amazon-image.nix b/nixos/modules/virtualisation/amazon-image.nix index 35af905bc628..5d99bccb0e93 100644 --- a/nixos/modules/virtualisation/amazon-image.nix +++ b/nixos/modules/virtualisation/amazon-image.nix @@ -65,8 +65,7 @@ let cfg = config.ec2; in fi if ! [ -e "$metaDir/user-data" ]; then - wget -q -O "$metaDir/user-data" http://169.254.169.254/1.0/user-data - chmod 600 "$metaDir/user-data" + wget -q -O "$metaDir/user-data" http://169.254.169.254/1.0/user-data && chmod 600 "$metaDir/user-data" fi if ! [ -e "$metaDir/hostname" ]; then diff --git a/nixos/modules/virtualisation/ec2-amis.nix b/nixos/modules/virtualisation/ec2-amis.nix new file mode 100644 index 000000000000..15ea7bb19448 --- /dev/null +++ b/nixos/modules/virtualisation/ec2-amis.nix @@ -0,0 +1,92 @@ +{ + "14.04".ap-northeast-1.hvm-ebs = "ami-71c6f470"; + "14.04".ap-northeast-1.pv-ebs = "ami-4dcbf84c"; + "14.04".ap-northeast-1.pv-s3 = "ami-8fc4f68e"; + "14.04".ap-southeast-1.hvm-ebs = "ami-da280888"; + "14.04".ap-southeast-1.pv-ebs = "ami-7a9dbc28"; + "14.04".ap-southeast-1.pv-s3 = "ami-c4290996"; + "14.04".ap-southeast-2.hvm-ebs = "ami-ab523e91"; + "14.04".ap-southeast-2.pv-ebs = "ami-6769055d"; + "14.04".ap-southeast-2.pv-s3 = "ami-15533f2f"; + "14.04".eu-central-1.hvm-ebs = "ami-ba0234a7"; + "14.04".eu-west-1.hvm-ebs = "ami-96cb63e1"; + "14.04".eu-west-1.pv-ebs = "ami-b48c25c3"; + "14.04".eu-west-1.pv-s3 = "ami-06cd6571"; + "14.04".sa-east-1.hvm-ebs = "ami-01b90e1c"; + "14.04".sa-east-1.pv-ebs = "ami-69e35474"; + "14.04".sa-east-1.pv-s3 = "ami-61b90e7c"; + "14.04".us-east-1.hvm-ebs = "ami-58ba3a30"; + "14.04".us-east-1.pv-ebs = "ami-9e0583f6"; + "14.04".us-east-1.pv-s3 = "ami-9cbe3ef4"; + "14.04".us-west-1.hvm-ebs = "ami-0bc3d74e"; + "14.04".us-west-1.pv-ebs = "ami-8b1703ce"; + "14.04".us-west-1.pv-s3 = "ami-27ccd862"; + "14.04".us-west-2.hvm-ebs = "ami-3bf1bf0b"; + "14.04".us-west-2.pv-ebs = "ami-259bd515"; + "14.04".us-west-2.pv-s3 = "ami-07094037"; + + "14.12".ap-northeast-1.hvm-ebs = "ami-24435f25"; + "14.12".ap-northeast-1.pv-ebs = "ami-b0425eb1"; + "14.12".ap-northeast-1.pv-s3 = "ami-fed3c6ff"; + "14.12".ap-southeast-1.hvm-ebs = "ami-6c765d3e"; + "14.12".ap-southeast-1.pv-ebs = "ami-6a765d38"; + "14.12".ap-southeast-1.pv-s3 = "ami-d1bf9183"; + "14.12".ap-southeast-2.hvm-ebs = "ami-af86f395"; + "14.12".ap-southeast-2.pv-ebs = "ami-b386f389"; + "14.12".ap-southeast-2.pv-s3 = "ami-69c5ae53"; + "14.12".eu-central-1.hvm-ebs = "ami-4a497a57"; + "14.12".eu-central-1.pv-ebs = "ami-4c497a51"; + "14.12".eu-central-1.pv-s3 = "ami-60f2c27d"; + "14.12".eu-west-1.hvm-ebs = "ami-d126a5a6"; + "14.12".eu-west-1.pv-ebs = "ami-0126a576"; + "14.12".eu-west-1.pv-s3 = "ami-deda5fa9"; + "14.12".sa-east-1.hvm-ebs = "ami-2d239e30"; + "14.12".sa-east-1.pv-ebs = "ami-35239e28"; + "14.12".sa-east-1.pv-s3 = "ami-81e3519c"; + "14.12".us-east-1.hvm-ebs = "ami-0c463a64"; + "14.12".us-east-1.pv-ebs = "ami-ac473bc4"; + "14.12".us-east-1.pv-s3 = "ami-00e18a68"; + "14.12".us-west-1.hvm-ebs = "ami-ca534a8f"; + "14.12".us-west-1.pv-ebs = "ami-3e534a7b"; + "14.12".us-west-1.pv-s3 = "ami-2905196c"; + "14.12".us-west-2.hvm-ebs = "ami-fb9dc3cb"; + "14.12".us-west-2.pv-ebs = "ami-899dc3b9"; + "14.12".us-west-2.pv-s3 = "ami-cb7f2dfb"; + + "15.09".ap-northeast-1.hvm-ebs = "ami-58cac236"; + "15.09".ap-northeast-1.hvm-s3 = "ami-39c8c057"; + "15.09".ap-northeast-1.pv-ebs = "ami-5ac9c134"; + "15.09".ap-northeast-1.pv-s3 = "ami-03cec66d"; + "15.09".ap-southeast-1.hvm-ebs = "ami-2fc2094c"; + "15.09".ap-southeast-1.hvm-s3 = "ami-9ec308fd"; + "15.09".ap-southeast-1.pv-ebs = "ami-95c00bf6"; + "15.09".ap-southeast-1.pv-s3 = "ami-bfc00bdc"; + "15.09".ap-southeast-2.hvm-ebs = "ami-996c4cfa"; + "15.09".ap-southeast-2.hvm-s3 = "ami-3f6e4e5c"; + "15.09".ap-southeast-2.pv-ebs = "ami-066d4d65"; + "15.09".ap-southeast-2.pv-s3 = "ami-cc6e4eaf"; + "15.09".eu-central-1.hvm-ebs = "ami-3f8c6b50"; + "15.09".eu-central-1.hvm-s3 = "ami-5b836434"; + "15.09".eu-central-1.pv-ebs = "ami-118c6b7e"; + "15.09".eu-central-1.pv-s3 = "ami-2c977043"; + "15.09".eu-west-1.hvm-ebs = "ami-9cf04aef"; + "15.09".eu-west-1.hvm-s3 = "ami-2bea5058"; + "15.09".eu-west-1.pv-ebs = "ami-c9e852ba"; + "15.09".eu-west-1.pv-s3 = "ami-c6f64cb5"; + "15.09".sa-east-1.hvm-ebs = "ami-6e52df02"; + "15.09".sa-east-1.hvm-s3 = "ami-1852df74"; + "15.09".sa-east-1.pv-ebs = "ami-4368e52f"; + "15.09".sa-east-1.pv-s3 = "ami-f15ad79d"; + "15.09".us-east-1.hvm-ebs = "ami-84a6a0ee"; + "15.09".us-east-1.hvm-s3 = "ami-06a7a16c"; + "15.09".us-east-1.pv-ebs = "ami-a4a1a7ce"; + "15.09".us-east-1.pv-s3 = "ami-5ba8ae31"; + "15.09".us-west-1.hvm-ebs = "ami-22c8bb42"; + "15.09".us-west-1.hvm-s3 = "ami-a2ccbfc2"; + "15.09".us-west-1.pv-ebs = "ami-10cebd70"; + "15.09".us-west-1.pv-s3 = "ami-fa30429a"; + "15.09".us-west-2.hvm-ebs = "ami-ce57b9ae"; + "15.09".us-west-2.hvm-s3 = "ami-2956b849"; + "15.09".us-west-2.pv-ebs = "ami-005fb160"; + "15.09".us-west-2.pv-s3 = "ami-cd55bbad"; +} diff --git a/nixos/modules/virtualisation/growpart-util-linux-2.26.patch b/nixos/modules/virtualisation/growpart-util-linux-2.26.patch deleted file mode 100644 index c782c2d7e4bd..000000000000 --- a/nixos/modules/virtualisation/growpart-util-linux-2.26.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 1895d10a7539d055a4e0206af1e7a9e5ea32a4f7 Mon Sep 17 00:00:00 2001 -From: Juerg Haefliger <juerg.haefliger@hp.com> -Date: Wed, 25 Mar 2015 13:59:20 +0100 -Subject: [PATCH] Support new sfdisk version 2.26 - -The sfdisk usage with version 2.26 changed. Specifically, the option ---show-pt-geometry and functionality for CHS have been removed. -Also, restoring a backup MBR now needs to be done using dd. ---- - bin/growpart | 28 ++++++++++------------------ - 1 file changed, 10 insertions(+), 18 deletions(-) - -diff --git a/bin/growpart b/bin/growpart -index 595c40b..d4c995b 100755 ---- a/bin/growpart -+++ b/bin/growpart -@@ -28,7 +28,6 @@ PART="" - PT_UPDATE=false - DRY_RUN=0 - --MBR_CHS="" - MBR_BACKUP="" - GPT_BACKUP="" - _capture="" -@@ -133,7 +132,8 @@ bad_Usage() { - } - - mbr_restore() { -- sfdisk --no-reread "${DISK}" ${MBR_CHS} -I "${MBR_BACKUP}" -+ dd if="${MBR_BACKUP}-${DISK#/dev/}-0x00000000.bak" of="${DISK}" bs=1 \ -+ conv=notrunc - } - - sfdisk_worked_but_blkrrpart_failed() { -@@ -148,34 +148,26 @@ sfdisk_worked_but_blkrrpart_failed() { - - mbr_resize() { - RESTORE_HUMAN="${TEMP_D}/recovery" -- MBR_BACKUP="${TEMP_D}/orig.save" -+ MBR_BACKUP="${TEMP_D}/backup" - - local change_out=${TEMP_D}/change.out - local dump_out=${TEMP_D}/dump.out - local new_out=${TEMP_D}/new.out - local dump_mod=${TEMP_D}/dump.mod -- local tmp="${TEMP_D}/tmp.out" -- local err="${TEMP_D}/err.out" - -- local _devc cyl _w1 heads _w2 sectors _w3 tot dpart -+ local tot dpart - local pt_start pt_size pt_end max_end new_size change_info - -- # --show-pt-geometry outputs something like -- # /dev/sda: 164352 cylinders, 4 heads, 32 sectors/track -- rqe sfd_geom sfdisk "${DISK}" --show-pt-geometry >"${tmp}" && -- read _devc cyl _w1 heads _w2 sectors _w3 <"${tmp}" && -- MBR_CHS="-C ${cyl} -H ${heads} -S ${sectors}" || -- fail "failed to get CHS from ${DISK}" -+ tot=$(sfdisk --list "${DISK}" | awk '{ print $(NF-1) ; exit }') || -+ fail "failed to get total number of sectors from ${DISK}" - -- tot=$((${cyl}*${heads}*${sectors})) -+ debug 1 "total number of sectors of ${DISK} is ${tot}" - -- debug 1 "geometry is ${MBR_CHS}. total size=${tot}" -- rqe sfd_dump sfdisk ${MBR_CHS} --unit=S --dump "${DISK}" \ -+ rqe sfd_dump sfdisk --dump "${DISK}" \ - >"${dump_out}" || - fail "failed to dump sfdisk info for ${DISK}" -- - { -- echo "## sfdisk ${MBR_CHS} --unit=S --dump ${DISK}" -+ echo "## sfdisk --dump ${DISK}" - cat "${dump_out}" - } >"${RESTORE_HUMAN}" - [ $? -eq 0 ] || fail "failed to save sfdisk -d output" -@@ -237,7 +229,7 @@ mbr_resize() { - exit 0 - fi - -- LANG=C sfdisk --no-reread "${DISK}" ${MBR_CHS} --force \ -+ LANG=C sfdisk --no-reread "${DISK}" --force \ - -O "${MBR_BACKUP}" <"${new_out}" >"${change_out}" 2>&1 - ret=$? - [ $ret -eq 0 ] || RESTORE_FUNC="mbr_restore" --- -2.1.4 - diff --git a/nixos/modules/virtualisation/xe-guest-utilities.nix b/nixos/modules/virtualisation/xe-guest-utilities.nix new file mode 100644 index 000000000000..d703353858c0 --- /dev/null +++ b/nixos/modules/virtualisation/xe-guest-utilities.nix @@ -0,0 +1,52 @@ +{ config, lib, pkgs, ... }: +with lib; +let + cfg = config.services.xe-guest-utilities; +in { + options = { + services.xe-guest-utilities = { + enable = mkEnableOption "Whether to enable the Xen guest utilities daemon."; + }; + }; + config = mkIf cfg.enable { + services.udev.packages = [ pkgs.xe-guest-utilities ]; + systemd.tmpfiles.rules = [ "d /run/xenstored 0755 - - -" ]; + + systemd.services.xe-daemon = { + description = "xen daemon file"; + wantedBy = [ "multi-user.target" ]; + after = [ "xe-linux-distribution.service" ]; + requires = [ "proc-xen.mount" ]; + path = [ pkgs.coreutils pkgs.iproute ]; + serviceConfig = { + PIDFile = "/run/xe-daemon.pid"; + ExecStart = "${pkgs.xe-guest-utilities}/bin/xe-daemon -p /run/xe-daemon.pid"; + ExecStop = "${pkgs.procps}/bin/pkill -TERM -F /run/xe-daemon.pid"; + }; + }; + + systemd.services.xe-linux-distribution = { + description = "xen linux distribution service"; + wantedBy = [ "multi-user.target" ]; + before = [ "xend.service" ]; + path = [ pkgs.xe-guest-utilities pkgs.coreutils pkgs.gawk pkgs.gnused ]; + serviceConfig = { + Type = "simple"; + RemainAfterExit = "yes"; + ExecStart = "${pkgs.xe-guest-utilities}/bin/xe-linux-distribution /var/cache/xe-linux-distribution"; + }; + }; + + systemd.mounts = [ + { description = "Mount /proc/xen files"; + what = "xenfs"; + where = "/proc/xen"; + type = "xenfs"; + unitConfig = { + ConditionPathExists = "/proc/xen"; + RefuseManualStop = "true"; + }; + } + ]; + }; +} |