fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Robert HelgessonMerge PR #421575790441

master
2.0 KiB72 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6  cfg = config.programs.senpai;
7  cfgFmt = pkgs.formats.yaml { };
8in {
9  options.programs.senpai = {
10    enable = mkEnableOption "senpai";
11    package = mkOption {
12      type = types.package;
13      default = pkgs.senpai;
14      defaultText = literalExpression "pkgs.senpai";
15      description = "The `senpai` package to use.";
16    };
17    config = mkOption {
18      type = types.submodule {
19        freeformType = cfgFmt.type;
20        options = {
21          addr = mkOption {
22            type = types.str;
23            description = ''
24              The address (host[:port]) of the IRC server. senpai uses TLS
25              connections by default unless you specify no-tls option. TLS
26              connections default to port 6697, plain-text use port 6667.
27            '';
28          };
29          nick = mkOption {
30            type = types.str;
31            description = ''
32              Your nickname, sent with a NICK IRC message. It mustn't contain
33              spaces or colons (:).
34            '';
35          };
36          password = mkOption {
37            type = types.nullOr types.str;
38            default = null;
39            description = ''
40              Your password, used for SASL authentication. Note that it will
41              reside world-readable in the Nix store.
42            '';
43          };
44          no-tls = mkOption {
45            type = types.bool;
46            default = false;
47            description = "Disables TLS encryption.";
48          };
49        };
50      };
51      example = literalExpression ''
52        {
53          addr = "libera.chat:6697";
54          nick = "nicholas";
55          password = "verysecurepassword";
56        }
57      '';
58      description = ''
59        Configuration for senpai. For a complete list of options, see
60        {manpage}`senpai(5)`.
61      '';
62    };
63  };
64
65  config = mkIf cfg.enable {
66    home.packages = [ cfg.package ];
67    xdg.configFile."senpai/senpai.yaml".source =
68      cfgFmt.generate "senpai.yaml" cfg.config;
69  };
70
71  meta.maintainers = [ hm.maintainers.malvo ];
72}