aboutsummaryrefslogtreecommitdiff
path: root/home-manager/modules/programs/noti.nix
blob: 476c2eb1978bbf2c5c0e008119fb0e1871401cb5 (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
48
49
50
51
52
53
{ config, lib, pkgs, ...}:

with lib;

let

  cfg = config.programs.noti;

in

{
  meta.maintainers = [ maintainers.marsam ];

  options.programs.noti = {
    enable = mkEnableOption "Noti";

    settings = mkOption {
      type = types.attrsOf (types.attrsOf types.str);
      default = {};
      description = ''
        Configuration written to
        <filename>~/.config/noti/noti.yaml</filename>.
        </para><para>
        See
        <citerefentry>
          <refentrytitle>noti.yaml</refentrytitle>
          <manvolnum>5</manvolnum>
        </citerefentry>.
        for the full list of options.
      '';
      example = literalExample ''
        {
          say = {
            voice = "Alex";
          };
          slack = {
            token = "1234567890abcdefg";
            channel = "@jaime";
          };
        }
      '';
    };
  };

  config = mkIf cfg.enable {
    home.packages = [ pkgs.noti ];

    xdg.configFile."noti/noti.yaml" = mkIf (cfg.settings != {}) {
      text = generators.toYAML {} cfg.settings;
    };
  };

}