Skip to content

Commit b8dd0e2

Browse files
Feature(zfs_volume); Add internal option for fully qualified zfs path
1 parent b6a1b5e commit b8dd0e2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/types/zfs_volume.nix

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
default = config._module.args.name;
1414
description = "Name of the dataset";
1515
};
16+
_name = lib.mkOption {
17+
type = lib.types.str;
18+
default = "${config._parent.name}/${config.name}";
19+
internal = true;
20+
description = "Fully quantified name for dataset";
21+
};
1622
type = lib.mkOption {
1723
type = lib.types.enum [ "zfs_volume" ];
1824
default = "zfs_volume";
@@ -61,8 +67,8 @@
6167
_create = diskoLib.mkCreateOption {
6268
inherit config options;
6369
default = ''
64-
if ! zfs get type "${config._parent.name}/${config.name}" >/dev/null 2>&1; then
65-
zfs create "${config._parent.name}/${config.name}" \
70+
if ! zfs get type "${config._name}" >/dev/null 2>&1; then
71+
zfs create "${config._name}" \
6672
${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "-o ${n}=${v}") config.options)} \
6773
-V ${config.size} ${toString (builtins.map lib.escapeShellArg config.extraArgs)}
6874
zvol_wait

0 commit comments

Comments
 (0)