Disable home impermanence

This commit is contained in:
Madeleine Sydney
2024-12-21 09:49:20 -07:00
parent 684e78e936
commit be5341b5b1
12 changed files with 594 additions and 262 deletions

View File

@@ -7,10 +7,34 @@ let
in {
options = {
sydnix.impermanence = {
enable = mkOption {
description = "Enable Impermanence";
type = types.bool;
default = false;
enable = mkEnableOption "impermanence";
mutableDotfiles = {
enable = mkEnableOption "dotfiles under impermanence";
# storeAt = mkOption {
# default = "dots/config";
# type = types.str;
# # type = with types;
# # addCheck
# # path
# # (x: cfg.mutableDotfiles.enable
# # -> ! (elem x cfg.mutableDotfiles.directories));
# };
files = mkOption {
default = [];
# FIXME: Inaccurate type.
type = with types;
listOf anything;
};
directories = mkOption {
default = [];
# FIXME: Inaccurate type.
type = with types;
listOf anything;
};
};
directories = mkOption {
@@ -28,10 +52,22 @@ in {
};
config = mkIf cfg.enable {
home.persistence."/persist/home/${config.home.username}" = {
allowOther = true;
directories = cfg.directories;
files = cfg.files;
};
home.persistence = {
"/persist/home/${config.home.username}" = {
allowOther = true;
directories = cfg.directories;
files = cfg.files;
};
} // (if ! cfg.mutableDotfiles.enable
then {}
else {
"/persist/dots/users/${config.home.username}/dots/" = {
removePrefixDirectory = true;
directories = cfg.mutableDotfiles.directories;
files = cfg.mutableDotfiles.files;
allowOther = true;
};
});
};
}