storage-refactor #9
4 changed files with 32 additions and 24 deletions
|
|
@ -80,6 +80,15 @@ in {
|
||||||
|
|
||||||
programs.fuse.userAllowOther = true;
|
programs.fuse.userAllowOther = true;
|
||||||
|
|
||||||
|
fileSystems =
|
||||||
|
lib.mapAttrs' (
|
||||||
|
datasetName: dataset:
|
||||||
|
lib.nameValuePair "/${datasetName}" {
|
||||||
|
neededForBoot = true;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
config.storage.impermanence.datasets;
|
||||||
|
|
||||||
environment.persistence =
|
environment.persistence =
|
||||||
lib.mapAttrs (datasetName: dataset: {
|
lib.mapAttrs (datasetName: dataset: {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -101,7 +110,6 @@ in {
|
||||||
}) (lib.filterAttrs (_: fileConfig: fileConfig.enable) dataset.files);
|
}) (lib.filterAttrs (_: fileConfig: fileConfig.enable) dataset.files);
|
||||||
})
|
})
|
||||||
config.storage.impermanence.datasets;
|
config.storage.impermanence.datasets;
|
||||||
# TODO: need for boot on filesystems
|
|
||||||
}
|
}
|
||||||
(lib.mkIf config.storage.zfs.enable {
|
(lib.mkIf config.storage.zfs.enable {
|
||||||
storage.zfs.datasets =
|
storage.zfs.datasets =
|
||||||
|
|
|
||||||
|
|
@ -35,17 +35,19 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
(lib.mkIf (!config.storage.impermanence.enable) {
|
(lib.mkIf (!config.storage.impermanence.enable) {
|
||||||
# TODO: create datasets for systemd.services.<name>.storage.impermanence.datasets
|
storage.zfs.rootDataset = {
|
||||||
storage.zfs.datasets = {
|
|
||||||
"persist/system/root" = {
|
|
||||||
type = "zfs_fs";
|
type = "zfs_fs";
|
||||||
mount = {
|
mount = {
|
||||||
enable = false;
|
enable = true;
|
||||||
mountPoint = "/";
|
mountPoint = "/";
|
||||||
};
|
};
|
||||||
|
compression = "lz4";
|
||||||
|
acltype = "posixacl";
|
||||||
|
relatime = "on";
|
||||||
|
xattr = "sa";
|
||||||
snapshot = {
|
snapshot = {
|
||||||
autoSnapshot = true;
|
autoSnapshot = true;
|
||||||
};
|
blankSnapshot = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
@ -70,8 +72,8 @@
|
||||||
storage.impermanence.datasets = {
|
storage.impermanence.datasets = {
|
||||||
"persist/system/root" = {
|
"persist/system/root" = {
|
||||||
mount = {
|
mount = {
|
||||||
enable = false;
|
enable = true;
|
||||||
mountPoint = "/";
|
mountPoint = "/persist/system/root";
|
||||||
};
|
};
|
||||||
directories = {
|
directories = {
|
||||||
"/var/lib/nixos".enable = true;
|
"/var/lib/nixos".enable = true;
|
||||||
|
|
@ -81,6 +83,12 @@
|
||||||
"/etc/machine-id".enable = true;
|
"/etc/machine-id".enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
"persist/home" = {
|
||||||
|
mount = {
|
||||||
|
enable = true;
|
||||||
|
mountPoint = "/persist/home";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: home-manager.users.<user>.storage.impermanence.enable
|
# TODO: home-manager.users.<user>.storage.impermanence.enable
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,14 @@ args @ {lib, ...}: {name, ...}: let
|
||||||
owner = {
|
owner = {
|
||||||
name = lib.mkOption {
|
name = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "nouser";
|
default = "root";
|
||||||
};
|
};
|
||||||
permissions = pathPermissions;
|
permissions = pathPermissions;
|
||||||
};
|
};
|
||||||
group = {
|
group = {
|
||||||
name = lib.mkOption {
|
name = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "nogroup";
|
default = "root";
|
||||||
};
|
};
|
||||||
permissions = pathPermissions;
|
permissions = pathPermissions;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -415,7 +415,6 @@ in {
|
||||||
relatime = "off";
|
relatime = "off";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
# Create ZFS datasets for each normal user
|
|
||||||
(lib.mkMerge (
|
(lib.mkMerge (
|
||||||
builtins.map (user: {
|
builtins.map (user: {
|
||||||
"local/home/${user.name}" = {
|
"local/home/${user.name}" = {
|
||||||
|
|
@ -426,13 +425,6 @@ in {
|
||||||
};
|
};
|
||||||
snapshot.blankSnapshot = true;
|
snapshot.blankSnapshot = true;
|
||||||
};
|
};
|
||||||
"persist/home/${user.name}" = {
|
|
||||||
type = "zfs_fs";
|
|
||||||
mount = {
|
|
||||||
enable = true;
|
|
||||||
mountPoint = "/persist/home/${user.name}";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
})
|
})
|
||||||
normalUsers
|
normalUsers
|
||||||
))
|
))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue