nixos/services.matterbridge: remove with lib;

This commit is contained in:
Felix Buehler
2024-09-15 10:43:57 +02:00
committed by Jörg Thalheim
parent 252e9bb1e7
commit 1cd7970bb8
@@ -1,7 +1,4 @@
{ options, config, pkgs, lib, ... }:
with lib;
let
cfg = config.services.matterbridge;
@@ -17,12 +14,12 @@ in
{
options = {
services.matterbridge = {
enable = mkEnableOption "Matterbridge chat platform bridge";
enable = lib.mkEnableOption "Matterbridge chat platform bridge";
package = mkPackageOption pkgs "matterbridge" { };
package = lib.mkPackageOption pkgs "matterbridge" { };
configPath = mkOption {
type = with types; nullOr str;
configPath = lib.mkOption {
type = with lib.types; nullOr str;
default = null;
example = "/etc/nixos/matterbridge.toml";
description = ''
@@ -30,8 +27,8 @@ in
'';
};
configFile = mkOption {
type = types.str;
configFile = lib.mkOption {
type = lib.types.str;
example = ''
# WARNING: as this file contains credentials, do not use this option!
# It is kept only for backwards compatibility, and would cause your
@@ -72,16 +69,16 @@ in
The matterbridge configuration file in the TOML file format.
'';
};
user = mkOption {
type = types.str;
user = lib.mkOption {
type = lib.types.str;
default = "matterbridge";
description = ''
User which runs the matterbridge service.
'';
};
group = mkOption {
type = types.str;
group = lib.mkOption {
type = lib.types.str;
default = "matterbridge";
description = ''
Group which runs the matterbridge service.
@@ -90,18 +87,18 @@ in
};
};
config = mkIf cfg.enable {
warnings = optional options.services.matterbridge.configFile.isDefined
config = lib.mkIf cfg.enable {
warnings = lib.optional options.services.matterbridge.configFile.isDefined
"The option services.matterbridge.configFile is insecure and should be replaced with services.matterbridge.configPath";
users.users = optionalAttrs (cfg.user == "matterbridge")
users.users = lib.optionalAttrs (cfg.user == "matterbridge")
{ matterbridge = {
group = "matterbridge";
isSystemUser = true;
};
};
users.groups = optionalAttrs (cfg.group == "matterbridge")
users.groups = lib.optionalAttrs (cfg.group == "matterbridge")
{ matterbridge = { };
};