From a965921af95859ec78f8f5b59f94e78a87d2d57b Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Sun, 11 Nov 2018 00:07:48 +0800 Subject: [PATCH 1/2] allow cloud-init to support creating btrfs partitions --- nixos/modules/services/system/cloud-init.nix | 27 +++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/system/cloud-init.nix b/nixos/modules/services/system/cloud-init.nix index 1a700828ce77..59f57307098b 100644 --- a/nixos/modules/services/system/cloud-init.nix +++ b/nixos/modules/services/system/cloud-init.nix @@ -3,7 +3,16 @@ with lib; let cfg = config.services.cloud-init; - path = with pkgs; [ cloud-init nettools utillinux e2fsprogs shadow openssh iproute ]; + path = with pkgs; [ + cloud-init + iproute + nettools + openssh + shadow + utillinux + ] ++ optional config.services.cloud-init.btrfs btrfs-progs + ++ optional config.services.cloud-init.ext4 e2fsprogs + ; in { options = { @@ -29,6 +38,22 @@ in ''; }; + btrfs = mkOption { + type = types.bool; + default = false; + description = '' + Allow the cloud-init service to operate `btrfs` filesystem. + ''; + }; + + ext4 = mkOption { + type = types.bool; + default = true; + description = '' + Allow the cloud-init service to operate `ext4` filesystem. + ''; + }; + config = mkOption { type = types.str; default = '' From a5c74762cbe96149673be60b0fcd51632642265e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 13 Nov 2018 10:28:40 +0000 Subject: [PATCH 2/2] nixos/cloud-init: add enable suffix to ext4/btrfs Makes the optional more self-describing and allows future extensions --- nixos/modules/services/system/cloud-init.nix | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/nixos/modules/services/system/cloud-init.nix b/nixos/modules/services/system/cloud-init.nix index 59f57307098b..f22bd45dfebc 100644 --- a/nixos/modules/services/system/cloud-init.nix +++ b/nixos/modules/services/system/cloud-init.nix @@ -10,15 +10,13 @@ let cfg = config.services.cloud-init; openssh shadow utillinux - ] ++ optional config.services.cloud-init.btrfs btrfs-progs - ++ optional config.services.cloud-init.ext4 e2fsprogs + ] ++ optional cfg.btrfs.enable btrfs-progs + ++ optional cfg.ext4.enable e2fsprogs ; in { options = { - services.cloud-init = { - enable = mkOption { type = types.bool; default = false; @@ -38,7 +36,7 @@ in ''; }; - btrfs = mkOption { + btrfs.enable = mkOption { type = types.bool; default = false; description = '' @@ -46,7 +44,7 @@ in ''; }; - ext4 = mkOption { + ext4.enable = mkOption { type = types.bool; default = true; description = ''