---
Function {
 argument: None,
 arguments: FunctionArguments {
  arguments: [
   FunctionArgument {
    identifier: "pkgs",
    default: None,
   },
   FunctionArgument {
    identifier: "lib",
    default: None,
   },
   FunctionArgument {
    identifier: "config",
    default: None,
   },
  ],
  ellipsis: true,
 },
 definition: With {
  expression: Variable {
   identifier: "lib",
   position: (3, 6),
  },
  target: LetIn {
   bindings: [
    KeyValue(
     AttributePath {
      attributes: [
       Raw {
        content: "cfg",
        position: (6, 3),
       },
      ],
     },
     PropertyAccess {
      expression: Variable {
       identifier: "config",
       position: (6, 9),
      },
      attribute_path: AttributePath {
       attributes: [
        Raw {
         content: "services",
         position: (6, 16),
        },
        Raw {
         content: "etesync-dav",
         position: (6, 25),
        },
       ],
      },
      default: None,
     },
    ),
   ],
   target: Map {
    bindings: [
     KeyValue(
      AttributePath {
       attributes: [
        Raw {
         content: "options",
         position: (9, 5),
        },
        Raw {
         content: "services",
         position: (9, 13),
        },
        Raw {
         content: "etesync-dav",
         position: (9, 22),
        },
       ],
      },
      Map {
       bindings: [
        KeyValue(
         AttributePath {
          attributes: [
           Raw {
            content: "enable",
            position: (10, 7),
           },
          ],
         },
         FunctionApplication {
          function: Variable {
           identifier: "mkEnableOption",
           position: (10, 16),
          },
          arguments: [
           String {
            parts: [
             Raw {
              content: "etesync-dav",
              position: (10, 32),
             },
            ],
           },
          ],
         },
        ),
        KeyValue(
         AttributePath {
          attributes: [
           Raw {
            content: "host",
            position: (12, 7),
           },
          ],
         },
         FunctionApplication {
          function: Variable {
           identifier: "mkOption",
           position: (12, 14),
          },
          arguments: [
           Map {
            bindings: [
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "type",
                 position: (13, 9),
                },
               ],
              },
              PropertyAccess {
               expression: Variable {
                identifier: "types",
                position: (13, 16),
               },
               attribute_path: AttributePath {
                attributes: [
                 Raw {
                  content: "str",
                  position: (13, 22),
                 },
                ],
               },
               default: None,
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "default",
                 position: (14, 9),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "localhost",
                 position: (14, 20),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "description",
                 position: (15, 9),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "The server host address.",
                 position: (15, 24),
                },
               ],
              },
             ),
            ],
            recursive: false,
            position: (12, 23),
           },
          ],
         },
        ),
        KeyValue(
         AttributePath {
          attributes: [
           Raw {
            content: "port",
            position: (18, 7),
           },
          ],
         },
         FunctionApplication {
          function: Variable {
           identifier: "mkOption",
           position: (18, 14),
          },
          arguments: [
           Map {
            bindings: [
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "type",
                 position: (19, 9),
                },
               ],
              },
              PropertyAccess {
               expression: Variable {
                identifier: "types",
                position: (19, 16),
               },
               attribute_path: AttributePath {
                attributes: [
                 Raw {
                  content: "port",
                  position: (19, 22),
                 },
                ],
               },
               default: None,
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "default",
                 position: (20, 9),
                },
               ],
              },
              Int {
               value: 37358,
               position: (20, 19),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "description",
                 position: (21, 9),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "The server host port.",
                 position: (21, 24),
                },
               ],
              },
             ),
            ],
            recursive: false,
            position: (18, 23),
           },
          ],
         },
        ),
        KeyValue(
         AttributePath {
          attributes: [
           Raw {
            content: "apiUrl",
            position: (24, 7),
           },
          ],
         },
         FunctionApplication {
          function: Variable {
           identifier: "mkOption",
           position: (24, 16),
          },
          arguments: [
           Map {
            bindings: [
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "type",
                 position: (25, 9),
                },
               ],
              },
              PropertyAccess {
               expression: Variable {
                identifier: "types",
                position: (25, 16),
               },
               attribute_path: AttributePath {
                attributes: [
                 Raw {
                  content: "str",
                  position: (25, 22),
                 },
                ],
               },
               default: None,
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "default",
                 position: (26, 9),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "https://api.etesync.com/",
                 position: (26, 20),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "description",
                 position: (27, 9),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "The url to the etesync API.",
                 position: (27, 24),
                },
               ],
              },
             ),
            ],
            recursive: false,
            position: (24, 25),
           },
          ],
         },
        ),
        KeyValue(
         AttributePath {
          attributes: [
           Raw {
            content: "openFirewall",
            position: (30, 7),
           },
          ],
         },
         FunctionApplication {
          function: Variable {
           identifier: "mkOption",
           position: (30, 22),
          },
          arguments: [
           Map {
            bindings: [
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "default",
                 position: (31, 9),
                },
               ],
              },
              Variable {
               identifier: "false",
               position: (31, 19),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "type",
                 position: (32, 9),
                },
               ],
              },
              PropertyAccess {
               expression: Variable {
                identifier: "types",
                position: (32, 16),
               },
               attribute_path: AttributePath {
                attributes: [
                 Raw {
                  content: "bool",
                  position: (32, 22),
                 },
                ],
               },
               default: None,
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "description",
                 position: (33, 9),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "Whether to open the firewall for the specified port.",
                 position: (33, 24),
                },
               ],
              },
             ),
            ],
            recursive: false,
            position: (30, 31),
           },
          ],
         },
        ),
        KeyValue(
         AttributePath {
          attributes: [
           Raw {
            content: "sslCertificate",
            position: (36, 7),
           },
          ],
         },
         FunctionApplication {
          function: Variable {
           identifier: "mkOption",
           position: (36, 24),
          },
          arguments: [
           Map {
            bindings: [
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "type",
                 position: (37, 9),
                },
               ],
              },
              FunctionApplication {
               function: PropertyAccess {
                expression: Variable {
                 identifier: "types",
                 position: (37, 16),
                },
                attribute_path: AttributePath {
                 attributes: [
                  Raw {
                   content: "nullOr",
                   position: (37, 22),
                  },
                 ],
                },
                default: None,
               },
               arguments: [
                PropertyAccess {
                 expression: Variable {
                  identifier: "types",
                  position: (37, 29),
                 },
                 attribute_path: AttributePath {
                  attributes: [
                   Raw {
                    content: "path",
                    position: (37, 35),
                   },
                  ],
                 },
                 default: None,
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "default",
                 position: (38, 9),
                },
               ],
              },
              Variable {
               identifier: "null",
               position: (38, 19),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "example",
                 position: (39, 9),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "/var/etesync.crt",
                 position: (39, 20),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "description",
                 position: (40, 9),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "Path to server SSL certificate. It will be copied into\netesync-dav's data directory.\n",
                 position: (41, 1),
                },
               ],
              },
             ),
            ],
            recursive: false,
            position: (36, 33),
           },
          ],
         },
        ),
        KeyValue(
         AttributePath {
          attributes: [
           Raw {
            content: "sslCertificateKey",
            position: (46, 7),
           },
          ],
         },
         FunctionApplication {
          function: Variable {
           identifier: "mkOption",
           position: (46, 27),
          },
          arguments: [
           Map {
            bindings: [
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "type",
                 position: (47, 9),
                },
               ],
              },
              FunctionApplication {
               function: PropertyAccess {
                expression: Variable {
                 identifier: "types",
                 position: (47, 16),
                },
                attribute_path: AttributePath {
                 attributes: [
                  Raw {
                   content: "nullOr",
                   position: (47, 22),
                  },
                 ],
                },
                default: None,
               },
               arguments: [
                PropertyAccess {
                 expression: Variable {
                  identifier: "types",
                  position: (47, 29),
                 },
                 attribute_path: AttributePath {
                  attributes: [
                   Raw {
                    content: "path",
                    position: (47, 35),
                   },
                  ],
                 },
                 default: None,
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "default",
                 position: (48, 9),
                },
               ],
              },
              Variable {
               identifier: "null",
               position: (48, 19),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "example",
                 position: (49, 9),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "/var/etesync.key",
                 position: (49, 20),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "description",
                 position: (50, 9),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "Path to server SSL certificate key.  It will be copied into\netesync-dav's data directory.\n",
                 position: (51, 1),
                },
               ],
              },
             ),
            ],
            recursive: false,
            position: (46, 36),
           },
          ],
         },
        ),
       ],
       recursive: false,
       position: (9, 36),
      },
     ),
     KeyValue(
      AttributePath {
       attributes: [
        Raw {
         content: "config",
         position: (57, 5),
        },
       ],
      },
      FunctionApplication {
       function: Variable {
        identifier: "mkIf",
        position: (57, 14),
       },
       arguments: [
        PropertyAccess {
         expression: Variable {
          identifier: "cfg",
          position: (57, 19),
         },
         attribute_path: AttributePath {
          attributes: [
           Raw {
            content: "enable",
            position: (57, 23),
           },
          ],
         },
         default: None,
        },
        Map {
         bindings: [
          KeyValue(
           AttributePath {
            attributes: [
             Raw {
              content: "networking",
              position: (58, 7),
             },
             Raw {
              content: "firewall",
              position: (58, 18),
             },
             Raw {
              content: "allowedTCPPorts",
              position: (58, 27),
             },
            ],
           },
           FunctionApplication {
            function: Variable {
             identifier: "mkIf",
             position: (58, 45),
            },
            arguments: [
             PropertyAccess {
              expression: Variable {
               identifier: "cfg",
               position: (58, 50),
              },
              attribute_path: AttributePath {
               attributes: [
                Raw {
                 content: "openFirewall",
                 position: (58, 54),
                },
               ],
              },
              default: None,
             },
             List {
              elements: [
               PropertyAccess {
                expression: Variable {
                 identifier: "cfg",
                 position: (58, 69),
                },
                attribute_path: AttributePath {
                 attributes: [
                  Raw {
                   content: "port",
                   position: (58, 73),
                  },
                 ],
                },
                default: None,
               },
              ],
              position: (58, 67),
             },
            ],
           },
          ),
          KeyValue(
           AttributePath {
            attributes: [
             Raw {
              content: "systemd",
              position: (60, 7),
             },
             Raw {
              content: "services",
              position: (60, 15),
             },
             Raw {
              content: "etesync-dav",
              position: (60, 24),
             },
            ],
           },
           Map {
            bindings: [
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "description",
                 position: (61, 9),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "etesync-dav - A CalDAV and CardDAV adapter for EteSync",
                 position: (61, 24),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "after",
                 position: (62, 9),
                },
               ],
              },
              List {
               elements: [
                String {
                 parts: [
                  Raw {
                   content: "network-online.target",
                   position: (62, 20),
                  },
                 ],
                },
               ],
               position: (62, 17),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "wantedBy",
                 position: (63, 9),
                },
               ],
              },
              List {
               elements: [
                String {
                 parts: [
                  Raw {
                   content: "multi-user.target",
                   position: (63, 23),
                  },
                 ],
                },
               ],
               position: (63, 20),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "path",
                 position: (64, 9),
                },
               ],
              },
              List {
               elements: [
                PropertyAccess {
                 expression: Variable {
                  identifier: "pkgs",
                  position: (64, 18),
                 },
                 attribute_path: AttributePath {
                  attributes: [
                   Raw {
                    content: "etesync-dav",
                    position: (64, 23),
                   },
                  ],
                 },
                 default: None,
                },
               ],
               position: (64, 16),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "environment",
                 position: (65, 9),
                },
               ],
              },
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "ETESYNC_LISTEN_ADDRESS",
                    position: (66, 11),
                   },
                  ],
                 },
                 PropertyAccess {
                  expression: Variable {
                   identifier: "cfg",
                   position: (66, 36),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "host",
                     position: (66, 40),
                    },
                   ],
                  },
                  default: None,
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "ETESYNC_LISTEN_PORT",
                    position: (67, 11),
                   },
                  ],
                 },
                 FunctionApplication {
                  function: Variable {
                   identifier: "toString",
                   position: (67, 33),
                  },
                  arguments: [
                   PropertyAccess {
                    expression: Variable {
                     identifier: "cfg",
                     position: (67, 42),
                    },
                    attribute_path: AttributePath {
                     attributes: [
                      Raw {
                       content: "port",
                       position: (67, 46),
                      },
                     ],
                    },
                    default: None,
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "ETESYNC_URL",
                    position: (68, 11),
                   },
                  ],
                 },
                 PropertyAccess {
                  expression: Variable {
                   identifier: "cfg",
                   position: (68, 25),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "apiUrl",
                     position: (68, 29),
                    },
                   ],
                  },
                  default: None,
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "ETESYNC_DATA_DIR",
                    position: (69, 11),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "/var/lib/etesync-dav",
                    position: (69, 31),
                   },
                  ],
                 },
                ),
               ],
               recursive: false,
               position: (65, 23),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "serviceConfig",
                 position: (72, 9),
                },
               ],
              },
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "Type",
                    position: (73, 11),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "simple",
                    position: (73, 19),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "DynamicUser",
                    position: (74, 11),
                   },
                  ],
                 },
                 Variable {
                  identifier: "true",
                  position: (74, 25),
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "StateDirectory",
                    position: (75, 11),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "etesync-dav",
                    position: (75, 29),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "ExecStart",
                    position: (76, 11),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Expression {
                    expression: PropertyAccess {
                     expression: Variable {
                      identifier: "pkgs",
                      position: (76, 26),
                     },
                     attribute_path: AttributePath {
                      attributes: [
                       Raw {
                        content: "etesync-dav",
                        position: (76, 31),
                       },
                      ],
                     },
                     default: None,
                    },
                   },
                   Raw {
                    content: "/bin/etesync-dav",
                    position: (76, 43),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "ExecStartPre",
                    position: (77, 11),
                   },
                  ],
                 },
                 FunctionApplication {
                  function: Variable {
                   identifier: "mkIf",
                   position: (77, 26),
                  },
                  arguments: [
                   BinaryOperation {
                    operator: LogicalOr,
                    operands: [
                     BinaryOperation {
                      operator: NotEqualTo,
                      operands: [
                       PropertyAccess {
                        expression: Variable {
                         identifier: "cfg",
                         position: (77, 32),
                        },
                        attribute_path: AttributePath {
                         attributes: [
                          Raw {
                           content: "sslCertificate",
                           position: (77, 36),
                          },
                         ],
                        },
                        default: None,
                       },
                       Variable {
                        identifier: "null",
                        position: (77, 54),
                       },
                      ],
                      position: (77, 51),
                     },
                     BinaryOperation {
                      operator: NotEqualTo,
                      operands: [
                       PropertyAccess {
                        expression: Variable {
                         identifier: "cfg",
                         position: (77, 62),
                        },
                        attribute_path: AttributePath {
                         attributes: [
                          Raw {
                           content: "sslCertificateKey",
                           position: (77, 66),
                          },
                         ],
                        },
                        default: None,
                       },
                       Variable {
                        identifier: "null",
                        position: (77, 87),
                       },
                      ],
                      position: (77, 84),
                     },
                    ],
                    position: (77, 59),
                   },
                   FunctionApplication {
                    function: PropertyAccess {
                     expression: Variable {
                      identifier: "pkgs",
                      position: (78, 13),
                     },
                     attribute_path: AttributePath {
                      attributes: [
                       Raw {
                        content: "writers",
                        position: (78, 18),
                       },
                       Raw {
                        content: "writeBash",
                        position: (78, 26),
                       },
                      ],
                     },
                     default: None,
                    },
                    arguments: [
                     String {
                      parts: [
                       Raw {
                        content: "etesync-dav-copy-keys",
                        position: (78, 37),
                       },
                      ],
                     },
                     String {
                      parts: [
                       Raw {
                        content: "",
                        position: (79, 1),
                       },
                       Expression {
                        expression: FunctionApplication {
                         function: Variable {
                          identifier: "optionalString",
                          position: (79, 17),
                         },
                         arguments: [
                          BinaryOperation {
                           operator: NotEqualTo,
                           operands: [
                            PropertyAccess {
                             expression: Variable {
                              identifier: "cfg",
                              position: (79, 33),
                             },
                             attribute_path: AttributePath {
                              attributes: [
                               Raw {
                                content: "sslCertificate",
                                position: (79, 37),
                               },
                              ],
                             },
                             default: None,
                            },
                            Variable {
                             identifier: "null",
                             position: (79, 55),
                            },
                           ],
                           position: (79, 52),
                          },
                          String {
                           parts: [
                            Raw {
                             content: "cp ",
                             position: (80, 1),
                            },
                            Expression {
                             expression: FunctionApplication {
                              function: Variable {
                               identifier: "toString",
                               position: (80, 22),
                              },
                              arguments: [
                               PropertyAccess {
                                expression: Variable {
                                 identifier: "cfg",
                                 position: (80, 31),
                                },
                                attribute_path: AttributePath {
                                 attributes: [
                                  Raw {
                                   content: "sslCertificate",
                                   position: (80, 35),
                                  },
                                 ],
                                },
                                default: None,
                               },
                              ],
                             },
                            },
                            Raw {
                             content: " $STATE_DIRECTORY/etesync.crt\n",
                             position: (80, 50),
                            },
                           ],
                          },
                         ],
                        },
                       },
                       Raw {
                        content: "\n",
                        position: (81, 18),
                       },
                       Expression {
                        expression: FunctionApplication {
                         function: Variable {
                          identifier: "optionalString",
                          position: (82, 17),
                         },
                         arguments: [
                          BinaryOperation {
                           operator: NotEqualTo,
                           operands: [
                            PropertyAccess {
                             expression: Variable {
                              identifier: "cfg",
                              position: (82, 33),
                             },
                             attribute_path: AttributePath {
                              attributes: [
                               Raw {
                                content: "sslCertificateKey",
                                position: (82, 37),
                               },
                              ],
                             },
                             default: None,
                            },
                            Variable {
                             identifier: "null",
                             position: (82, 58),
                            },
                           ],
                           position: (82, 55),
                          },
                          String {
                           parts: [
                            Raw {
                             content: "cp ",
                             position: (83, 1),
                            },
                            Expression {
                             expression: FunctionApplication {
                              function: Variable {
                               identifier: "toString",
                               position: (83, 22),
                              },
                              arguments: [
                               PropertyAccess {
                                expression: Variable {
                                 identifier: "cfg",
                                 position: (83, 31),
                                },
                                attribute_path: AttributePath {
                                 attributes: [
                                  Raw {
                                   content: "sslCertificateKey",
                                   position: (83, 35),
                                  },
                                 ],
                                },
                                default: None,
                               },
                              ],
                             },
                            },
                            Raw {
                             content: " $STATE_DIRECTORY/etesync.key\n",
                             position: (83, 53),
                            },
                           ],
                          },
                         ],
                        },
                       },
                       Raw {
                        content: "\n",
                        position: (84, 18),
                       },
                      ],
                     },
                    ],
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "Restart",
                    position: (87, 11),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "on-failure",
                    position: (87, 22),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "RestartSec",
                    position: (88, 11),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "30min 1s",
                    position: (88, 25),
                   },
                  ],
                 },
                ),
               ],
               recursive: false,
               position: (72, 25),
              },
             ),
            ],
            recursive: false,
            position: (60, 38),
           },
          ),
         ],
         recursive: false,
         position: (57, 30),
        },
       ],
      },
     ),
    ],
    recursive: false,
    position: (8, 3),
   },
   position: (5, 1),
  },
  position: (3, 1),
 },
 position: (1, 1),
}