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";
|
||||
};
|
||||
|
||||
_createFilesystem = lib.mkOption {
|
||||
internal = true;
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
};
|
||||
|
||||
_create = diskoLib.mkCreateOption
|
||||
{
|
||||
inherit config options;
|
||||
|
@ -77,15 +83,20 @@
|
|||
in
|
||||
''
|
||||
if ! zfs get type ${config._name} >/dev/null 2>&1; then
|
||||
zfs create -up ${config._name} \
|
||||
${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "-o ${n}=${v}") (createOptions))}
|
||||
${if config._createFilesystem then ''
|
||||
zfs create -up ${config._name} \
|
||||
${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "-o ${n}=${v}") (createOptions))}
|
||||
'' else ''
|
||||
# don't create anything for root dataset of zpools
|
||||
true
|
||||
''}
|
||||
${lib.optionalString (updateOptions != {}) ''
|
||||
else
|
||||
zfs set -u ${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "${n}=${v}") updateOptions)} ${config._name}
|
||||
''}
|
||||
fi
|
||||
'';
|
||||
} // { readOnly = false; };
|
||||
};
|
||||
|
||||
_mount = diskoLib.mkMountOption {
|
||||
inherit config options;
|
||||
|
|
|
@ -253,7 +253,7 @@ in
|
|||
config = {
|
||||
datasets."__root" = {
|
||||
_name = config.name;
|
||||
_create = "";
|
||||
_createFilesystem = false;
|
||||
type = "zfs_fs";
|
||||
mountpoint = config.mountpoint;
|
||||
options = config.rootFsOptions;
|
||||
|
|
Loading…
Reference in a new issue