Merge pull request #218 from oddlama/master

This commit is contained in:
Lassulus 2023-04-29 23:01:09 +02:00 committed by GitHub
commit c917cb9cdb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -38,8 +38,11 @@
}; };
_create = diskoLib.mkCreateOption { _create = diskoLib.mkCreateOption {
inherit config options; inherit config options;
# -u prevents mounting newly created datasets, which is
# important to prevent accidental shadowing of mount points
# since (create order != mount order)
default = { zpool }: '' default = { zpool }: ''
zfs create ${zpool}/${config.name} \ zfs create -u ${zpool}/${config.name} \
${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "-o ${n}=${v}") config.options)} ${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "-o ${n}=${v}") config.options)}
''; '';
}; };

View file

@ -82,7 +82,7 @@
{ {
dev = '' dev = ''
zpool list '${config.name}' >/dev/null 2>/dev/null || \ zpool list '${config.name}' >/dev/null 2>/dev/null || \
zpool import -R ${config.mountRoot} '${config.name}' zpool import -l -R ${config.mountRoot} '${config.name}'
${lib.concatMapStrings (x: x.dev or "") (lib.attrValues datasetMounts)} ${lib.concatMapStrings (x: x.dev or "") (lib.attrValues datasetMounts)}
''; '';
fs = (datasetMounts.fs or {}) // lib.optionalAttrs (config.mountpoint != null) { fs = (datasetMounts.fs or {}) // lib.optionalAttrs (config.mountpoint != null) {