diff --git a/modules/nixos-modules/storage/storage.nix b/modules/nixos-modules/storage/storage.nix index 1b85010..6cff4f1 100644 --- a/modules/nixos-modules/storage/storage.nix +++ b/modules/nixos-modules/storage/storage.nix @@ -42,15 +42,9 @@ in { # Create ZFS datasets based on storage.datasets configuration storage.datasets = { local = { - "" = { - type = "zfs_fs"; - }; "nix" = { type = "zfs_fs"; - mount = { - enable = true; - mountPoint = "/nix"; - }; + mount = "/nix"; snapshot = { autoSnapshot = false; }; @@ -59,15 +53,9 @@ in { }; }; replicate = { - "" = { - type = "zfs_fs"; - }; "system/var/log" = { type = "zfs_fs"; - mount = { - enable = true; - mountPoint = "/var/log"; - }; + mount = "/var/log"; }; }; }; @@ -77,24 +65,29 @@ in { ephemeral = { "" = { type = "zfs_fs"; + mount = null; }; "system/root" = { type = "zfs_fs"; - mount = { - enable = true; - mountPoint = "/"; - }; + mount = "/"; snapshot = { blankSnapshot = true; }; }; }; + # TODO: can we auto set the mount points on these to just be `"/persist/local/${name}"` + local = { + "" = { + mount = "/persist/local/"; + }; + }; + # TODO: can we auto set the mount points on these to just be `"/persist/replicate/${name}"` replicate = { + "" = { + mount = "/persist/replicate/"; + }; "system/root" = { - mount = { - enable = true; - mountPoint = "/persist/replicate/system/root"; - }; + mount = "/persist/replicate/system/root"; snapshot = { autoSnapshot = true; }; @@ -107,10 +100,7 @@ in { }; }; "home" = { - mount = { - enable = true; - mountPoint = "/persist/replicate/home"; - }; + mount = "/persist/replicate/home"; snapshot = { autoSnapshot = true; }; @@ -156,12 +146,13 @@ in { storage.datasets = { # Base organizational datasets (only needed when impermanence is disabled) local = { + "" = { + type = "zfs_fs"; + mount = ""; + }; "root" = { type = "zfs_fs"; - mount = { - enable = true; - mountPoint = "/"; - }; + mount = "/"; compression = "lz4"; acltype = "posixacl"; relatime = "on"; @@ -171,26 +162,15 @@ in { blankSnapshot = true; }; }; - "nix" = { - type = "zfs_fs"; - mount = { - enable = true; - mountPoint = "/nix"; - }; - snapshot = { - autoSnapshot = false; - }; - atime = "off"; - relatime = "off"; - }; }; replicate = { + "" = { + type = "zfs_fs"; + mount = null; + }; "system/var/log" = { type = "zfs_fs"; - mount = { - enable = true; - mountPoint = "/var/log"; - }; + mount = "/var/log"; }; }; }; diff --git a/modules/nixos-modules/storage/submodules/dataset.nix b/modules/nixos-modules/storage/submodules/dataset.nix index 0b57886..2a45552 100644 --- a/modules/nixos-modules/storage/submodules/dataset.nix +++ b/modules/nixos-modules/storage/submodules/dataset.nix @@ -42,16 +42,10 @@ description = "Synchronous write behavior"; }; - mount = { - enable = lib.mkOption { - type = lib.types.either lib.types.bool (lib.types.enum ["on" "off" "noauto"]); - default = true; - description = "Whether and how the dataset should be mounted"; - }; - mountPoint = lib.mkOption { - type = lib.types.str; - description = "Controls the mount point used for this file system"; - }; + mount = lib.mkOption { + type = lib.types.nullOr lib.types.str; + description = "Controls the mount point used for this file system"; + default = null; }; encryption = { diff --git a/modules/nixos-modules/storage/submodules/impermanenceDataset.nix b/modules/nixos-modules/storage/submodules/impermanenceDataset.nix index 0104b88..4090b48 100644 --- a/modules/nixos-modules/storage/submodules/impermanenceDataset.nix +++ b/modules/nixos-modules/storage/submodules/impermanenceDataset.nix @@ -47,9 +47,6 @@ in { }; config = { - mount = { - mountPoint = lib.mkDefault "/${name}"; - enable = lib.mkDefault true; - }; + mount = lib.mkDefault "/${name}"; }; } diff --git a/modules/nixos-modules/storage/zfs.nix b/modules/nixos-modules/storage/zfs.nix index 1942e8d..1d3c1fb 100644 --- a/modules/nixos-modules/storage/zfs.nix +++ b/modules/nixos-modules/storage/zfs.nix @@ -83,7 +83,7 @@ args @ { lib.attrsets.nameValuePair name { type = dataset.type; options = datasetToZfsOptions dataset; - mountpoint = dataset.mount.mountPoint or null; + mountpoint = dataset.mount or null; postCreateHook = generatePostCreateHook name dataset; } ) @@ -92,7 +92,7 @@ args @ { lib.attrsets.nameValuePair "" { type = config.storage.zfs.rootDataset.type; options = datasetToZfsOptions config.storage.zfs.rootDataset; - mountpoint = config.storage.zfs.rootDataset.mount.mountPoint or null; + mountpoint = config.storage.zfs.rootDataset.mount or null; postCreateHook = generatePostCreateHook "" config.storage.zfs.rootDataset; } )) diff --git a/modules/nixos-modules/users.nix b/modules/nixos-modules/users.nix index 4018db5..f952861 100644 --- a/modules/nixos-modules/users.nix +++ b/modules/nixos-modules/users.nix @@ -404,10 +404,7 @@ in { # sops age key needs to be available to pre persist for user generation storage.datasets.local."system/sops" = { type = "zfs_fs"; - mount = { - enable = true; - mountPoint = SOPS_AGE_KEY_DIRECTORY; - }; + mount = SOPS_AGE_KEY_DIRECTORY; atime = "off"; relatime = "off"; }; @@ -417,10 +414,7 @@ in { builtins.map (user: { "home/${user.name}" = { type = "zfs_fs"; - mount = { - enable = true; - mountPoint = "/home/${user.name}"; - }; + mount = "/home/${user.name}"; snapshot.autoSnapshot = true; }; }) @@ -432,10 +426,7 @@ in { builtins.map (user: { "home/${user.name}" = { type = "zfs_fs"; - mount = { - enable = true; - mountPoint = "/home/${user.name}"; - }; + mount = "/home/${user.name}"; snapshot.blankSnapshot = true; }; })