summary refs log tree commit diff
path: root/nixos/modules/virtualisation/ec2-data.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-05-04 16:56:46 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-05-04 16:56:46 +0200
commit4239e276ea0c0604ad1de38c46e3a615ae535222 (patch)
tree9363fae3ed6f7e8dea53da1d242b3e20698212e9 /nixos/modules/virtualisation/ec2-data.nix
parent63efc2ee3877f9da46455445ef6827d192fcdfe7 (diff)
downloadnixlib-4239e276ea0c0604ad1de38c46e3a615ae535222.tar
nixlib-4239e276ea0c0604ad1de38c46e3a615ae535222.tar.gz
nixlib-4239e276ea0c0604ad1de38c46e3a615ae535222.tar.bz2
nixlib-4239e276ea0c0604ad1de38c46e3a615ae535222.tar.lz
nixlib-4239e276ea0c0604ad1de38c46e3a615ae535222.tar.xz
nixlib-4239e276ea0c0604ad1de38c46e3a615ae535222.tar.zst
nixlib-4239e276ea0c0604ad1de38c46e3a615ae535222.zip
fetch-ec2-data: Don't restart
This service only needs to run once on system startup, so it doesn't
need to be restarted by switch-to-configuration.
Diffstat (limited to 'nixos/modules/virtualisation/ec2-data.nix')
-rw-r--r--nixos/modules/virtualisation/ec2-data.nix12
1 files changed, 8 insertions, 4 deletions
diff --git a/nixos/modules/virtualisation/ec2-data.nix b/nixos/modules/virtualisation/ec2-data.nix
index 15114b1e76ac..b21c6bfbc0be 100644
--- a/nixos/modules/virtualisation/ec2-data.nix
+++ b/nixos/modules/virtualisation/ec2-data.nix
@@ -35,8 +35,8 @@ with lib;
 
             wget="wget -q --retry-connrefused -O -"
 
-            echo "setting host name..."
             ${optionalString (config.networking.hostName == "") ''
+              echo "setting host name..."
               ${pkgs.nettools}/bin/hostname $($wget http://169.254.169.254/1.0/meta-data/hostname)
             ''}
 
@@ -69,14 +69,18 @@ with lib;
             fi
 
             ${optionalString (! config.ec2.metadata) ''
-            # Since the user data is sensitive, prevent it from being
-            # accessed from now on.
-            ip route add blackhole 169.254.169.254/32
+              # Since the user data is sensitive, prevent it from
+              # being accessed from now on. FIXME: remove at some
+              # point, since current NixOps no longer relies on
+              # metadata secrecy.
+              ip route add blackhole 169.254.169.254/32
             ''}
           '';
 
         serviceConfig.Type = "oneshot";
         serviceConfig.RemainAfterExit = true;
+
+        restartIfChanged = false;
       };
 
     systemd.services."print-host-key" =