cloud-init: enable filesystems based on what is used
This commit is contained in:
parent
5e73f0c1c9
commit
3d14617fc7
|
@ -17,6 +17,7 @@ let
|
||||||
++ optional cfg.ext4.enable e2fsprogs
|
++ optional cfg.ext4.enable e2fsprogs
|
||||||
++ optional cfg.xfs.enable xfsprogs
|
++ optional cfg.xfs.enable xfsprogs
|
||||||
;
|
;
|
||||||
|
hasFs = fsName: lib.any (fs: fs.fsType == fsName) (lib.attrValues config.fileSystems);
|
||||||
settingsFormat = pkgs.formats.yaml { };
|
settingsFormat = pkgs.formats.yaml { };
|
||||||
cfgfile = settingsFormat.generate "cloud.cfg" cfg.settings;
|
cfgfile = settingsFormat.generate "cloud.cfg" cfg.settings;
|
||||||
in
|
in
|
||||||
|
@ -44,7 +45,8 @@ in
|
||||||
|
|
||||||
btrfs.enable = mkOption {
|
btrfs.enable = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = hasFs "btrfs";
|
||||||
|
defaultText = literalExpression ''hasFs "btrfs"'';
|
||||||
description = mdDoc ''
|
description = mdDoc ''
|
||||||
Allow the cloud-init service to operate `btrfs` filesystem.
|
Allow the cloud-init service to operate `btrfs` filesystem.
|
||||||
'';
|
'';
|
||||||
|
@ -52,7 +54,8 @@ in
|
||||||
|
|
||||||
ext4.enable = mkOption {
|
ext4.enable = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = hasFs "ext4";
|
||||||
|
defaultText = literalExpression ''hasFs "ext4"'';
|
||||||
description = mdDoc ''
|
description = mdDoc ''
|
||||||
Allow the cloud-init service to operate `ext4` filesystem.
|
Allow the cloud-init service to operate `ext4` filesystem.
|
||||||
'';
|
'';
|
||||||
|
@ -60,7 +63,8 @@ in
|
||||||
|
|
||||||
xfs.enable = mkOption {
|
xfs.enable = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = hasFs "xfs";
|
||||||
|
defaultText = literalExpression ''hasFs "xfs"'';
|
||||||
description = mdDoc ''
|
description = mdDoc ''
|
||||||
Allow the cloud-init service to operate `xfs` filesystem.
|
Allow the cloud-init service to operate `xfs` filesystem.
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user