nixos/services.bitlbee: remove with lib;

This commit is contained in:
Felix Buehler 2024-08-28 21:19:02 +02:00 committed by Jörg Thalheim
parent 416649cbe6
commit d9c47dac16

View file

@ -1,7 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let let
cfg = config.services.bitlbee; cfg = config.services.bitlbee;
@ -46,8 +43,8 @@ in
services.bitlbee = { services.bitlbee = {
enable = mkOption { enable = lib.mkOption {
type = types.bool; type = lib.types.bool;
default = false; default = false;
description = '' description = ''
Whether to run the BitlBee IRC to other chat network gateway. Whether to run the BitlBee IRC to other chat network gateway.
@ -56,8 +53,8 @@ in
''; '';
}; };
interface = mkOption { interface = lib.mkOption {
type = types.str; type = lib.types.str;
default = "127.0.0.1"; default = "127.0.0.1";
description = '' description = ''
The interface the BitlBee daemon will be listening to. If `127.0.0.1`, The interface the BitlBee daemon will be listening to. If `127.0.0.1`,
@ -66,17 +63,17 @@ in
''; '';
}; };
portNumber = mkOption { portNumber = lib.mkOption {
default = 6667; default = 6667;
type = types.port; type = lib.types.port;
description = '' description = ''
Number of the port BitlBee will be listening to. Number of the port BitlBee will be listening to.
''; '';
}; };
authBackend = mkOption { authBackend = lib.mkOption {
default = "storage"; default = "storage";
type = types.enum [ "storage" "pam" ]; type = lib.types.enum [ "storage" "pam" ];
description = '' description = ''
How users are authenticated How users are authenticated
storage -- save passwords internally storage -- save passwords internally
@ -84,9 +81,9 @@ in
''; '';
}; };
authMode = mkOption { authMode = lib.mkOption {
default = "Open"; default = "Open";
type = types.enum [ "Open" "Closed" "Registered" ]; type = lib.types.enum [ "Open" "Closed" "Registered" ];
description = '' description = ''
The following authentication modes are available: The following authentication modes are available:
Open -- Accept connections from anyone, use NickServ for user authentication. Open -- Accept connections from anyone, use NickServ for user authentication.
@ -95,9 +92,9 @@ in
''; '';
}; };
hostName = mkOption { hostName = lib.mkOption {
default = ""; default = "";
type = types.str; type = lib.types.str;
description = '' description = ''
Normally, BitlBee gets a hostname using getsockname(). If you have a nicer Normally, BitlBee gets a hostname using getsockname(). If you have a nicer
alias for your BitlBee daemon, you can set it here and BitlBee will identify alias for your BitlBee daemon, you can set it here and BitlBee will identify
@ -105,53 +102,53 @@ in
''; '';
}; };
plugins = mkOption { plugins = lib.mkOption {
type = types.listOf types.package; type = lib.types.listOf lib.types.package;
default = []; default = [];
example = literalExpression "[ pkgs.bitlbee-facebook ]"; example = lib.literalExpression "[ pkgs.bitlbee-facebook ]";
description = '' description = ''
The list of bitlbee plugins to install. The list of bitlbee plugins to install.
''; '';
}; };
libpurple_plugins = mkOption { libpurple_plugins = lib.mkOption {
type = types.listOf types.package; type = lib.types.listOf lib.types.package;
default = []; default = [];
example = literalExpression "[ pkgs.purple-matrix ]"; example = lib.literalExpression "[ pkgs.purple-matrix ]";
description = '' description = ''
The list of libpurple plugins to install. The list of libpurple plugins to install.
''; '';
}; };
configDir = mkOption { configDir = lib.mkOption {
default = "/var/lib/bitlbee"; default = "/var/lib/bitlbee";
type = types.path; type = lib.types.path;
description = '' description = ''
Specify an alternative directory to store all the per-user configuration Specify an alternative directory to store all the per-user configuration
files. files.
''; '';
}; };
protocols = mkOption { protocols = lib.mkOption {
default = ""; default = "";
type = types.str; type = lib.types.str;
description = '' description = ''
This option allows to remove the support of protocol, even if compiled This option allows to remove the support of protocol, even if compiled
in. If nothing is given, there are no restrictions. in. If nothing is given, there are no restrictions.
''; '';
}; };
extraSettings = mkOption { extraSettings = lib.mkOption {
default = ""; default = "";
type = types.lines; type = lib.types.lines;
description = '' description = ''
Will be inserted in the Settings section of the config file. Will be inserted in the Settings section of the config file.
''; '';
}; };
extraDefaults = mkOption { extraDefaults = lib.mkOption {
default = ""; default = "";
type = types.lines; type = lib.types.lines;
description = '' description = ''
Will be inserted in the Default section of the config file. Will be inserted in the Default section of the config file.
''; '';
@ -163,8 +160,8 @@ in
###### implementation ###### implementation
config = mkMerge [ config = lib.mkMerge [
(mkIf config.services.bitlbee.enable { (lib.mkIf config.services.bitlbee.enable {
systemd.services.bitlbee = { systemd.services.bitlbee = {
environment.PURPLE_PLUGIN_PATH = purple_plugin_path; environment.PURPLE_PLUGIN_PATH = purple_plugin_path;
description = "BitlBee IRC to other chat networks gateway"; description = "BitlBee IRC to other chat networks gateway";
@ -182,7 +179,7 @@ in
environment.systemPackages = [ bitlbeePkg ]; environment.systemPackages = [ bitlbeePkg ];
}) })
(mkIf (config.services.bitlbee.authBackend == "pam") { (lib.mkIf (config.services.bitlbee.authBackend == "pam") {
security.pam.services.bitlbee = {}; security.pam.services.bitlbee = {};
}) })
]; ];