From b7f3ee8e141992716f190ecfb6c7cd3a9eed607d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Fri, 19 May 2023 01:55:12 +0200 Subject: [PATCH] zpool: deduplicate root mount option --- lib/types/zpool.nix | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/lib/types/zpool.nix b/lib/types/zpool.nix index 18924da..12785f1 100644 --- a/lib/types/zpool.nix +++ b/lib/types/zpool.nix @@ -37,17 +37,6 @@ default = [ "defaults" ]; description = "Options to pass to mount"; }; - mountRoot = lib.mkOption { - type = lib.types.str; - default = "/"; - example = "/mnt"; - description = '' - The root location where the zpool should be mounted. - - Note: - Leaving this at the default "/" might break your live system. - ''; - }; datasets = lib.mkOption { type = lib.types.attrsOf (diskoLib.subType { types = { inherit (diskoLib.types) zfs_fs zfs_volume; }; @@ -68,7 +57,7 @@ default = '' readarray -t zfs_devices < <(cat "$disko_devices_dir"/zfs_${config.name}) zpool create -f ${config.name} \ - -R ${config.mountRoot} ${config.mode} \ + -R ${rootMountPoint} ${config.mode} \ ${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "-o ${n}=${v}") config.options)} \ ${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "-O ${n}=${v}") config.rootFsOptions)} \ "''${zfs_devices[@]}" @@ -84,7 +73,7 @@ { dev = '' zpool list '${config.name}' >/dev/null 2>/dev/null || - zpool import -l -R ${config.mountRoot} '${config.name}' + zpool import -l -R ${rootMountPoint} '${config.name}' ${lib.concatMapStrings (x: x.dev or "") (lib.attrValues datasetMounts)} ''; fs = (datasetMounts.fs or { }) // lib.optionalAttrs (config.mountpoint != null) {