blob: 49f82d93684360853d42ab2fc894761651de6fc3 (
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# Senpai TUI IRC client module
{
config,
lib,
pkgs,
...
}:
let
cfg = config.communication.senpai;
in
{
imports = [ ./assertions.nix ];
options.communication.senpai = {
enable = lib.mkEnableOption "Senpai TUI IRC client";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.senpai;
description = "The senpai package to use.";
};
server = lib.mkOption {
type = lib.types.submodule {
options = {
address = lib.mkOption {
type = lib.types.str;
description = "IRC server address (host[:port]). Supports irc://, ircs://, irc+insecure:// URLs.";
};
};
};
default = { };
description = "IRC server configuration.";
};
identity = lib.mkOption {
type = lib.types.submodule {
options = {
nickname = lib.mkOption {
type = lib.types.str;
description = "Your IRC nickname (no spaces or colons).";
};
password-gopass-secret = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = "Gopass secret path for SASL password (e.g. irc/user@server). Constructs password-cmd automatically.";
};
};
};
default = { };
description = "Identity configuration.";
};
};
config = lib.mkMerge [
(lib.mkIf cfg.enable {
programs.senpai = {
enable = true;
package = cfg.package;
config = {
address = cfg.server.address;
nickname = cfg.identity.nickname;
password-cmd = lib.mkIf (cfg.identity.password-gopass-secret != null) [
(lib.getExe config.security.gopass.package)
"show"
"-o"
cfg.identity.password-gopass-secret
];
};
};
})
(lib.mkIf (cfg.enable && config.terminal.kitty.enable) {
xdg.desktopEntries."senpai" = {
name = "Senpai";
exec = "${lib.getExe config.terminal.kitty.package} --class senpai -e ${lib.getExe cfg.package}";
icon = "senpai";
categories = [
"Network"
"Chat"
];
comment = "Senpai TUI IRC Client";
terminal = false;
type = "Application";
};
xdg.mimeApps.defaultApplications = {
"x-scheme-handler/irc" = "senpai.desktop";
"x-scheme-handler/ircs" = "senpai.desktop";
};
})
];
}
|