From a0c967fef4d74b263610d9087be8efa7b1bdcd04 Mon Sep 17 00:00:00 2001 From: neox Date: Fri, 13 Dec 2024 14:53:00 +0500 Subject: [PATCH] Add extraArgs to zfs_volume. Update lib/types/zfs_volume.nix --- lib/types/zfs_volume.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/types/zfs_volume.nix b/lib/types/zfs_volume.nix index 994dd3b..3f90efa 100644 --- a/lib/types/zfs_volume.nix +++ b/lib/types/zfs_volume.nix @@ -17,6 +17,11 @@ default = { }; description = "Options to set for the dataset"; }; + extraArgs = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; + description = "Extra arguments passed to `zfs create`"; + }; mountOptions = lib.mkOption { type = lib.types.listOf lib.types.str; default = [ "defaults" ]; @@ -50,7 +55,7 @@ if ! zfs get type "${config._parent.name}/${config.name}" >/dev/null 2>&1; then zfs create "${config._parent.name}/${config.name}" \ ${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "-o ${n}=${v}") config.options)} \ - -V ${config.size} + -V ${config.size} ${toString (builtins.map lib.escapeShellArg config.extraArgs)} zvol_wait partprobe "/dev/zvol/${config._parent.name}/${config.name}" udevadm trigger --subsystem-match=block