mirror of
https://github.com/nix-community/disko
synced 2024-11-10 06:14:14 +00:00
zpool: support updating zfsprops on root dataset
This commit is contained in:
parent
a9eeea3379
commit
d32d1504c7
2 changed files with 15 additions and 4 deletions
|
@ -52,6 +52,12 @@
|
||||||
description = "Metadata";
|
description = "Metadata";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_createFilesystem = lib.mkOption {
|
||||||
|
internal = true;
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
|
||||||
_create = diskoLib.mkCreateOption
|
_create = diskoLib.mkCreateOption
|
||||||
{
|
{
|
||||||
inherit config options;
|
inherit config options;
|
||||||
|
@ -77,15 +83,20 @@
|
||||||
in
|
in
|
||||||
''
|
''
|
||||||
if ! zfs get type ${config._name} >/dev/null 2>&1; then
|
if ! zfs get type ${config._name} >/dev/null 2>&1; then
|
||||||
|
${if config._createFilesystem then ''
|
||||||
zfs create -up ${config._name} \
|
zfs create -up ${config._name} \
|
||||||
${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "-o ${n}=${v}") (createOptions))}
|
${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "-o ${n}=${v}") (createOptions))}
|
||||||
|
'' else ''
|
||||||
|
# don't create anything for root dataset of zpools
|
||||||
|
true
|
||||||
|
''}
|
||||||
${lib.optionalString (updateOptions != {}) ''
|
${lib.optionalString (updateOptions != {}) ''
|
||||||
else
|
else
|
||||||
zfs set -u ${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "${n}=${v}") updateOptions)} ${config._name}
|
zfs set -u ${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "${n}=${v}") updateOptions)} ${config._name}
|
||||||
''}
|
''}
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
} // { readOnly = false; };
|
};
|
||||||
|
|
||||||
_mount = diskoLib.mkMountOption {
|
_mount = diskoLib.mkMountOption {
|
||||||
inherit config options;
|
inherit config options;
|
||||||
|
|
|
@ -253,7 +253,7 @@ in
|
||||||
config = {
|
config = {
|
||||||
datasets."__root" = {
|
datasets."__root" = {
|
||||||
_name = config.name;
|
_name = config.name;
|
||||||
_create = "";
|
_createFilesystem = false;
|
||||||
type = "zfs_fs";
|
type = "zfs_fs";
|
||||||
mountpoint = config.mountpoint;
|
mountpoint = config.mountpoint;
|
||||||
options = config.rootFsOptions;
|
options = config.rootFsOptions;
|
||||||
|
|
Loading…
Reference in a new issue