74 lines
1.8 KiB
Nix
74 lines
1.8 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.sydnix.impermanence;
|
|
in {
|
|
options = {
|
|
sydnix.impermanence = {
|
|
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 {
|
|
# type = with types;
|
|
# listOf (coercedTo str (d: { directory = d; }) userDir);
|
|
default = [];
|
|
};
|
|
|
|
files = mkOption {
|
|
# type = with types;
|
|
# listOf (coercedTo str (f: { file = f; }) userFile);
|
|
default = [];
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
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;
|
|
};
|
|
});
|
|
|
|
};
|
|
}
|