---
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: "heartbeat",
         position: (6, 25),
        },
       ],
      },
      default: None,
     },
    ),
    KeyValue(
     AttributePath {
      attributes: [
       Raw {
        content: "heartbeatYml",
        position: (8, 3),
       },
      ],
     },
     FunctionApplication {
      function: PropertyAccess {
       expression: Variable {
        identifier: "pkgs",
        position: (8, 18),
       },
       attribute_path: AttributePath {
        attributes: [
         Raw {
          content: "writeText",
          position: (8, 23),
         },
        ],
       },
       default: None,
      },
      arguments: [
       String {
        parts: [
         Raw {
          content: "heartbeat.yml",
          position: (8, 34),
         },
        ],
       },
       String {
        parts: [
         Raw {
          content: "name: ",
          position: (9, 1),
         },
         Expression {
          expression: PropertyAccess {
           expression: Variable {
            identifier: "cfg",
            position: (9, 13),
           },
           attribute_path: AttributePath {
            attributes: [
             Raw {
              content: "name",
              position: (9, 17),
             },
            ],
           },
           default: None,
          },
         },
         Raw {
          content: "\ntags: ",
          position: (9, 22),
         },
         Expression {
          expression: FunctionApplication {
           function: PropertyAccess {
            expression: Variable {
             identifier: "builtins",
             position: (10, 13),
            },
            attribute_path: AttributePath {
             attributes: [
              Raw {
               content: "toJSON",
               position: (10, 22),
              },
             ],
            },
            default: None,
           },
           arguments: [
            PropertyAccess {
             expression: Variable {
              identifier: "cfg",
              position: (10, 29),
             },
             attribute_path: AttributePath {
              attributes: [
               Raw {
                content: "tags",
                position: (10, 33),
               },
              ],
             },
             default: None,
            },
           ],
          },
         },
         Raw {
          content: "\n\n",
          position: (10, 38),
         },
         Expression {
          expression: PropertyAccess {
           expression: Variable {
            identifier: "cfg",
            position: (12, 7),
           },
           attribute_path: AttributePath {
            attributes: [
             Raw {
              content: "extraConfig",
              position: (12, 11),
             },
            ],
           },
           default: None,
          },
         },
         Raw {
          content: "\n",
          position: (12, 23),
         },
        ],
       },
      ],
     },
    ),
   ],
   target: Map {
    bindings: [
     KeyValue(
      AttributePath {
       attributes: [
        Raw {
         content: "options",
         position: (17, 3),
        },
       ],
      },
      Map {
       bindings: [
        KeyValue(
         AttributePath {
          attributes: [
           Raw {
            content: "services",
            position: (19, 5),
           },
           Raw {
            content: "heartbeat",
            position: (19, 14),
           },
          ],
         },
         Map {
          bindings: [
           KeyValue(
            AttributePath {
             attributes: [
              Raw {
               content: "enable",
               position: (21, 7),
              },
             ],
            },
            FunctionApplication {
             function: Variable {
              identifier: "mkEnableOption",
              position: (21, 16),
             },
             arguments: [
              String {
               parts: [
                Raw {
                 content: "heartbeat",
                 position: (21, 32),
                },
               ],
              },
             ],
            },
           ),
           KeyValue(
            AttributePath {
             attributes: [
              Raw {
               content: "name",
               position: (23, 7),
              },
             ],
            },
            FunctionApplication {
             function: Variable {
              identifier: "mkOption",
              position: (23, 14),
             },
             arguments: [
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "type",
                    position: (24, 9),
                   },
                  ],
                 },
                 PropertyAccess {
                  expression: Variable {
                   identifier: "types",
                   position: (24, 16),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "str",
                     position: (24, 22),
                    },
                   ],
                  },
                  default: None,
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "default",
                    position: (25, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "heartbeat",
                    position: (25, 20),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "description",
                    position: (26, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "Name of the beat",
                    position: (26, 24),
                   },
                  ],
                 },
                ),
               ],
               recursive: false,
               position: (23, 23),
              },
             ],
            },
           ),
           KeyValue(
            AttributePath {
             attributes: [
              Raw {
               content: "tags",
               position: (29, 7),
              },
             ],
            },
            FunctionApplication {
             function: Variable {
              identifier: "mkOption",
              position: (29, 14),
             },
             arguments: [
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "type",
                    position: (30, 9),
                   },
                  ],
                 },
                 FunctionApplication {
                  function: PropertyAccess {
                   expression: Variable {
                    identifier: "types",
                    position: (30, 16),
                   },
                   attribute_path: AttributePath {
                    attributes: [
                     Raw {
                      content: "listOf",
                      position: (30, 22),
                     },
                    ],
                   },
                   default: None,
                  },
                  arguments: [
                   PropertyAccess {
                    expression: Variable {
                     identifier: "types",
                     position: (30, 29),
                    },
                    attribute_path: AttributePath {
                     attributes: [
                      Raw {
                       content: "str",
                       position: (30, 35),
                      },
                     ],
                    },
                    default: None,
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "default",
                    position: (31, 9),
                   },
                  ],
                 },
                 List {
                  elements: [],
                  position: (31, 19),
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "description",
                    position: (32, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "Tags to place on the shipped log messages",
                    position: (32, 24),
                   },
                  ],
                 },
                ),
               ],
               recursive: false,
               position: (29, 23),
              },
             ],
            },
           ),
           KeyValue(
            AttributePath {
             attributes: [
              Raw {
               content: "stateDir",
               position: (35, 7),
              },
             ],
            },
            FunctionApplication {
             function: Variable {
              identifier: "mkOption",
              position: (35, 18),
             },
             arguments: [
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "type",
                    position: (36, 9),
                   },
                  ],
                 },
                 PropertyAccess {
                  expression: Variable {
                   identifier: "types",
                   position: (36, 16),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "str",
                     position: (36, 22),
                    },
                   ],
                  },
                  default: None,
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "default",
                    position: (37, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "/var/lib/heartbeat",
                    position: (37, 20),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "description",
                    position: (38, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "The state directory. heartbeat's own logs and other data are stored here.",
                    position: (38, 24),
                   },
                  ],
                 },
                ),
               ],
               recursive: false,
               position: (35, 27),
              },
             ],
            },
           ),
           KeyValue(
            AttributePath {
             attributes: [
              Raw {
               content: "extraConfig",
               position: (41, 7),
              },
             ],
            },
            FunctionApplication {
             function: Variable {
              identifier: "mkOption",
              position: (41, 21),
             },
             arguments: [
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "type",
                    position: (42, 9),
                   },
                  ],
                 },
                 PropertyAccess {
                  expression: Variable {
                   identifier: "types",
                   position: (42, 16),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "lines",
                     position: (42, 22),
                    },
                   ],
                  },
                  default: None,
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "default",
                    position: (43, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "heartbeat.monitors:\n- type: http\n  urls: [\"http://localhost:9200\"]\n  schedule: '@every 10s'\n",
                    position: (44, 1),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "description",
                    position: (49, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "Any other configuration options you want to add",
                    position: (49, 24),
                   },
                  ],
                 },
                ),
               ],
               recursive: false,
               position: (41, 30),
              },
             ],
            },
           ),
          ],
          recursive: false,
          position: (19, 26),
         },
        ),
       ],
       recursive: false,
       position: (17, 13),
      },
     ),
     KeyValue(
      AttributePath {
       attributes: [
        Raw {
         content: "config",
         position: (55, 3),
        },
       ],
      },
      FunctionApplication {
       function: Variable {
        identifier: "mkIf",
        position: (55, 12),
       },
       arguments: [
        PropertyAccess {
         expression: Variable {
          identifier: "cfg",
          position: (55, 17),
         },
         attribute_path: AttributePath {
          attributes: [
           Raw {
            content: "enable",
            position: (55, 21),
           },
          ],
         },
         default: None,
        },
        Map {
         bindings: [
          KeyValue(
           AttributePath {
            attributes: [
             Raw {
              content: "systemd",
              position: (57, 5),
             },
             Raw {
              content: "tmpfiles",
              position: (57, 13),
             },
             Raw {
              content: "rules",
              position: (57, 22),
             },
            ],
           },
           List {
            elements: [
             String {
              parts: [
               Raw {
                content: "d '",
                position: (58, 8),
               },
               Expression {
                expression: PropertyAccess {
                 expression: Variable {
                  identifier: "cfg",
                  position: (58, 13),
                 },
                 attribute_path: AttributePath {
                  attributes: [
                   Raw {
                    content: "stateDir",
                    position: (58, 17),
                   },
                  ],
                 },
                 default: None,
                },
               },
               Raw {
                content: "' - nobody nogroup - -",
                position: (58, 26),
               },
              ],
             },
            ],
            position: (57, 30),
           },
          ),
          KeyValue(
           AttributePath {
            attributes: [
             Raw {
              content: "systemd",
              position: (61, 5),
             },
             Raw {
              content: "services",
              position: (61, 13),
             },
             Raw {
              content: "heartbeat",
              position: (61, 22),
             },
            ],
           },
           With {
            expression: Variable {
             identifier: "pkgs",
             position: (61, 39),
            },
            target: Map {
             bindings: [
              KeyValue(
               AttributePath {
                attributes: [
                 Raw {
                  content: "description",
                  position: (62, 7),
                 },
                ],
               },
               String {
                parts: [
                 Raw {
                  content: "heartbeat log shipper",
                  position: (62, 22),
                 },
                ],
               },
              ),
              KeyValue(
               AttributePath {
                attributes: [
                 Raw {
                  content: "wantedBy",
                  position: (63, 7),
                 },
                ],
               },
               List {
                elements: [
                 String {
                  parts: [
                   Raw {
                    content: "multi-user.target",
                    position: (63, 21),
                   },
                  ],
                 },
                ],
                position: (63, 18),
               },
              ),
              KeyValue(
               AttributePath {
                attributes: [
                 Raw {
                  content: "preStart",
                  position: (64, 7),
                 },
                ],
               },
               String {
                parts: [
                 Raw {
                  content: "mkdir -p \"",
                  position: (65, 1),
                 },
                 Expression {
                  expression: PropertyAccess {
                   expression: Variable {
                    identifier: "cfg",
                    position: (65, 21),
                   },
                   attribute_path: AttributePath {
                    attributes: [
                     Raw {
                      content: "stateDir",
                      position: (65, 25),
                     },
                    ],
                   },
                   default: None,
                  },
                 },
                 Raw {
                  content: "\"/{data,logs}\n",
                  position: (65, 34),
                 },
                ],
               },
              ),
              KeyValue(
               AttributePath {
                attributes: [
                 Raw {
                  content: "serviceConfig",
                  position: (67, 7),
                 },
                ],
               },
               Map {
                bindings: [
                 KeyValue(
                  AttributePath {
                   attributes: [
                    Raw {
                     content: "User",
                     position: (68, 9),
                    },
                   ],
                  },
                  String {
                   parts: [
                    Raw {
                     content: "nobody",
                     position: (68, 17),
                    },
                   ],
                  },
                 ),
                 KeyValue(
                  AttributePath {
                   attributes: [
                    Raw {
                     content: "AmbientCapabilities",
                     position: (69, 9),
                    },
                   ],
                  },
                  String {
                   parts: [
                    Raw {
                     content: "cap_net_raw",
                     position: (69, 32),
                    },
                   ],
                  },
                 ),
                 KeyValue(
                  AttributePath {
                   attributes: [
                    Raw {
                     content: "ExecStart",
                     position: (70, 9),
                    },
                   ],
                  },
                  String {
                   parts: [
                    Expression {
                     expression: PropertyAccess {
                      expression: Variable {
                       identifier: "pkgs",
                       position: (70, 24),
                      },
                      attribute_path: AttributePath {
                       attributes: [
                        Raw {
                         content: "heartbeat",
                         position: (70, 29),
                        },
                       ],
                      },
                      default: None,
                     },
                    },
                    Raw {
                     content: "/bin/heartbeat -c \"",
                     position: (70, 39),
                    },
                    Expression {
                     expression: Variable {
                      identifier: "heartbeatYml",
                      position: (70, 61),
                     },
                    },
                    Raw {
                     content: "\" -path.data \"",
                     position: (70, 74),
                    },
                    Expression {
                     expression: PropertyAccess {
                      expression: Variable {
                       identifier: "cfg",
                       position: (70, 92),
                      },
                      attribute_path: AttributePath {
                       attributes: [
                        Raw {
                         content: "stateDir",
                         position: (70, 96),
                        },
                       ],
                      },
                      default: None,
                     },
                    },
                    Raw {
                     content: "/data\" -path.logs \"",
                     position: (70, 105),
                    },
                    Expression {
                     expression: PropertyAccess {
                      expression: Variable {
                       identifier: "cfg",
                       position: (70, 128),
                      },
                      attribute_path: AttributePath {
                       attributes: [
                        Raw {
                         content: "stateDir",
                         position: (70, 132),
                        },
                       ],
                      },
                      default: None,
                     },
                    },
                    Raw {
                     content: "/logs\"",
                     position: (70, 141),
                    },
                   ],
                  },
                 ),
                ],
                recursive: false,
                position: (67, 23),
               },
              ),
             ],
             recursive: false,
             position: (61, 45),
            },
            position: (61, 34),
           },
          ),
         ],
         recursive: false,
         position: (55, 28),
        },
       ],
      },
     ),
    ],
    recursive: false,
    position: (16, 1),
   },
   position: (5, 1),
  },
  position: (3, 1),
 },
 position: (1, 1),
}