diff options
Diffstat (limited to 'modules/communication')
| -rw-r--r-- | modules/communication/default.nix | 3 | ||||
| -rw-r--r-- | modules/communication/senpai/assertions.nix | 20 | ||||
| -rw-r--r-- | modules/communication/senpai/default.nix | 57 |
3 files changed, 79 insertions, 1 deletions
diff --git a/modules/communication/default.nix b/modules/communication/default.nix index 70afc8d..1c7fd6a 100644 --- a/modules/communication/default.nix +++ b/modules/communication/default.nix @@ -1,7 +1,8 @@ -# Email client modules +# Communication modules { ... }: { imports = [ ./neomutt + ./senpai ]; } diff --git a/modules/communication/senpai/assertions.nix b/modules/communication/senpai/assertions.nix new file mode 100644 index 0000000..ed2cce8 --- /dev/null +++ b/modules/communication/senpai/assertions.nix @@ -0,0 +1,20 @@ +# Validates Senpai dependencies. +{ config, ... }: +{ + assertions = [ + { + assertion = !config.communication.senpai.enable || config.communication.senpai.server.address != ""; + message = "communication.senpai.enable requires communication.senpai.server.address to be set."; + } + { + assertion = + !config.communication.senpai.enable || config.communication.senpai.identity.nickname != ""; + message = "communication.senpai.enable requires communication.senpai.identity.nickname to be set."; + } + { + assertion = + config.communication.senpai.identity.passwordGopassSecret == null || config.security.gopass.enable; + message = "communication.senpai.identity.passwordGopassSecret requires security.gopass.enable."; + } + ]; +} diff --git a/modules/communication/senpai/default.nix b/modules/communication/senpai/default.nix new file mode 100644 index 0000000..51fc041 --- /dev/null +++ b/modules/communication/senpai/default.nix @@ -0,0 +1,57 @@ +# Senpai TUI IRC client module +{ + config, + lib, + pkgs, + ... +}: +{ + 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 = { + address = lib.mkOption { + type = lib.types.str; + description = "IRC server address (host[:port]). Supports irc://, ircs://, irc+insecure:// URLs."; + }; + }; + + identity = { + nickname = lib.mkOption { + type = lib.types.str; + description = "Your IRC nickname (no spaces or colons)."; + }; + + passwordGopassSecret = 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."; + }; + }; + }; + + config = lib.mkIf config.communication.senpai.enable { + programs.senpai = { + enable = true; + package = config.communication.senpai.package; + config = { + address = config.communication.senpai.server.address; + nickname = config.communication.senpai.identity.nickname; + password-cmd = lib.mkIf (config.communication.senpai.identity.passwordGopassSecret != null) [ + (lib.getExe config.security.gopass.package) + "show" + "-o" + config.communication.senpai.identity.passwordGopassSecret + ]; + }; + }; + }; +} |
