---
Function {
 argument: None,
 arguments: FunctionArguments {
  arguments: [
   FunctionArgument {
    identifier: "options",
    default: None,
   },
   FunctionArgument {
    identifier: "pkgs",
    default: None,
   },
   FunctionArgument {
    identifier: "lib",
    default: None,
   },
   FunctionArgument {
    identifier: "config",
    default: None,
   },
  ],
  ellipsis: false,
 },
 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: "prometheus",
         position: (6, 25),
        },
        Raw {
         content: "exporters",
         position: (6, 36),
        },
        Raw {
         content: "mikrotik",
         position: (6, 46),
        },
       ],
      },
      default: None,
     },
    ),
   ],
   target: Map {
    bindings: [
     KeyValue(
      AttributePath {
       attributes: [
        Raw {
         content: "port",
         position: (9, 3),
        },
       ],
      },
      Int {
       value: 9436,
       position: (9, 10),
      },
     ),
     KeyValue(
      AttributePath {
       attributes: [
        Raw {
         content: "extraOpts",
         position: (10, 3),
        },
       ],
      },
      Map {
       bindings: [
        KeyValue(
         AttributePath {
          attributes: [
           Raw {
            content: "configFile",
            position: (11, 5),
           },
          ],
         },
         FunctionApplication {
          function: Variable {
           identifier: "mkOption",
           position: (11, 18),
          },
          arguments: [
           Map {
            bindings: [
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "type",
                 position: (12, 7),
                },
               ],
              },
              FunctionApplication {
               function: PropertyAccess {
                expression: Variable {
                 identifier: "types",
                 position: (12, 14),
                },
                attribute_path: AttributePath {
                 attributes: [
                  Raw {
                   content: "nullOr",
                   position: (12, 20),
                  },
                 ],
                },
                default: None,
               },
               arguments: [
                PropertyAccess {
                 expression: Variable {
                  identifier: "types",
                  position: (12, 27),
                 },
                 attribute_path: AttributePath {
                  attributes: [
                   Raw {
                    content: "path",
                    position: (12, 33),
                   },
                  ],
                 },
                 default: None,
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "default",
                 position: (13, 7),
                },
               ],
              },
              Variable {
               identifier: "null",
               position: (13, 17),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "description",
                 position: (14, 7),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "Path to a mikrotik exporter configuration file. Mutually exclusive with\n<option>configuration</option> option.\n",
                 position: (15, 1),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "example",
                 position: (18, 7),
                },
               ],
              },
              FunctionApplication {
               function: Variable {
                identifier: "literalExpression",
                position: (18, 17),
               },
               arguments: [
                String {
                 parts: [
                  Raw {
                   content: "./mikrotik.yml",
                   position: (18, 36),
                  },
                 ],
                },
               ],
              },
             ),
            ],
            recursive: false,
            position: (11, 27),
           },
          ],
         },
        ),
        KeyValue(
         AttributePath {
          attributes: [
           Raw {
            content: "configuration",
            position: (21, 5),
           },
          ],
         },
         FunctionApplication {
          function: Variable {
           identifier: "mkOption",
           position: (21, 21),
          },
          arguments: [
           Map {
            bindings: [
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "type",
                 position: (22, 7),
                },
               ],
              },
              FunctionApplication {
               function: PropertyAccess {
                expression: Variable {
                 identifier: "types",
                 position: (22, 14),
                },
                attribute_path: AttributePath {
                 attributes: [
                  Raw {
                   content: "nullOr",
                   position: (22, 20),
                  },
                 ],
                },
                default: None,
               },
               arguments: [
                PropertyAccess {
                 expression: Variable {
                  identifier: "types",
                  position: (22, 27),
                 },
                 attribute_path: AttributePath {
                  attributes: [
                   Raw {
                    content: "attrs",
                    position: (22, 33),
                   },
                  ],
                 },
                 default: None,
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "default",
                 position: (23, 7),
                },
               ],
              },
              Variable {
               identifier: "null",
               position: (23, 17),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "description",
                 position: (24, 7),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "Mikrotik exporter configuration as nix attribute set. Mutually exclusive with\n<option>configFile</option> option.\n\nSee <link xlink:href=\"https://github.com/nshttpd/mikrotik-exporter/blob/master/README.md\"/>\nfor the description of the configuration file format.\n",
                 position: (25, 1),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "example",
                 position: (31, 7),
                },
               ],
              },
              FunctionApplication {
               function: Variable {
                identifier: "literalExpression",
                position: (31, 17),
               },
               arguments: [
                String {
                 parts: [
                  Raw {
                   content: "{\n  devices = [\n    {\n      name = \"my_router\";\n      address = \"10.10.0.1\";\n      user = \"prometheus\";\n      password = \"changeme\";\n    }\n  ];\n  features = {\n    bgp = true;\n    dhcp = true;\n    routes = true;\n    optics = true;\n  };\n}\n",
                   position: (32, 1),
                  },
                 ],
                },
               ],
              },
             ),
            ],
            recursive: false,
            position: (21, 30),
           },
          ],
         },
        ),
       ],
       recursive: false,
       position: (10, 15),
      },
     ),
     KeyValue(
      AttributePath {
       attributes: [
        Raw {
         content: "serviceOpts",
         position: (51, 3),
        },
       ],
      },
      LetIn {
       bindings: [
        KeyValue(
         AttributePath {
          attributes: [
           Raw {
            content: "configFile",
            position: (52, 5),
           },
          ],
         },
         IfThenElse {
          predicate: BinaryOperation {
           operator: NotEqualTo,
           operands: [
            PropertyAccess {
             expression: Variable {
              identifier: "cfg",
              position: (52, 21),
             },
             attribute_path: AttributePath {
              attributes: [
               Raw {
                content: "configFile",
                position: (52, 25),
               },
              ],
             },
             default: None,
            },
            Variable {
             identifier: "null",
             position: (52, 39),
            },
           ],
           position: (52, 36),
          },
          then: PropertyAccess {
           expression: Variable {
            identifier: "cfg",
            position: (53, 23),
           },
           attribute_path: AttributePath {
            attributes: [
             Raw {
              content: "configFile",
              position: (53, 27),
             },
            ],
           },
           default: None,
          },
          else_: String {
           parts: [
            Expression {
             expression: FunctionApplication {
              function: PropertyAccess {
               expression: Variable {
                identifier: "pkgs",
                position: (54, 26),
               },
               attribute_path: AttributePath {
                attributes: [
                 Raw {
                  content: "writeText",
                  position: (54, 31),
                 },
                ],
               },
               default: None,
              },
              arguments: [
               String {
                parts: [
                 Raw {
                  content: "mikrotik-exporter.yml",
                  position: (54, 42),
                 },
                ],
               },
               FunctionApplication {
                function: PropertyAccess {
                 expression: Variable {
                  identifier: "builtins",
                  position: (54, 66),
                 },
                 attribute_path: AttributePath {
                  attributes: [
                   Raw {
                    content: "toJSON",
                    position: (54, 75),
                   },
                  ],
                 },
                 default: None,
                },
                arguments: [
                 PropertyAccess {
                  expression: Variable {
                   identifier: "cfg",
                   position: (54, 82),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "configuration",
                     position: (54, 86),
                    },
                   ],
                  },
                  default: None,
                 },
                ],
               },
              ],
             },
            },
           ],
          },
          position: (52, 18),
         },
        ),
       ],
       target: Map {
        bindings: [
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "serviceConfig",
             position: (56, 5),
            },
           ],
          },
          Map {
           bindings: [
            KeyValue(
             AttributePath {
              attributes: [
               Raw {
                content: "ExecStart",
                position: (58, 7),
               },
              ],
             },
             String {
              parts: [
               Raw {
                content: "",
                position: (59, 1),
               },
               Expression {
                expression: PropertyAccess {
                 expression: Variable {
                  identifier: "pkgs",
                  position: (59, 11),
                 },
                 attribute_path: AttributePath {
                  attributes: [
                   Raw {
                    content: "prometheus-mikrotik-exporter",
                    position: (59, 16),
                   },
                  ],
                 },
                 default: None,
                },
               },
               Raw {
                content: "/bin/mikrotik-exporter \\\n  -config-file=",
                position: (59, 45),
               },
               Expression {
                expression: FunctionApplication {
                 function: Variable {
                  identifier: "escapeShellArg",
                  position: (60, 26),
                 },
                 arguments: [
                  Variable {
                   identifier: "configFile",
                   position: (60, 41),
                  },
                 ],
                },
               },
               Raw {
                content: " \\\n  -port=",
                position: (60, 52),
               },
               Expression {
                expression: PropertyAccess {
                 expression: Variable {
                  identifier: "cfg",
                  position: (61, 19),
                 },
                 attribute_path: AttributePath {
                  attributes: [
                   Raw {
                    content: "listenAddress",
                    position: (61, 23),
                   },
                  ],
                 },
                 default: None,
                },
               },
               Raw {
                content: ":",
                position: (61, 37),
               },
               Expression {
                expression: FunctionApplication {
                 function: Variable {
                  identifier: "toString",
                  position: (61, 40),
                 },
                 arguments: [
                  PropertyAccess {
                   expression: Variable {
                    identifier: "cfg",
                    position: (61, 49),
                   },
                   attribute_path: AttributePath {
                    attributes: [
                     Raw {
                      content: "port",
                      position: (61, 53),
                     },
                    ],
                   },
                   default: None,
                  },
                 ],
                },
               },
               Raw {
                content: " \\\n  ",
                position: (61, 58),
               },
               Expression {
                expression: FunctionApplication {
                 function: Variable {
                  identifier: "concatStringsSep",
                  position: (62, 13),
                 },
                 arguments: [
                  String {
                   parts: [
                    Raw {
                     content: " \\\n  ",
                     position: (62, 31),
                    },
                   ],
                  },
                  PropertyAccess {
                   expression: Variable {
                    identifier: "cfg",
                    position: (62, 40),
                   },
                   attribute_path: AttributePath {
                    attributes: [
                     Raw {
                      content: "extraFlags",
                      position: (62, 44),
                     },
                    ],
                   },
                   default: None,
                  },
                 ],
                },
               },
               Raw {
                content: "\n",
                position: (62, 55),
               },
              ],
             },
            ),
           ],
           recursive: false,
           position: (56, 21),
          },
         ),
        ],
        recursive: false,
        position: (55, 8),
       },
       position: (51, 17),
      },
     ),
    ],
    recursive: false,
    position: (8, 1),
   },
   position: (5, 1),
  },
  position: (3, 1),
 },
 position: (1, 1),
}