mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-09-29 15:43:00 +00:00
Merge pull request #241816 from Mic92/cloud-init
nixos/cloud-init: enable filesystem based on what is configured
This commit is contained in:
commit
d79ff2f15b
@ -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