turn all extraArgs into lists

This commit is contained in:
lassulus 2023-02-14 09:58:37 +01:00
parent 7585a30385
commit 6d630b8fe4
5 changed files with 16 additions and 16 deletions

View File

@ -27,7 +27,7 @@
end = "100%";
content = {
type = "btrfs";
extraArgs = "-f"; # Override existing partition
extraArgs = [ "-f" ]; # Override existing partition
subvolumes = {
# Subvolume name is different from mountpoint
"/rootfs" = {

View File

@ -7,9 +7,9 @@
description = "Type";
};
extraArgs = lib.mkOption {
type = lib.types.str;
default = "";
description = "Arguments to pass to BTRFS";
type = lib.types.listOf lib.types.str;
default = [ ];
description = "Extra arguments";
};
mountOptions = lib.mkOption {
type = lib.types.listOf lib.types.str;
@ -37,7 +37,7 @@
_create = diskoLib.mkCreateOption {
inherit config options;
default = { dev }: ''
mkfs.btrfs ${dev} ${config.extraArgs}
mkfs.btrfs ${dev} ${toString config.extraArgs}
${lib.concatMapStrings (subvol: subvol._create { inherit dev; }) (lib.attrValues config.subvolumes)}
'';
};

View File

@ -13,9 +13,9 @@
description = "Type";
};
extraArgs = lib.mkOption {
type = lib.types.str;
default = "";
description = "Extra arguments to pass";
type = lib.types.listOf lib.types.str;
default = [ ];
description = "Extra arguments";
};
mountOptions = lib.mkOption {
type = lib.types.listOf lib.types.str;
@ -41,7 +41,7 @@
(
mount ${dev} "$MNTPOINT" -o subvol=/
trap 'umount $MNTPOINT; rm -rf $MNTPOINT' EXIT
btrfs subvolume create "$MNTPOINT"/${config.name} ${config.extraArgs}
btrfs subvolume create "$MNTPOINT"/${config.name} ${toString config.extraArgs}
)
'';
};

View File

@ -7,9 +7,9 @@
description = "Type";
};
extraArgs = lib.mkOption {
type = lib.types.str;
default = "";
description = "Arguments to pass";
type = lib.types.listOf lib.types.str;
default = [ ];
description = "Extra arguments";
};
mountOptions = lib.mkOption {
type = lib.types.listOf lib.types.str;
@ -35,7 +35,7 @@
inherit config options;
default = { dev }: ''
mkfs.${config.format} \
${config.extraArgs} \
${toString config.extraArgs} \
${dev}
'';
};

View File

@ -22,8 +22,8 @@
description = "LVM type";
};
extraArgs = lib.mkOption {
type = lib.types.str;
default = "";
type = lib.types.listOf lib.types.str;
default = [ ];
description = "Extra arguments";
};
content = diskoLib.partitionType;
@ -43,7 +43,7 @@
${if lib.hasInfix "%" config.size then "-l" else "-L"} ${config.size} \
-n ${config.name} \
${lib.optionalString (config.lvm_type != null) "--type=${config.lvm_type}"} \
${config.extraArgs} \
${toString config.extraArgs} \
${vg}
${lib.optionalString (config.content != null) (config.content._create {dev = "/dev/${vg}/${config.name}";})}
'';