From 0a78cd4f73b9dee641bb5b538231cdef547297ac Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Sat, 24 Aug 2024 22:05:37 +0200 Subject: [PATCH] nixos/services.pantalaimon-headless: remove `with lib;` --- .../services/matrix/pantalaimon-options.nix | 32 +++++++++---------- nixos/modules/services/matrix/pantalaimon.nix | 16 ++++------ 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/nixos/modules/services/matrix/pantalaimon-options.nix b/nixos/modules/services/matrix/pantalaimon-options.nix index 4243513788b5..b3a663f59931 100644 --- a/nixos/modules/services/matrix/pantalaimon-options.nix +++ b/nixos/modules/services/matrix/pantalaimon-options.nix @@ -1,26 +1,24 @@ { config, lib, name, ... }: - -with lib; { options = { - dataPath = mkOption { - type = types.path; + dataPath = lib.mkOption { + type = lib.types.path; default = "/var/lib/pantalaimon-${name}"; description = '' The directory where `pantalaimon` should store its state such as the database file. ''; }; - logLevel = mkOption { - type = types.enum [ "info" "warning" "error" "debug" ]; + logLevel = lib.mkOption { + type = lib.types.enum [ "info" "warning" "error" "debug" ]; default = "warning"; description = '' Set the log level of the daemon. ''; }; - homeserver = mkOption { - type = types.str; + homeserver = lib.mkOption { + type = lib.types.str; example = "https://matrix.org"; description = '' The URI of the homeserver that the `pantalaimon` proxy should @@ -29,8 +27,8 @@ with lib; ''; }; - ssl = mkOption { - type = types.bool; + ssl = lib.mkOption { + type = lib.types.bool; default = true; description = '' Whether or not SSL verification should be enabled for outgoing @@ -38,8 +36,8 @@ with lib; ''; }; - listenAddress = mkOption { - type = types.str; + listenAddress = lib.mkOption { + type = lib.types.str; default = "localhost"; description = '' The address where the daemon will listen to client connections @@ -47,18 +45,18 @@ with lib; ''; }; - listenPort = mkOption { - type = types.port; + listenPort = lib.mkOption { + type = lib.types.port; default = 8009; description = '' The port where the daemon will listen to client connections for this homeserver. Note that the listen address/port combination - needs to be unique between different homeservers. + needs to be lib.unique between different homeservers. ''; }; - extraSettings = mkOption { - type = types.attrs; + extraSettings = lib.mkOption { + type = lib.types.attrs; default = { }; description = '' Extra configuration options. See diff --git a/nixos/modules/services/matrix/pantalaimon.nix b/nixos/modules/services/matrix/pantalaimon.nix index 6f3fefdb3430..28fcdcee973f 100644 --- a/nixos/modules/services/matrix/pantalaimon.nix +++ b/nixos/modules/services/matrix/pantalaimon.nix @@ -1,6 +1,4 @@ { config, lib, pkgs, ... }: - -with lib; let cfg = config.services.pantalaimon-headless; @@ -12,7 +10,7 @@ let Notifications = false; }; - ${name} = (recursiveUpdate + ${name} = (lib.recursiveUpdate { Homeserver = instanceConfig.homeserver; ListenAddress = instanceConfig.listenAddress; @@ -28,7 +26,7 @@ let }; mkPantalaimonService = name: instanceConfig: - nameValuePair "pantalaimon-${name}" { + lib.nameValuePair "pantalaimon-${name}" { description = "pantalaimon instance ${name} - E2EE aware proxy daemon for matrix clients"; wants = [ "network-online.target" ]; after = [ "network-online.target" ]; @@ -48,9 +46,9 @@ let }; in { - options.services.pantalaimon-headless.instances = mkOption { + options.services.pantalaimon-headless.instances = lib.mkOption { default = { }; - type = types.attrsOf (types.submodule (import ./pantalaimon-options.nix)); + type = lib.types.attrsOf (lib.types.submodule (import ./pantalaimon-options.nix)); description = '' Declarative instance config. @@ -59,12 +57,12 @@ in ''; }; - config = mkIf (config.services.pantalaimon-headless.instances != { }) + config = lib.mkIf (config.services.pantalaimon-headless.instances != { }) { - systemd.services = mapAttrs' mkPantalaimonService config.services.pantalaimon-headless.instances; + systemd.services = lib.mapAttrs' mkPantalaimonService config.services.pantalaimon-headless.instances; }; meta = { - maintainers = with maintainers; [ jojosch ]; + maintainers = with lib.maintainers; [ jojosch ]; }; }