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%"; end = "100%";
content = { content = {
type = "btrfs"; type = "btrfs";
extraArgs = "-f"; # Override existing partition extraArgs = [ "-f" ]; # Override existing partition
subvolumes = { subvolumes = {
# Subvolume name is different from mountpoint # Subvolume name is different from mountpoint
"/rootfs" = { "/rootfs" = {

View file

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

View file

@ -13,9 +13,9 @@
description = "Type"; description = "Type";
}; };
extraArgs = lib.mkOption { extraArgs = lib.mkOption {
type = lib.types.str; type = lib.types.listOf lib.types.str;
default = ""; default = [ ];
description = "Extra arguments to pass"; description = "Extra arguments";
}; };
mountOptions = lib.mkOption { mountOptions = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
@ -41,7 +41,7 @@
( (
mount ${dev} "$MNTPOINT" -o subvol=/ mount ${dev} "$MNTPOINT" -o subvol=/
trap 'umount $MNTPOINT; rm -rf $MNTPOINT' EXIT 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"; description = "Type";
}; };
extraArgs = lib.mkOption { extraArgs = lib.mkOption {
type = lib.types.str; type = lib.types.listOf lib.types.str;
default = ""; default = [ ];
description = "Arguments to pass"; description = "Extra arguments";
}; };
mountOptions = lib.mkOption { mountOptions = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
@ -35,7 +35,7 @@
inherit config options; inherit config options;
default = { dev }: '' default = { dev }: ''
mkfs.${config.format} \ mkfs.${config.format} \
${config.extraArgs} \ ${toString config.extraArgs} \
${dev} ${dev}
''; '';
}; };

View file

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