summary refs log tree commit diff
path: root/nixos/modules/services/system/cloud-init.nix
diff options
context:
space:
mode:
authorillustris <rharikrishnan95@gmail.com>2022-01-28 19:16:29 +0530
committerillustris <rharikrishnan95@gmail.com>2022-01-31 09:50:23 +0530
commit43cfb7204bbd360f81f3a595451ac4725379e3e8 (patch)
tree6da58e7ed72fc67a6b9aa0c3a4e775e511fbc944 /nixos/modules/services/system/cloud-init.nix
parentd0c12f5b3f03c03f9c89efa581c633219f66ae9a (diff)
downloadnixpkgs-43cfb7204bbd360f81f3a595451ac4725379e3e8.tar
nixpkgs-43cfb7204bbd360f81f3a595451ac4725379e3e8.tar.gz
nixpkgs-43cfb7204bbd360f81f3a595451ac4725379e3e8.tar.bz2
nixpkgs-43cfb7204bbd360f81f3a595451ac4725379e3e8.tar.lz
nixpkgs-43cfb7204bbd360f81f3a595451ac4725379e3e8.tar.xz
nixpkgs-43cfb7204bbd360f81f3a595451ac4725379e3e8.tar.zst
nixpkgs-43cfb7204bbd360f81f3a595451ac4725379e3e8.zip
nixos/cloud-init: add support for network configuration
Diffstat (limited to 'nixos/modules/services/system/cloud-init.nix')
-rw-r--r--nixos/modules/services/system/cloud-init.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/nixos/modules/services/system/cloud-init.nix b/nixos/modules/services/system/cloud-init.nix
index eb82b738e49..d05dfcfc42d 100644
--- a/nixos/modules/services/system/cloud-init.nix
+++ b/nixos/modules/services/system/cloud-init.nix
@@ -52,11 +52,22 @@ in
         '';
       };
 
+      network.enable = mkOption {
+        type = types.bool;
+        default = false;
+        description = ''
+          Allow the cloud-init service to configure network interfaces
+          through systemd-networkd.
+        '';
+      };
+
       config = mkOption {
         type = types.str;
         default = ''
           system_info:
             distro: nixos
+            network:
+              renderers: [ 'networkd' ]
           users:
              - root
 
@@ -109,9 +120,12 @@ in
 
     environment.etc."cloud/cloud.cfg".text = cfg.config;
 
+    systemd.network.enable = cfg.network.enable;
+
     systemd.services.cloud-init-local =
       { description = "Initial cloud-init job (pre-networking)";
         wantedBy = [ "multi-user.target" ];
+        before = ["systemd-networkd.service"];
         path = path;
         serviceConfig =
           { Type = "oneshot";