From 6d630b8fe4bfffb3acf34b7b878e31c0a0494059 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 14 Feb 2023 09:58:37 +0100 Subject: [PATCH] turn all extraArgs into lists --- example/btrfs-subvolumes.nix | 2 +- types/btrfs.nix | 8 ++++---- types/btrfs_subvol.nix | 8 ++++---- types/filesystem.nix | 8 ++++---- types/lvm_lv.nix | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/example/btrfs-subvolumes.nix b/example/btrfs-subvolumes.nix index a6d8088..a574570 100644 --- a/example/btrfs-subvolumes.nix +++ b/example/btrfs-subvolumes.nix @@ -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" = { diff --git a/types/btrfs.nix b/types/btrfs.nix index 9473db7..ce212cd 100644 --- a/types/btrfs.nix +++ b/types/btrfs.nix @@ -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)} ''; }; diff --git a/types/btrfs_subvol.nix b/types/btrfs_subvol.nix index 699d3e8..caba3fe 100644 --- a/types/btrfs_subvol.nix +++ b/types/btrfs_subvol.nix @@ -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} ) ''; }; diff --git a/types/filesystem.nix b/types/filesystem.nix index c9a3319..93d0cac 100644 --- a/types/filesystem.nix +++ b/types/filesystem.nix @@ -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} ''; }; diff --git a/types/lvm_lv.nix b/types/lvm_lv.nix index 7ffa268..d2df6fc 100644 --- a/types/lvm_lv.nix +++ b/types/lvm_lv.nix @@ -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}";})} '';