about summary refs log tree commit diff
path: root/nixpkgs/nixos/modules/services/system/cloud-init.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/modules/services/system/cloud-init.nix')
-rw-r--r--nixpkgs/nixos/modules/services/system/cloud-init.nix28
1 files changed, 16 insertions, 12 deletions
diff --git a/nixpkgs/nixos/modules/services/system/cloud-init.nix b/nixpkgs/nixos/modules/services/system/cloud-init.nix
index 00ae77be4271..5d7258cac778 100644
--- a/nixpkgs/nixos/modules/services/system/cloud-init.nix
+++ b/nixpkgs/nixos/modules/services/system/cloud-init.nix
@@ -17,6 +17,7 @@ let
   ++ optional cfg.ext4.enable e2fsprogs
   ++ optional cfg.xfs.enable xfsprogs
   ;
+  hasFs = fsName: lib.any (fs: fs.fsType == fsName) (lib.attrValues config.fileSystems);
   settingsFormat = pkgs.formats.yaml { };
   cfgfile = settingsFormat.generate "cloud.cfg" cfg.settings;
 in
@@ -26,7 +27,7 @@ in
       enable = mkOption {
         type = types.bool;
         default = false;
-        description = mdDoc ''
+        description = ''
           Enable the cloud-init service. This services reads
           configuration metadata in a cloud environment and configures
           the machine according to this metadata.
@@ -44,24 +45,27 @@ in
 
       btrfs.enable = mkOption {
         type = types.bool;
-        default = false;
-        description = mdDoc ''
+        default = hasFs "btrfs";
+        defaultText = literalExpression ''hasFs "btrfs"'';
+        description = ''
           Allow the cloud-init service to operate `btrfs` filesystem.
         '';
       };
 
       ext4.enable = mkOption {
         type = types.bool;
-        default = true;
-        description = mdDoc ''
+        default = hasFs "ext4";
+        defaultText = literalExpression ''hasFs "ext4"'';
+        description = ''
           Allow the cloud-init service to operate `ext4` filesystem.
         '';
       };
 
       xfs.enable = mkOption {
         type = types.bool;
-        default = false;
-        description = mdDoc ''
+        default = hasFs "xfs";
+        defaultText = literalExpression ''hasFs "xfs"'';
+        description = ''
           Allow the cloud-init service to operate `xfs` filesystem.
         '';
       };
@@ -69,14 +73,14 @@ in
       network.enable = mkOption {
         type = types.bool;
         default = false;
-        description = mdDoc ''
+        description = ''
           Allow the cloud-init service to configure network interfaces
           through systemd-networkd.
         '';
       };
 
       settings = mkOption {
-        description = mdDoc ''
+        description = ''
           Structured cloud-init configuration.
         '';
         type = types.submodule {
@@ -88,7 +92,7 @@ in
       config = mkOption {
         type = types.str;
         default = "";
-        description = mdDoc ''
+        description = ''
           raw cloud-init configuration.
 
           Takes precedence over the `settings` option if set.
@@ -204,7 +208,7 @@ in
       description = "Apply the settings specified in cloud-config";
       wantedBy = [ "multi-user.target" ];
       wants = [ "network-online.target" ];
-      after = [ "network-online.target" "syslog.target" "cloud-config.target" ];
+      after = [ "network-online.target" "cloud-config.target" ];
 
       path = path;
       serviceConfig = {
@@ -220,7 +224,7 @@ in
       description = "Execute cloud user/final scripts";
       wantedBy = [ "multi-user.target" ];
       wants = [ "network-online.target" ];
-      after = [ "network-online.target" "syslog.target" "cloud-config.service" "rc-local.service" ];
+      after = [ "network-online.target" "cloud-config.service" "rc-local.service" ];
       requires = [ "cloud-config.target" ];
       path = path;
       serviceConfig = {