From e5f14949de8dcbdc265d89676c7adbf6813be029 Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Tue, 27 Aug 2024 20:43:27 +0200 Subject: [PATCH] nixos/services.matter-server: remove `with lib;` --- .../home-automation/matter-server.nix | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/nixos/modules/services/home-automation/matter-server.nix b/nixos/modules/services/home-automation/matter-server.nix index 08a68db71386..8a59815eec66 100644 --- a/nixos/modules/services/home-automation/matter-server.nix +++ b/nixos/modules/services/home-automation/matter-server.nix @@ -3,9 +3,6 @@ , config , ... }: - -with lib; - let cfg = config.services.matter-server; storageDir = "matter-server"; @@ -16,24 +13,24 @@ in { meta.maintainers = with lib.maintainers; [ leonm1 ]; - options.services.matter-server = with types; { - enable = mkEnableOption "Matter-server"; + options.services.matter-server = with lib.types; { + enable = lib.mkEnableOption "Matter-server"; - package = mkPackageOption pkgs "python-matter-server" { }; + package = lib.mkPackageOption pkgs "python-matter-server" { }; - port = mkOption { - type = types.port; + port = lib.mkOption { + type = lib.types.port; default = 5580; description = "Port to expose the matter-server service on."; }; - logLevel = mkOption { - type = types.enum [ "critical" "error" "warning" "info" "debug" ]; + logLevel = lib.mkOption { + type = lib.types.enum [ "critical" "error" "warning" "info" "debug" ]; default = "info"; description = "Verbosity of logs from the matter-server"; }; - extraArgs = mkOption { + extraArgs = lib.mkOption { type = listOf str; default = []; description = '' @@ -43,7 +40,7 @@ in }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { systemd.services.matter-server = { after = [ "network-online.target" ]; before = [ "home-assistant.service" ]; @@ -52,13 +49,13 @@ in description = "Matter Server"; environment.HOME = storagePath; serviceConfig = { - ExecStart = (concatStringsSep " " [ + ExecStart = (lib.concatStringsSep " " [ "${cfg.package}/bin/matter-server" "--port" (toString cfg.port) "--vendorid" vendorId "--storage-path" storagePath "--log-level" "${cfg.logLevel}" - "${escapeShellArgs cfg.extraArgs}" + "${lib.escapeShellArgs cfg.extraArgs}" ]); # Start with a clean root filesystem, and allowlist what the container # is permitted to access. @@ -103,7 +100,7 @@ in RestrictNamespaces = true; RestrictRealtime = true; RestrictSUIDSGID = true; - SystemCallFilter = concatStringsSep " " [ + SystemCallFilter = lib.concatStringsSep " " [ "~" # Blocklist "@clock" "@cpu-emulation"