From 160025ca46e48a6a0b2bdb971801a0470f744500 Mon Sep 17 00:00:00 2001 From: David Morgan Date: Sat, 29 Oct 2022 15:58:14 +0100 Subject: [PATCH] irssi: add option for SASL external authentication --- modules/programs/irssi.nix | 16 +++++++++++++++- .../irssi/example-settings-expected.config | 2 ++ .../modules/programs/irssi/example-settings.nix | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/modules/programs/irssi.nix b/modules/programs/irssi.nix index 3d830a4f..355be085 100644 --- a/modules/programs/irssi.nix +++ b/modules/programs/irssi.nix @@ -23,6 +23,11 @@ let type = "${v.type}"; nick = "${quoteStr v.nick}"; autosendcmd = "${concatMapStringsSep ";" quoteStr v.autoCommands}"; + ${ + lib.optionalString (v.saslExternal) '' + sasl_username = "${quoteStr v.nick}"; + sasl_mechanism = "EXTERNAL";'' + } }; '')); @@ -36,7 +41,7 @@ let ssl_verify = "${lib.hm.booleans.yesNo v.server.ssl.verify}"; autoconnect = "${lib.hm.booleans.yesNo v.server.autoConnect}"; ${ - lib.optionalString (v.server.ssl.certificateFile != null) '' + optionalString (v.server.ssl.certificateFile != null) '' ssl_cert = "${v.server.ssl.certificateFile}"; '' } @@ -142,6 +147,15 @@ let type = types.attrsOf channelType; default = { }; }; + + saslExternal = mkOption { + type = types.bool; + default = false; + description = '' + Enable SASL external authentication. This requires setting a path in + . + ''; + }; }; }); diff --git a/tests/modules/programs/irssi/example-settings-expected.config b/tests/modules/programs/irssi/example-settings-expected.config index 8c54243b..6857eccf 100644 --- a/tests/modules/programs/irssi/example-settings-expected.config +++ b/tests/modules/programs/irssi/example-settings-expected.config @@ -13,6 +13,8 @@ oftc = { type = "IRC"; nick = "nick"; autosendcmd = ""; + sasl_username = "nick"; + sasl_mechanism = "EXTERNAL"; }; }; diff --git a/tests/modules/programs/irssi/example-settings.nix b/tests/modules/programs/irssi/example-settings.nix index 93cf9f2d..f279b03c 100644 --- a/tests/modules/programs/irssi/example-settings.nix +++ b/tests/modules/programs/irssi/example-settings.nix @@ -8,6 +8,7 @@ with lib; enable = true; networks.oftc = { nick = "nick"; + saslExternal = true; server = { address = "irc.oftc.net"; port = 6697;