about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorFelix Buehler2024-08-24 22:05:43 +0200
committerFelix Buehler2024-08-30 23:00:48 +0200
commit4233be955da89cbcb18c24a3cdb5909e37a9c5d2 (patch)
tree1e45098c6c649233e2a067d9d0d1c2aabb69e730 /nixos
parentea8485f6c92a4bfbeb037880e878e805396d9c41 (diff)
nixos/services.etesync-dav: remove `with lib;`
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/misc/etesync-dav.nix39
1 files changed, 18 insertions, 21 deletions
diff --git a/nixos/modules/services/misc/etesync-dav.nix b/nixos/modules/services/misc/etesync-dav.nix
index ea659c61bd5a..2cccc51d1fbf 100644
--- a/nixos/modules/services/misc/etesync-dav.nix
+++ b/nixos/modules/services/misc/etesync-dav.nix
@@ -1,40 +1,37 @@
 { config, lib, pkgs, ... }:
-
-with lib;
-
 let
   cfg = config.services.etesync-dav;
 in
   {
     options.services.etesync-dav = {
-      enable = mkEnableOption "etesync-dav, end-to-end encrypted sync for contacts, calendars and tasks";
+      enable = lib.mkEnableOption "etesync-dav, end-to-end encrypted sync for contacts, calendars and tasks";
 
-      host = mkOption {
-        type = types.str;
+      host = lib.mkOption {
+        type = lib.types.str;
         default = "localhost";
         description = "The server host address.";
       };
 
-      port = mkOption {
-        type = types.port;
+      port = lib.mkOption {
+        type = lib.types.port;
         default = 37358;
         description = "The server host port.";
       };
 
-      apiUrl = mkOption {
-        type = types.str;
+      apiUrl = lib.mkOption {
+        type = lib.types.str;
         default = "https://api.etesync.com/";
         description = "The url to the etesync API.";
       };
 
-      openFirewall = mkOption {
+      openFirewall = lib.mkOption {
         default = false;
-        type = types.bool;
+        type = lib.types.bool;
         description = "Whether to open the firewall for the specified port.";
       };
 
-      sslCertificate = mkOption {
-        type = types.nullOr types.path;
+      sslCertificate = lib.mkOption {
+        type = lib.types.nullOr lib.types.path;
         default = null;
         example = "/var/etesync.crt";
         description = ''
@@ -43,8 +40,8 @@ in
         '';
       };
 
-      sslCertificateKey = mkOption {
-        type = types.nullOr types.path;
+      sslCertificateKey = lib.mkOption {
+        type = lib.types.nullOr lib.types.path;
         default = null;
         example = "/var/etesync.key";
         description = ''
@@ -54,8 +51,8 @@ in
       };
     };
 
-    config = mkIf cfg.enable {
-      networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ cfg.port ];
+    config = lib.mkIf cfg.enable {
+      networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [ cfg.port ];
 
       systemd.services.etesync-dav = {
         description = "etesync-dav - A CalDAV and CardDAV adapter for EteSync";
@@ -75,12 +72,12 @@ in
           DynamicUser = true;
           StateDirectory = "etesync-dav";
           ExecStart = "${pkgs.etesync-dav}/bin/etesync-dav";
-          ExecStartPre = mkIf (cfg.sslCertificate != null || cfg.sslCertificateKey != null) (
+          ExecStartPre = lib.mkIf (cfg.sslCertificate != null || cfg.sslCertificateKey != null) (
             pkgs.writers.writeBash "etesync-dav-copy-keys" ''
-              ${optionalString (cfg.sslCertificate != null) ''
+              ${lib.optionalString (cfg.sslCertificate != null) ''
                 cp ${toString cfg.sslCertificate} $STATE_DIRECTORY/etesync.crt
               ''}
-              ${optionalString (cfg.sslCertificateKey != null) ''
+              ${lib.optionalString (cfg.sslCertificateKey != null) ''
                 cp ${toString cfg.sslCertificateKey} $STATE_DIRECTORY/etesync.key
               ''}
             ''