2020-06-10 02:13:25 +02:00
|
|
|
# A more modern module for running Quassel.
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.depot.quassel;
|
|
|
|
quasselDaemon = pkgs.quassel.override {
|
|
|
|
monolithic = false;
|
|
|
|
enableDaemon = true;
|
|
|
|
withKDE = false;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.services.depot.quassel = with lib; {
|
|
|
|
enable = mkEnableOption "Quassel IRC daemon";
|
|
|
|
|
|
|
|
acmeHost = mkOption {
|
|
|
|
description = "ACME host to use for the Quassel TLS certificate";
|
|
|
|
type = lib.types.str;
|
|
|
|
};
|
|
|
|
|
|
|
|
bindAddresses = mkOption {
|
|
|
|
description = "Addresses Quassel will bind to/listen on";
|
|
|
|
default = [ "127.0.0.1" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
logLevel = mkOption {
|
|
|
|
description = "Log level for Quassel Core";
|
|
|
|
default = "Info";
|
|
|
|
type = lib.types.enum [
|
|
|
|
"Debug"
|
|
|
|
"Info"
|
|
|
|
"Warning"
|
|
|
|
"Error"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
port = mkOption {
|
|
|
|
default = 6698;
|
|
|
|
description = ''
|
|
|
|
The port number the Quassel daemon will be listening to.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = with lib; mkIf cfg.enable {
|
2022-03-10 16:58:02 +01:00
|
|
|
networking.firewall.allowedTCPPorts = [ cfg.port ];
|
|
|
|
|
2020-06-10 02:13:25 +02:00
|
|
|
systemd.services.quassel = {
|
|
|
|
description = "Quassel IRC daemon";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
|
|
|
|
script = concatStringsSep " " [
|
|
|
|
"${quasselDaemon}/bin/quasselcore"
|
|
|
|
"--listen=${concatStringsSep "," cfg.bindAddresses}"
|
|
|
|
"--port=${toString cfg.port}"
|
|
|
|
"--configdir=/var/lib/quassel"
|
|
|
|
"--require-ssl"
|
2023-06-15 22:20:19 +02:00
|
|
|
"--ssl-cert=$CREDENTIALS_DIRECTORY/quassel.pem"
|
2020-06-10 02:13:25 +02:00
|
|
|
"--loglevel=${cfg.logLevel}"
|
|
|
|
];
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Restart = "always";
|
|
|
|
User = "quassel";
|
|
|
|
Group = "quassel";
|
|
|
|
StateDirectory = "quassel";
|
2023-06-15 22:20:19 +02:00
|
|
|
|
|
|
|
# Avoid trouble with the ACME file permissions by using the
|
|
|
|
# systemd credentials feature.
|
|
|
|
LoadCredential = "quassel.pem:/var/lib/acme/${cfg.acmeHost}/full.pem";
|
2020-06-10 02:13:25 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
users = {
|
|
|
|
users.quassel = {
|
2021-04-13 12:21:42 +02:00
|
|
|
isSystemUser = true;
|
2020-06-10 02:13:25 +02:00
|
|
|
group = "quassel";
|
|
|
|
};
|
|
|
|
|
|
|
|
groups.quassel = { };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|