---
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: (7, 3),
       },
      ],
     },
     PropertyAccess {
      expression: Variable {
       identifier: "config",
       position: (7, 9),
      },
      attribute_path: AttributePath {
       attributes: [
        Raw {
         content: "services",
         position: (7, 16),
        },
        Raw {
         content: "davmail",
         position: (7, 25),
        },
       ],
      },
      default: None,
     },
    ),
    KeyValue(
     AttributePath {
      attributes: [
       Raw {
        content: "configType",
        position: (9, 3),
       },
      ],
     },
     With {
      expression: Variable {
       identifier: "types",
       position: (9, 21),
      },
      target: BinaryOperation {
       operator: Update,
       operands: [
        FunctionApplication {
         function: Variable {
          identifier: "oneOf",
          position: (10, 5),
         },
         arguments: [
          List {
           elements: [
            FunctionApplication {
             function: Variable {
              identifier: "attrsOf",
              position: (10, 14),
             },
             arguments: [
              Variable {
               identifier: "configType",
               position: (10, 22),
              },
             ],
            },
            Variable {
             identifier: "str",
             position: (10, 34),
            },
            Variable {
             identifier: "int",
             position: (10, 38),
            },
            Variable {
             identifier: "bool",
             position: (10, 42),
            },
           ],
           position: (10, 11),
          },
         ],
        },
        Map {
         bindings: [
          KeyValue(
           AttributePath {
            attributes: [
             Raw {
              content: "description",
              position: (11, 7),
             },
            ],
           },
           String {
            parts: [
             Raw {
              content: "davmail config type (str, int, bool or attribute set thereof)",
              position: (11, 22),
             },
            ],
           },
          ),
         ],
         recursive: false,
         position: (10, 52),
        },
       ],
       position: (10, 49),
      },
      position: (9, 16),
     },
    ),
    KeyValue(
     AttributePath {
      attributes: [
       Raw {
        content: "toStr",
        position: (14, 3),
       },
      ],
     },
     Function {
      argument: Some(
       "val",
      ),
      arguments: FunctionArguments {
       arguments: [],
       ellipsis: false,
      },
      definition: IfThenElse {
       predicate: FunctionApplication {
        function: Variable {
         identifier: "isBool",
         position: (14, 19),
        },
        arguments: [
         Variable {
          identifier: "val",
          position: (14, 26),
         },
        ],
       },
       then: FunctionApplication {
        function: Variable {
         identifier: "boolToString",
         position: (14, 35),
        },
        arguments: [
         Variable {
          identifier: "val",
          position: (14, 48),
         },
        ],
       },
       else_: FunctionApplication {
        function: Variable {
         identifier: "toString",
         position: (14, 57),
        },
        arguments: [
         Variable {
          identifier: "val",
          position: (14, 66),
         },
        ],
       },
       position: (14, 16),
      },
      position: (14, 11),
     },
    ),
    KeyValue(
     AttributePath {
      attributes: [
       Raw {
        content: "linesForAttrs",
        position: (16, 3),
       },
      ],
     },
     Function {
      argument: Some(
       "attrs",
      ),
      arguments: FunctionArguments {
       arguments: [],
       ellipsis: false,
      },
      definition: FunctionApplication {
       function: Variable {
        identifier: "concatMap",
        position: (16, 26),
       },
       arguments: [
        Function {
         argument: Some(
          "name",
         ),
         arguments: FunctionArguments {
          arguments: [],
          ellipsis: false,
         },
         definition: LetIn {
          bindings: [
           KeyValue(
            AttributePath {
             attributes: [
              Raw {
               content: "value",
               position: (16, 47),
              },
             ],
            },
            PropertyAccess {
             expression: Variable {
              identifier: "attrs",
              position: (16, 55),
             },
             attribute_path: AttributePath {
              attributes: [
               Expression {
                expression: Variable {
                 identifier: "name",
                 position: (16, 63),
                },
               },
              ],
             },
             default: None,
            },
           ),
          ],
          target: IfThenElse {
           predicate: FunctionApplication {
            function: Variable {
             identifier: "isAttrs",
             position: (17, 8),
            },
            arguments: [
             Variable {
              identifier: "value",
              position: (17, 16),
             },
            ],
           },
           then: FunctionApplication {
            function: Variable {
             identifier: "map",
             position: (18, 12),
            },
            arguments: [
             Function {
              argument: Some(
               "line",
              ),
              arguments: FunctionArguments {
               arguments: [],
               ellipsis: false,
              },
              definition: BinaryOperation {
               operator: Addition,
               operands: [
                BinaryOperation {
                 operator: Addition,
                 operands: [
                  Variable {
                   identifier: "name",
                   position: (18, 23),
                  },
                  String {
                   parts: [
                    Raw {
                     content: ".",
                     position: (18, 31),
                    },
                   ],
                  },
                 ],
                 position: (18, 28),
                },
                Variable {
                 identifier: "line",
                 position: (18, 36),
                },
               ],
               position: (18, 34),
              },
              position: (18, 17),
             },
             FunctionApplication {
              function: Variable {
               identifier: "linesForAttrs",
               position: (18, 43),
              },
              arguments: [
               Variable {
                identifier: "value",
                position: (18, 57),
               },
              ],
             },
            ],
           },
           else_: List {
            elements: [
             String {
              parts: [
               Expression {
                expression: Variable {
                 identifier: "name",
                 position: (19, 17),
                },
               },
               Raw {
                content: "=",
                position: (19, 22),
               },
               Expression {
                expression: FunctionApplication {
                 function: Variable {
                  identifier: "toStr",
                  position: (19, 25),
                 },
                 arguments: [
                  Variable {
                   identifier: "value",
                   position: (19, 31),
                  },
                 ],
                },
               },
              ],
             },
            ],
            position: (19, 12),
           },
           position: (17, 5),
          },
          position: (16, 43),
         },
         position: (16, 37),
        },
        FunctionApplication {
         function: Variable {
          identifier: "attrNames",
          position: (20, 6),
         },
         arguments: [
          Variable {
           identifier: "attrs",
           position: (20, 16),
          },
         ],
        },
       ],
      },
      position: (16, 19),
     },
    ),
    KeyValue(
     AttributePath {
      attributes: [
       Raw {
        content: "configFile",
        position: (22, 3),
       },
      ],
     },
     FunctionApplication {
      function: PropertyAccess {
       expression: Variable {
        identifier: "pkgs",
        position: (22, 16),
       },
       attribute_path: AttributePath {
        attributes: [
         Raw {
          content: "writeText",
          position: (22, 21),
         },
        ],
       },
       default: None,
      },
      arguments: [
       String {
        parts: [
         Raw {
          content: "davmail.properties",
          position: (22, 32),
         },
        ],
       },
       FunctionApplication {
        function: Variable {
         identifier: "concatStringsSep",
         position: (22, 53),
        },
        arguments: [
         String {
          parts: [
           Raw {
            content: "\n",
            position: (22, 71),
           },
          ],
         },
         FunctionApplication {
          function: Variable {
           identifier: "linesForAttrs",
           position: (22, 76),
          },
          arguments: [
           PropertyAccess {
            expression: Variable {
             identifier: "cfg",
             position: (22, 90),
            },
            attribute_path: AttributePath {
             attributes: [
              Raw {
               content: "config",
               position: (22, 94),
              },
             ],
            },
            default: None,
           },
          ],
         },
        ],
       },
      ],
     },
    ),
   ],
   target: Map {
    bindings: [
     KeyValue(
      AttributePath {
       attributes: [
        Raw {
         content: "options",
         position: (27, 5),
        },
        Raw {
         content: "services",
         position: (27, 13),
        },
        Raw {
         content: "davmail",
         position: (27, 22),
        },
       ],
      },
      Map {
       bindings: [
        KeyValue(
         AttributePath {
          attributes: [
           Raw {
            content: "enable",
            position: (28, 7),
           },
          ],
         },
         FunctionApplication {
          function: Variable {
           identifier: "mkEnableOption",
           position: (28, 16),
          },
          arguments: [
           String {
            parts: [
             Raw {
              content: "davmail, an MS Exchange gateway",
              position: (28, 32),
             },
            ],
           },
          ],
         },
        ),
        KeyValue(
         AttributePath {
          attributes: [
           Raw {
            content: "url",
            position: (30, 7),
           },
          ],
         },
         FunctionApplication {
          function: Variable {
           identifier: "mkOption",
           position: (30, 13),
          },
          arguments: [
           Map {
            bindings: [
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "type",
                 position: (31, 9),
                },
               ],
              },
              PropertyAccess {
               expression: Variable {
                identifier: "types",
                position: (31, 16),
               },
               attribute_path: AttributePath {
                attributes: [
                 Raw {
                  content: "str",
                  position: (31, 22),
                 },
                ],
               },
               default: None,
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "description",
                 position: (32, 9),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "Outlook Web Access URL to access the exchange server, i.e. the base webmail URL.",
                 position: (32, 24),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "example",
                 position: (33, 9),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "https://outlook.office365.com/EWS/Exchange.asmx",
                 position: (33, 20),
                },
               ],
              },
             ),
            ],
            recursive: false,
            position: (30, 22),
           },
          ],
         },
        ),
        KeyValue(
         AttributePath {
          attributes: [
           Raw {
            content: "config",
            position: (36, 7),
           },
          ],
         },
         FunctionApplication {
          function: Variable {
           identifier: "mkOption",
           position: (36, 16),
          },
          arguments: [
           Map {
            bindings: [
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "type",
                 position: (37, 9),
                },
               ],
              },
              Variable {
               identifier: "configType",
               position: (37, 16),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "default",
                 position: (38, 9),
                },
               ],
              },
              Map {
               bindings: [],
               recursive: false,
               position: (38, 19),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "description",
                 position: (39, 9),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "Davmail configuration. Refer to\n<link xlink:href=\"http://davmail.sourceforge.net/serversetup.html\"/>\nand <link xlink:href=\"http://davmail.sourceforge.net/advanced.html\"/>\nfor details on supported values.\n",
                 position: (40, 1),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "example",
                 position: (45, 9),
                },
               ],
              },
              FunctionApplication {
               function: Variable {
                identifier: "literalExpression",
                position: (45, 19),
               },
               arguments: [
                String {
                 parts: [
                  Raw {
                   content: "{\n  davmail.allowRemote = true;\n  davmail.imapPort = 55555;\n  davmail.bindAddress = \"10.0.1.2\";\n  davmail.smtpSaveInSent = true;\n  davmail.folderSizeLimit = 10;\n  davmail.caldavAutoSchedule = false;\n  log4j.logger.rootLogger = \"DEBUG\";\n}\n",
                   position: (46, 1),
                  },
                 ],
                },
               ],
              },
             ),
            ],
            recursive: false,
            position: (36, 25),
           },
          ],
         },
        ),
       ],
       recursive: false,
       position: (27, 32),
      },
     ),
     KeyValue(
      AttributePath {
       attributes: [
        Raw {
         content: "config",
         position: (59, 5),
        },
       ],
      },
      FunctionApplication {
       function: Variable {
        identifier: "mkIf",
        position: (59, 14),
       },
       arguments: [
        PropertyAccess {
         expression: Variable {
          identifier: "cfg",
          position: (59, 19),
         },
         attribute_path: AttributePath {
          attributes: [
           Raw {
            content: "enable",
            position: (59, 23),
           },
          ],
         },
         default: None,
        },
        Map {
         bindings: [
          KeyValue(
           AttributePath {
            attributes: [
             Raw {
              content: "services",
              position: (61, 7),
             },
             Raw {
              content: "davmail",
              position: (61, 16),
             },
             Raw {
              content: "config",
              position: (61, 24),
             },
            ],
           },
           Map {
            bindings: [
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "davmail",
                 position: (62, 9),
                },
               ],
              },
              FunctionApplication {
               function: Variable {
                identifier: "mapAttrs",
                position: (62, 19),
               },
               arguments: [
                Function {
                 argument: Some(
                  "name",
                 ),
                 arguments: FunctionArguments {
                  arguments: [],
                  ellipsis: false,
                 },
                 definition: Variable {
                  identifier: "mkDefault",
                  position: (62, 35),
                 },
                 position: (62, 29),
                },
                Map {
                 bindings: [
                  KeyValue(
                   AttributePath {
                    attributes: [
                     Raw {
                      content: "server",
                      position: (63, 11),
                     },
                    ],
                   },
                   Variable {
                    identifier: "true",
                    position: (63, 20),
                   },
                  ),
                  KeyValue(
                   AttributePath {
                    attributes: [
                     Raw {
                      content: "disableUpdateCheck",
                      position: (64, 11),
                     },
                    ],
                   },
                   Variable {
                    identifier: "true",
                    position: (64, 32),
                   },
                  ),
                  KeyValue(
                   AttributePath {
                    attributes: [
                     Raw {
                      content: "logFilePath",
                      position: (65, 11),
                     },
                    ],
                   },
                   String {
                    parts: [
                     Raw {
                      content: "/var/log/davmail/davmail.log",
                      position: (65, 26),
                     },
                    ],
                   },
                  ),
                  KeyValue(
                   AttributePath {
                    attributes: [
                     Raw {
                      content: "logFileSize",
                      position: (66, 11),
                     },
                    ],
                   },
                   String {
                    parts: [
                     Raw {
                      content: "1MB",
                      position: (66, 26),
                     },
                    ],
                   },
                  ),
                  KeyValue(
                   AttributePath {
                    attributes: [
                     Raw {
                      content: "mode",
                      position: (67, 11),
                     },
                    ],
                   },
                   String {
                    parts: [
                     Raw {
                      content: "auto",
                      position: (67, 19),
                     },
                    ],
                   },
                  ),
                  KeyValue(
                   AttributePath {
                    attributes: [
                     Raw {
                      content: "url",
                      position: (68, 11),
                     },
                    ],
                   },
                   PropertyAccess {
                    expression: Variable {
                     identifier: "cfg",
                     position: (68, 17),
                    },
                    attribute_path: AttributePath {
                     attributes: [
                      Raw {
                       content: "url",
                       position: (68, 21),
                      },
                     ],
                    },
                    default: None,
                   },
                  ),
                  KeyValue(
                   AttributePath {
                    attributes: [
                     Raw {
                      content: "caldavPort",
                      position: (69, 11),
                     },
                    ],
                   },
                   Int {
                    value: 1080,
                    position: (69, 24),
                   },
                  ),
                  KeyValue(
                   AttributePath {
                    attributes: [
                     Raw {
                      content: "imapPort",
                      position: (70, 11),
                     },
                    ],
                   },
                   Int {
                    value: 1143,
                    position: (70, 22),
                   },
                  ),
                  KeyValue(
                   AttributePath {
                    attributes: [
                     Raw {
                      content: "ldapPort",
                      position: (71, 11),
                     },
                    ],
                   },
                   Int {
                    value: 1389,
                    position: (71, 22),
                   },
                  ),
                  KeyValue(
                   AttributePath {
                    attributes: [
                     Raw {
                      content: "popPort",
                      position: (72, 11),
                     },
                    ],
                   },
                   Int {
                    value: 1110,
                    position: (72, 21),
                   },
                  ),
                  KeyValue(
                   AttributePath {
                    attributes: [
                     Raw {
                      content: "smtpPort",
                      position: (73, 11),
                     },
                    ],
                   },
                   Int {
                    value: 1025,
                    position: (73, 22),
                   },
                  ),
                 ],
                 recursive: false,
                 position: (62, 46),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "log4j",
                 position: (75, 9),
                },
               ],
              },
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "logger",
                    position: (76, 11),
                   },
                   Raw {
                    content: "davmail",
                    position: (76, 18),
                   },
                  ],
                 },
                 FunctionApplication {
                  function: Variable {
                   identifier: "mkDefault",
                   position: (76, 28),
                  },
                  arguments: [
                   String {
                    parts: [
                     Raw {
                      content: "WARN",
                      position: (76, 39),
                     },
                    ],
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "logger",
                    position: (77, 11),
                   },
                   Raw {
                    content: "httpclient",
                    position: (77, 18),
                   },
                   Raw {
                    content: "wire",
                    position: (77, 29),
                   },
                  ],
                 },
                 FunctionApplication {
                  function: Variable {
                   identifier: "mkDefault",
                   position: (77, 36),
                  },
                  arguments: [
                   String {
                    parts: [
                     Raw {
                      content: "WARN",
                      position: (77, 47),
                     },
                    ],
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "logger",
                    position: (78, 11),
                   },
                   Raw {
                    content: "org",
                    position: (78, 18),
                   },
                   Raw {
                    content: "apache",
                    position: (78, 22),
                   },
                   Raw {
                    content: "commons",
                    position: (78, 29),
                   },
                   Raw {
                    content: "httpclient",
                    position: (78, 37),
                   },
                  ],
                 },
                 FunctionApplication {
                  function: Variable {
                   identifier: "mkDefault",
                   position: (78, 50),
                  },
                  arguments: [
                   String {
                    parts: [
                     Raw {
                      content: "WARN",
                      position: (78, 61),
                     },
                    ],
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "rootLogger",
                    position: (79, 11),
                   },
                  ],
                 },
                 FunctionApplication {
                  function: Variable {
                   identifier: "mkDefault",
                   position: (79, 24),
                  },
                  arguments: [
                   String {
                    parts: [
                     Raw {
                      content: "WARN",
                      position: (79, 35),
                     },
                    ],
                   },
                  ],
                 },
                ),
               ],
               recursive: false,
               position: (75, 17),
              },
             ),
            ],
            recursive: false,
            position: (61, 33),
           },
          ),
          KeyValue(
           AttributePath {
            attributes: [
             Raw {
              content: "systemd",
              position: (83, 7),
             },
             Raw {
              content: "services",
              position: (83, 15),
             },
             Raw {
              content: "davmail",
              position: (83, 24),
             },
            ],
           },
           Map {
            bindings: [
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "description",
                 position: (84, 9),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "DavMail POP/IMAP/SMTP Exchange Gateway",
                 position: (84, 24),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "after",
                 position: (85, 9),
                },
               ],
              },
              List {
               elements: [
                String {
                 parts: [
                  Raw {
                   content: "network.target",
                   position: (85, 20),
                  },
                 ],
                },
               ],
               position: (85, 17),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "wantedBy",
                 position: (86, 9),
                },
               ],
              },
              List {
               elements: [
                String {
                 parts: [
                  Raw {
                   content: "multi-user.target",
                   position: (86, 23),
                  },
                 ],
                },
               ],
               position: (86, 20),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "serviceConfig",
                 position: (88, 9),
                },
               ],
              },
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "Type",
                    position: (89, 11),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "simple",
                    position: (89, 19),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "ExecStart",
                    position: (90, 11),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Expression {
                    expression: PropertyAccess {
                     expression: Variable {
                      identifier: "pkgs",
                      position: (90, 26),
                     },
                     attribute_path: AttributePath {
                      attributes: [
                       Raw {
                        content: "davmail",
                        position: (90, 31),
                       },
                      ],
                     },
                     default: None,
                    },
                   },
                   Raw {
                    content: "/bin/davmail ",
                    position: (90, 39),
                   },
                   Expression {
                    expression: Variable {
                     identifier: "configFile",
                     position: (90, 54),
                    },
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "Restart",
                    position: (91, 11),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "on-failure",
                    position: (91, 22),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "DynamicUser",
                    position: (92, 11),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "yes",
                    position: (92, 26),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "LogsDirectory",
                    position: (93, 11),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "davmail",
                    position: (93, 28),
                   },
                  ],
                 },
                ),
               ],
               recursive: false,
               position: (88, 25),
              },
             ),
            ],
            recursive: false,
            position: (83, 34),
           },
          ),
          KeyValue(
           AttributePath {
            attributes: [
             Raw {
              content: "environment",
              position: (97, 7),
             },
             Raw {
              content: "systemPackages",
              position: (97, 19),
             },
            ],
           },
           List {
            elements: [
             PropertyAccess {
              expression: Variable {
               identifier: "pkgs",
               position: (97, 38),
              },
              attribute_path: AttributePath {
               attributes: [
                Raw {
                 content: "davmail",
                 position: (97, 43),
                },
               ],
              },
              default: None,
             },
            ],
            position: (97, 36),
           },
          ),
         ],
         recursive: false,
         position: (59, 30),
        },
       ],
      },
     ),
    ],
    recursive: false,
    position: (26, 3),
   },
   position: (5, 1),
  },
  position: (3, 1),
 },
 position: (1, 1),
}