fix: fixed file system resolution

This commit is contained in:
Leyla Becker 2025-11-23 11:51:53 -06:00
parent 5dc602339c
commit 2922114367
5 changed files with 36 additions and 74 deletions

View file

@ -42,15 +42,9 @@ in {
# Create ZFS datasets based on storage.datasets configuration # Create ZFS datasets based on storage.datasets configuration
storage.datasets = { storage.datasets = {
local = { local = {
"" = {
type = "zfs_fs";
};
"nix" = { "nix" = {
type = "zfs_fs"; type = "zfs_fs";
mount = { mount = "/nix";
enable = true;
mountPoint = "/nix";
};
snapshot = { snapshot = {
autoSnapshot = false; autoSnapshot = false;
}; };
@ -59,15 +53,9 @@ in {
}; };
}; };
replicate = { replicate = {
"" = {
type = "zfs_fs";
};
"system/var/log" = { "system/var/log" = {
type = "zfs_fs"; type = "zfs_fs";
mount = { mount = "/var/log";
enable = true;
mountPoint = "/var/log";
};
}; };
}; };
}; };
@ -77,24 +65,29 @@ in {
ephemeral = { ephemeral = {
"" = { "" = {
type = "zfs_fs"; type = "zfs_fs";
mount = null;
}; };
"system/root" = { "system/root" = {
type = "zfs_fs"; type = "zfs_fs";
mount = { mount = "/";
enable = true;
mountPoint = "/";
};
snapshot = { snapshot = {
blankSnapshot = true; 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 = { replicate = {
"" = {
mount = "/persist/replicate/";
};
"system/root" = { "system/root" = {
mount = { mount = "/persist/replicate/system/root";
enable = true;
mountPoint = "/persist/replicate/system/root";
};
snapshot = { snapshot = {
autoSnapshot = true; autoSnapshot = true;
}; };
@ -107,10 +100,7 @@ in {
}; };
}; };
"home" = { "home" = {
mount = { mount = "/persist/replicate/home";
enable = true;
mountPoint = "/persist/replicate/home";
};
snapshot = { snapshot = {
autoSnapshot = true; autoSnapshot = true;
}; };
@ -156,12 +146,13 @@ in {
storage.datasets = { storage.datasets = {
# Base organizational datasets (only needed when impermanence is disabled) # Base organizational datasets (only needed when impermanence is disabled)
local = { local = {
"" = {
type = "zfs_fs";
mount = "";
};
"root" = { "root" = {
type = "zfs_fs"; type = "zfs_fs";
mount = { mount = "/";
enable = true;
mountPoint = "/";
};
compression = "lz4"; compression = "lz4";
acltype = "posixacl"; acltype = "posixacl";
relatime = "on"; relatime = "on";
@ -171,26 +162,15 @@ in {
blankSnapshot = true; blankSnapshot = true;
}; };
}; };
"nix" = {
type = "zfs_fs";
mount = {
enable = true;
mountPoint = "/nix";
};
snapshot = {
autoSnapshot = false;
};
atime = "off";
relatime = "off";
};
}; };
replicate = { replicate = {
"" = {
type = "zfs_fs";
mount = null;
};
"system/var/log" = { "system/var/log" = {
type = "zfs_fs"; type = "zfs_fs";
mount = { mount = "/var/log";
enable = true;
mountPoint = "/var/log";
};
}; };
}; };
}; };

View file

@ -42,16 +42,10 @@
description = "Synchronous write behavior"; description = "Synchronous write behavior";
}; };
mount = { mount = lib.mkOption {
enable = lib.mkOption { type = lib.types.nullOr lib.types.str;
type = lib.types.either lib.types.bool (lib.types.enum ["on" "off" "noauto"]); description = "Controls the mount point used for this file system";
default = true; default = null;
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";
};
}; };
encryption = { encryption = {

View file

@ -47,9 +47,6 @@ in {
}; };
config = { config = {
mount = { mount = lib.mkDefault "/${name}";
mountPoint = lib.mkDefault "/${name}";
enable = lib.mkDefault true;
};
}; };
} }

View file

@ -83,7 +83,7 @@ args @ {
lib.attrsets.nameValuePair name { lib.attrsets.nameValuePair name {
type = dataset.type; type = dataset.type;
options = datasetToZfsOptions dataset; options = datasetToZfsOptions dataset;
mountpoint = dataset.mount.mountPoint or null; mountpoint = dataset.mount or null;
postCreateHook = generatePostCreateHook name dataset; postCreateHook = generatePostCreateHook name dataset;
} }
) )
@ -92,7 +92,7 @@ args @ {
lib.attrsets.nameValuePair "" { lib.attrsets.nameValuePair "" {
type = config.storage.zfs.rootDataset.type; type = config.storage.zfs.rootDataset.type;
options = datasetToZfsOptions config.storage.zfs.rootDataset; 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; postCreateHook = generatePostCreateHook "" config.storage.zfs.rootDataset;
} }
)) ))

View file

@ -404,10 +404,7 @@ in {
# sops age key needs to be available to pre persist for user generation # sops age key needs to be available to pre persist for user generation
storage.datasets.local."system/sops" = { storage.datasets.local."system/sops" = {
type = "zfs_fs"; type = "zfs_fs";
mount = { mount = SOPS_AGE_KEY_DIRECTORY;
enable = true;
mountPoint = SOPS_AGE_KEY_DIRECTORY;
};
atime = "off"; atime = "off";
relatime = "off"; relatime = "off";
}; };
@ -417,10 +414,7 @@ in {
builtins.map (user: { builtins.map (user: {
"home/${user.name}" = { "home/${user.name}" = {
type = "zfs_fs"; type = "zfs_fs";
mount = { mount = "/home/${user.name}";
enable = true;
mountPoint = "/home/${user.name}";
};
snapshot.autoSnapshot = true; snapshot.autoSnapshot = true;
}; };
}) })
@ -432,10 +426,7 @@ in {
builtins.map (user: { builtins.map (user: {
"home/${user.name}" = { "home/${user.name}" = {
type = "zfs_fs"; type = "zfs_fs";
mount = { mount = "/home/${user.name}";
enable = true;
mountPoint = "/home/${user.name}";
};
snapshot.blankSnapshot = true; snapshot.blankSnapshot = true;
}; };
}) })