From 3ffe2a4cdf5896081edb2b661fa27316309dc624 Mon Sep 17 00:00:00 2001
From: malte-v <34393802+malte-v@users.noreply.github.com>
Date: Mon, 7 Jun 2021 15:40:32 +0200
Subject: [PATCH] programs.senpai: add module (#2076)
* maintainers: add malvo
* programs.senpai: add module
---
.github/CODEOWNERS | 2 +
modules/lib/maintainers.nix | 6 +++
modules/modules.nix | 1 +
modules/programs/senpai.nix | 73 +++++++++++++++++++++++++++++++++++++
4 files changed, 82 insertions(+)
create mode 100644 modules/programs/senpai.nix
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 205453ac..2a4325ee 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -167,6 +167,8 @@
/modules/programs/scmpuff.nix @cpcloud
/tests/modules/programs/scmpuff @cpcloud
+/modules/programs/senpai.nix @malte-v
+
/modules/programs/ssh.nix @rycee
/modules/programs/starship.nix @marsam
diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix
index e41645b1..a69a9bb6 100644
--- a/modules/lib/maintainers.nix
+++ b/modules/lib/maintainers.nix
@@ -87,4 +87,10 @@
githubId = 12465195;
name = "Bruno BELANYI";
};
+ malvo = {
+ email = "malte@malvo.org";
+ github = "malte-v";
+ githubId = 34393802;
+ name = "Malte Voos";
+ };
}
diff --git a/modules/modules.nix b/modules/modules.nix
index b04005e9..977c3a77 100644
--- a/modules/modules.nix
+++ b/modules/modules.nix
@@ -126,6 +126,7 @@ let
(loadModule ./programs/rofi-pass.nix { })
(loadModule ./programs/rtorrent.nix { })
(loadModule ./programs/scmpuff.nix { })
+ (loadModule ./programs/senpai.nix { })
(loadModule ./programs/skim.nix { })
(loadModule ./programs/starship.nix { })
(loadModule ./programs/sbt.nix { })
diff --git a/modules/programs/senpai.nix b/modules/programs/senpai.nix
new file mode 100644
index 00000000..6e5a4a0a
--- /dev/null
+++ b/modules/programs/senpai.nix
@@ -0,0 +1,73 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.programs.senpai;
+ cfgFmt = pkgs.formats.yaml { };
+in {
+ options.programs.senpai = {
+ enable = mkEnableOption "senpai";
+ package = mkOption {
+ type = types.package;
+ default = pkgs.senpai;
+ defaultText = literalExample "pkgs.senpai";
+ description = "The senpai package to use.";
+ };
+ config = mkOption {
+ type = types.submodule {
+ freeformType = cfgFmt.type;
+ options = {
+ addr = mkOption {
+ type = types.str;
+ description = ''
+ The address (host[:port]) of the IRC server. senpai uses TLS
+ connections by default unless you specify no-tls option. TLS
+ connections default to port 6697, plain-text use port 6667.
+ '';
+ };
+ nick = mkOption {
+ type = types.str;
+ description = ''
+ Your nickname, sent with a NICK IRC message. It mustn't contain
+ spaces or colons (:).
+ '';
+ };
+ password = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ description = ''
+ Your password, used for SASL authentication. Note that it will
+ reside world-readable in the Nix store.
+ '';
+ };
+ no-tls = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Disables TLS encryption.";
+ };
+ };
+ };
+ example = literalExample ''
+ {
+ addr = "libera.chat:6697";
+ nick = "nicholas";
+ password = "verysecurepassword";
+ }
+ '';
+ description = ''
+ Configuration for senpai. For a complete list of options, see
+ senpai
+ 5.
+ '';
+ };
+ };
+
+ config = mkIf cfg.enable {
+ home.packages = [ cfg.package ];
+ xdg.configFile."senpai/senpai.yaml".source =
+ cfgFmt.generate "senpai.yaml" cfg.config;
+ };
+
+ meta.maintainers = [ hm.maintainers.malvo ];
+}