2021-06-07 15:40:32 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
2023-11-11 10:19:45 +01:00
|
|
|
let cfg = config.programs.senpai;
|
2021-06-07 15:40:32 +02:00
|
|
|
in {
|
|
|
|
options.programs.senpai = {
|
2023-07-02 01:45:18 +02:00
|
|
|
enable = mkEnableOption "senpai";
|
2021-06-07 15:40:32 +02:00
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.senpai;
|
2021-10-09 11:14:08 +02:00
|
|
|
defaultText = literalExpression "pkgs.senpai";
|
2023-07-02 01:45:18 +02:00
|
|
|
description = "The `senpai` package to use.";
|
2021-06-07 15:40:32 +02:00
|
|
|
};
|
|
|
|
config = mkOption {
|
|
|
|
type = types.submodule {
|
2023-11-11 10:19:45 +01:00
|
|
|
freeformType = types.attrsOf types.anything;
|
2021-06-07 15:40:32 +02:00
|
|
|
options = {
|
2023-11-11 10:19:45 +01:00
|
|
|
address = mkOption {
|
2021-06-07 15:40:32 +02:00
|
|
|
type = types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2023-11-11 10:19:45 +01:00
|
|
|
The address (`host[:port]`) of the IRC server. senpai uses TLS
|
|
|
|
connections by default unless you specify tls option to be false.
|
|
|
|
TLS connections default to port 6697, plain-text use port 6667.
|
|
|
|
|
|
|
|
UR`ircs://`, `irc://`, and `irc+insecure://` URLs are supported,
|
|
|
|
in which case only the hostname and port parts will be used. If
|
|
|
|
the scheme is `ircs/irc+insecure`, tls will be overriden and set
|
|
|
|
to true/false accordingly.
|
2021-06-07 15:40:32 +02:00
|
|
|
'';
|
|
|
|
};
|
2023-11-11 10:19:45 +01:00
|
|
|
|
|
|
|
nickname = mkOption {
|
2021-06-07 15:40:32 +02:00
|
|
|
type = types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2021-06-07 15:40:32 +02:00
|
|
|
Your nickname, sent with a NICK IRC message. It mustn't contain
|
|
|
|
spaces or colons (:).
|
|
|
|
'';
|
|
|
|
};
|
2023-11-11 10:19:45 +01:00
|
|
|
|
2021-06-07 15:40:32 +02:00
|
|
|
password = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2021-06-07 15:40:32 +02:00
|
|
|
Your password, used for SASL authentication. Note that it will
|
|
|
|
reside world-readable in the Nix store.
|
|
|
|
'';
|
|
|
|
};
|
2023-11-11 10:19:45 +01:00
|
|
|
|
|
|
|
password-cmd = mkOption {
|
|
|
|
type = types.nullOr (types.listOf types.str);
|
|
|
|
default = null;
|
|
|
|
example = [ "gopass" "show" "irc/guest" ];
|
|
|
|
description = ''
|
|
|
|
Alternatively to providing your SASL authentication password
|
|
|
|
directly in plaintext, you can specify a command to be run to
|
|
|
|
fetch the password at runtime. This is useful if you store your
|
|
|
|
passwords in a separate (probably encrypted) file using `gpg` or a
|
|
|
|
command line password manager such as `pass` or `gopass`. If a
|
|
|
|
password-cmd is provided, the value of password will be ignored
|
|
|
|
and the first line of the output of `password-cmd` will be used
|
|
|
|
for login.
|
|
|
|
'';
|
2021-06-07 15:40:32 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2021-10-09 11:14:08 +02:00
|
|
|
example = literalExpression ''
|
2021-06-07 15:40:32 +02:00
|
|
|
{
|
2023-11-11 10:19:45 +01:00
|
|
|
address = "libera.chat:6697";
|
|
|
|
nickname = "nicholas";
|
2021-06-07 15:40:32 +02:00
|
|
|
password = "verysecurepassword";
|
|
|
|
}
|
|
|
|
'';
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2021-06-07 15:40:32 +02:00
|
|
|
Configuration for senpai. For a complete list of options, see
|
2023-07-01 01:30:13 +02:00
|
|
|
{manpage}`senpai(5)`.
|
2021-06-07 15:40:32 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2023-11-11 10:19:45 +01:00
|
|
|
assertions = with cfg.config; [
|
|
|
|
{
|
|
|
|
assertion = !isNull password-cmd -> isNull password;
|
|
|
|
message = "senpai: password-cmd overrides password!";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
assertion = !cfg.config ? addr;
|
|
|
|
message = "senpai: addr is deprecated, use address instead";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
assertion = !cfg.config ? nick;
|
|
|
|
message = "senpai: nick is deprecated, use nickname instead";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
assertion = !cfg.config ? no-tls;
|
|
|
|
message = "senpai: no-tls is deprecated, use tls instead";
|
|
|
|
}
|
|
|
|
];
|
2021-06-07 15:40:32 +02:00
|
|
|
home.packages = [ cfg.package ];
|
2023-11-11 10:19:45 +01:00
|
|
|
xdg.configFile."senpai/senpai.scfg".text =
|
|
|
|
lib.hm.generators.toSCFG { } cfg.config;
|
2021-06-07 15:40:32 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
meta.maintainers = [ hm.maintainers.malvo ];
|
|
|
|
}
|