about summary refs log tree commit diff stats
path: root/modules/by-name/im/impermanence/module.nix
blob: 140e0754d27615127bc4ac65c1e0f9229243e90d (plain) (blame)
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
48
49
50
{
  config,
  lib,
  ...
}: let
  cfg = config.soispha.impermanence;
in {
  options.soispha.impermanence = {
    enable = lib.mkEnableOption "persisting directories and files with impermanence";

    directories = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      description = "The directories to persist";
    };
  };

  config = lib.mkIf cfg.enable {
    environment.persistence = {
      "/srv" = {
        hideMounts = true;
        inherit (cfg) directories;

        users.soispha = {
          directories = [
            ".local/share"

            ".local/state/nvim"
            ".local/state/mpv"
            ".local/state/wireplumber"

            ".config/Signal"
            ".config/Element"
            ".config/iamb/profiles"

            ".cache"
            ".mozilla"

            "media"
            "repos"
            "school"
          ];
        };

        files = [
          "/etc/machine-id"
        ];
      };
    };
  };
}