mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
irssi: add ssl_cert option for servers (#2043)
* irssi: add ssl_cert option for servers I was following these instructions https://www.oftc.net/NickServ/CertFP/ and found that the `/server add -ssl_cert` option was needed. This patch therefore adds an optional `programs.irssi.networks.<name>.server.ssl.certificateFile` path. Perhaps this could also be done with a `settings` attribute, but that would probably require most of this module to be reworked. * irsii: Add example-settings test case
This commit is contained in:
parent
7591c8041d
commit
afb5fd962c
5 changed files with 88 additions and 0 deletions
|
@ -35,6 +35,9 @@ let
|
||||||
use_ssl = "${boolStr v.server.ssl.enable}";
|
use_ssl = "${boolStr v.server.ssl.enable}";
|
||||||
ssl_verify = "${boolStr v.server.ssl.verify}";
|
ssl_verify = "${boolStr v.server.ssl.verify}";
|
||||||
autoconnect = "${boolStr v.server.autoConnect}";
|
autoconnect = "${boolStr v.server.autoConnect}";
|
||||||
|
${lib.optionalString (v.server.ssl.certificateFile != null) ''
|
||||||
|
ssl_cert = "${v.server.ssl.certificateFile}";
|
||||||
|
''}
|
||||||
}
|
}
|
||||||
''));
|
''));
|
||||||
|
|
||||||
|
@ -118,6 +121,15 @@ let
|
||||||
default = true;
|
default = true;
|
||||||
description = "Whether the SSL certificate should be verified.";
|
description = "Whether the SSL certificate should be verified.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
certificateFile = mkOption {
|
||||||
|
type = types.nullOr types.path;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Path to a file containing the certificate used for
|
||||||
|
client authentication to the server.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
autoConnect = mkOption {
|
autoConnect = mkOption {
|
||||||
|
|
|
@ -55,6 +55,7 @@ import nmt {
|
||||||
./modules/programs/gpg
|
./modules/programs/gpg
|
||||||
./modules/programs/htop
|
./modules/programs/htop
|
||||||
./modules/programs/i3status
|
./modules/programs/i3status
|
||||||
|
./modules/programs/irsii
|
||||||
./modules/programs/kakoune
|
./modules/programs/kakoune
|
||||||
./modules/programs/kitty
|
./modules/programs/kitty
|
||||||
./modules/programs/lf
|
./modules/programs/lf
|
||||||
|
|
1
tests/modules/programs/irsii/default.nix
Normal file
1
tests/modules/programs/irsii/default.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{ irsii-example-settings = ./example-settings.nix; }
|
|
@ -0,0 +1,43 @@
|
||||||
|
settings = {
|
||||||
|
core = {
|
||||||
|
settings_autosave = "no";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
aliases = {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
chatnets = {
|
||||||
|
oftc = {
|
||||||
|
type = "IRC";
|
||||||
|
nick = "nick";
|
||||||
|
autosendcmd = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
servers = (
|
||||||
|
{
|
||||||
|
chatnet = "oftc";
|
||||||
|
address = "irc.oftc.net";
|
||||||
|
port = "6697";
|
||||||
|
use_ssl = "yes";
|
||||||
|
ssl_verify = "yes";
|
||||||
|
autoconnect = "yes";
|
||||||
|
ssl_cert = "/home/hm-user/.irssi/certs/nick.pem";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
channels = (
|
||||||
|
{
|
||||||
|
chatnet = "oftc";
|
||||||
|
name = "home-manager";
|
||||||
|
autojoin = "yes";
|
||||||
|
}
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
|
31
tests/modules/programs/irsii/example-settings.nix
Normal file
31
tests/modules/programs/irsii/example-settings.nix
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
programs.irssi = {
|
||||||
|
enable = true;
|
||||||
|
networks.oftc = {
|
||||||
|
nick = "nick";
|
||||||
|
server = {
|
||||||
|
address = "irc.oftc.net";
|
||||||
|
port = 6697;
|
||||||
|
autoConnect = true;
|
||||||
|
ssl.certificateFile =
|
||||||
|
"${config.home.homeDirectory}/.irssi/certs/nick.pem";
|
||||||
|
};
|
||||||
|
channels.home-manager.autoJoin = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileContent \
|
||||||
|
home-files/.irssi/config \
|
||||||
|
${./example-settings-expected.config}
|
||||||
|
'';
|
||||||
|
|
||||||
|
nixpkgs.overlays =
|
||||||
|
[ (self: super: { irsii = pkgs.writeScriptBin "dummy-irsii" ""; }) ];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue