aboutsummaryrefslogtreecommitdiff
path: root/modules/home/impermanence/default.nix
blob: 540a6b5a60f383a0d33093f5d56e989f8c95fdbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{ options, config, osConfig, lib, namespace, inputs, host, ... }:

with lib; with lib.${namespace}; let
  cfg = config.${namespace}.impermanence;
  os = osConfig.${namespace}.system.impermanence.home;
in {
  options.${namespace}.impermanence = with types; {
    skeleton = mkOption {
      type = bool;
      default = true;
    };

    enable = mkOption { type = uniq bool; };
    location = mkOption { type = uniq str; };
    secure.location = mkOption { type = uniq str; };
  };

  config = {
    ${namespace}.impermanence = {
      inherit (os) enable location secure;
    };

    home.persistence.${cfg.location} = {
      enable = cfg.enable;
      directories = mkIf cfg.skeleton [
        ".local/share/applications"
        ".local/bin"

        "Downloads"
        "Documents"
        "Pictures"
        "Videos"
        "Music"
        "Games"
        "Links"
        "Persist"
      ];
    };

    home.persistence.${cfg.secure.location} = {
      enable = cfg.enable;
      directories = mkIf cfg.skeleton [
        "Secure"
      ];
    };
  };
}