nixos/services.mx-puppet-discord: remove with lib;

This commit is contained in:
Felix Buehler 2024-08-24 22:05:37 +02:00
parent 0f517df99c
commit ec70164f24

View File

@ -1,7 +1,4 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with lib;
let let
dataDir = "/var/lib/mx-puppet-discord"; dataDir = "/var/lib/mx-puppet-discord";
registrationFile = "${dataDir}/discord-registration.yaml"; registrationFile = "${dataDir}/discord-registration.yaml";
@ -12,13 +9,13 @@ let
in { in {
options = { options = {
services.mx-puppet-discord = { services.mx-puppet-discord = {
enable = mkEnableOption '' enable = lib.mkEnableOption ''
mx-puppet-discord is a discord puppeting bridge for matrix. mx-puppet-discord is a discord puppeting bridge for matrix.
It handles bridging private and group DMs, as well as Guilds (servers) It handles bridging private and group DMs, as well as Guilds (servers)
''; '';
settings = mkOption rec { settings = lib.mkOption rec {
apply = recursiveUpdate default; apply = lib.recursiveUpdate default;
inherit (settingsFormat) type; inherit (settingsFormat) type;
default = { default = {
bridge.port = 8434; bridge.port = 8434;
@ -45,7 +42,7 @@ in {
lineDateFormat = "MMM-D HH:mm:ss.SSS"; lineDateFormat = "MMM-D HH:mm:ss.SSS";
}; };
}; };
example = literalExpression '' example = lib.literalExpression ''
{ {
bridge = { bridge = {
bindAddress = "localhost"; bindAddress = "localhost";
@ -64,11 +61,11 @@ in {
sample.config.yaml](https://github.com/matrix-discord/mx-puppet-discord/blob/master/sample.config.yaml). sample.config.yaml](https://github.com/matrix-discord/mx-puppet-discord/blob/master/sample.config.yaml).
''; '';
}; };
serviceDependencies = mkOption { serviceDependencies = lib.mkOption {
type = with types; listOf str; type = with lib.types; listOf str;
default = optional config.services.matrix-synapse.enable config.services.matrix-synapse.serviceUnit; default = lib.optional config.services.matrix-synapse.enable config.services.matrix-synapse.serviceUnit;
defaultText = literalExpression '' defaultText = lib.literalExpression ''
optional config.services.matrix-synapse.enable config.services.matrix-synapse.serviceUnit lib.optional config.services.matrix-synapse.enable config.services.matrix-synapse.serviceUnit
''; '';
description = '' description = ''
List of Systemd services to require and wait for when starting the application service. List of Systemd services to require and wait for when starting the application service.
@ -77,7 +74,7 @@ in {
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
systemd.services.mx-puppet-discord = { systemd.services.mx-puppet-discord = {
description = "Matrix to Discord puppeting bridge"; description = "Matrix to Discord puppeting bridge";
@ -118,5 +115,5 @@ in {
}; };
}; };
meta.maintainers = with maintainers; [ govanify ]; meta.maintainers = with lib.maintainers; [ govanify ];
} }