---
Function {
 argument: None,
 arguments: FunctionArguments {
  arguments: [
   FunctionArgument {
    identifier: "lib",
    default: None,
   },
   FunctionArgument {
    identifier: "pkgs",
    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: "dataDir",
        position: (6, 3),
       },
      ],
     },
     String {
      parts: [
       Raw {
        content: "/var/lib/mx-puppet-discord",
        position: (6, 14),
       },
      ],
     },
    ),
    KeyValue(
     AttributePath {
      attributes: [
       Raw {
        content: "registrationFile",
        position: (7, 3),
       },
      ],
     },
     String {
      parts: [
       Expression {
        expression: Variable {
         identifier: "dataDir",
         position: (7, 25),
        },
       },
       Raw {
        content: "/discord-registration.yaml",
        position: (7, 33),
       },
      ],
     },
    ),
    KeyValue(
     AttributePath {
      attributes: [
       Raw {
        content: "cfg",
        position: (8, 3),
       },
      ],
     },
     PropertyAccess {
      expression: Variable {
       identifier: "config",
       position: (8, 9),
      },
      attribute_path: AttributePath {
       attributes: [
        Raw {
         content: "services",
         position: (8, 16),
        },
        Raw {
         content: "mx-puppet-discord",
         position: (8, 25),
        },
       ],
      },
      default: None,
     },
    ),
    KeyValue(
     AttributePath {
      attributes: [
       Raw {
        content: "settingsFormat",
        position: (9, 3),
       },
      ],
     },
     FunctionApplication {
      function: PropertyAccess {
       expression: Variable {
        identifier: "pkgs",
        position: (9, 20),
       },
       attribute_path: AttributePath {
        attributes: [
         Raw {
          content: "formats",
          position: (9, 25),
         },
         Raw {
          content: "json",
          position: (9, 33),
         },
        ],
       },
       default: None,
      },
      arguments: [
       Map {
        bindings: [],
        recursive: false,
        position: (9, 38),
       },
      ],
     },
    ),
    KeyValue(
     AttributePath {
      attributes: [
       Raw {
        content: "settingsFile",
        position: (10, 3),
       },
      ],
     },
     FunctionApplication {
      function: PropertyAccess {
       expression: Variable {
        identifier: "settingsFormat",
        position: (10, 18),
       },
       attribute_path: AttributePath {
        attributes: [
         Raw {
          content: "generate",
          position: (10, 33),
         },
        ],
       },
       default: None,
      },
      arguments: [
       String {
        parts: [
         Raw {
          content: "mx-puppet-discord-config.json",
          position: (10, 43),
         },
        ],
       },
       PropertyAccess {
        expression: Variable {
         identifier: "cfg",
         position: (10, 74),
        },
        attribute_path: AttributePath {
         attributes: [
          Raw {
           content: "settings",
           position: (10, 78),
          },
         ],
        },
        default: None,
       },
      ],
     },
    ),
   ],
   target: Map {
    bindings: [
     KeyValue(
      AttributePath {
       attributes: [
        Raw {
         content: "options",
         position: (13, 3),
        },
       ],
      },
      Map {
       bindings: [
        KeyValue(
         AttributePath {
          attributes: [
           Raw {
            content: "services",
            position: (14, 5),
           },
           Raw {
            content: "mx-puppet-discord",
            position: (14, 14),
           },
          ],
         },
         Map {
          bindings: [
           KeyValue(
            AttributePath {
             attributes: [
              Raw {
               content: "enable",
               position: (15, 7),
              },
             ],
            },
            FunctionApplication {
             function: Variable {
              identifier: "mkEnableOption",
              position: (15, 16),
             },
             arguments: [
              String {
               parts: [
                Raw {
                 content: "mx-puppet-discord is a discord puppeting bridge for matrix.\nIt handles bridging private and group DMs, as well as Guilds (servers)\n",
                 position: (16, 1),
                },
               ],
              },
             ],
            },
           ),
           KeyValue(
            AttributePath {
             attributes: [
              Raw {
               content: "settings",
               position: (20, 7),
              },
             ],
            },
            FunctionApplication {
             function: Variable {
              identifier: "mkOption",
              position: (20, 18),
             },
             arguments: [
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "apply",
                    position: (21, 9),
                   },
                  ],
                 },
                 FunctionApplication {
                  function: Variable {
                   identifier: "recursiveUpdate",
                   position: (21, 17),
                  },
                  arguments: [
                   Variable {
                    identifier: "default",
                    position: (21, 33),
                   },
                  ],
                 },
                ),
                Inherit(
                 Some(
                  Variable {
                   identifier: "settingsFormat",
                   position: (22, 18),
                  },
                 ),
                 [
                  Raw {
                   content: "type",
                   position: (22, 34),
                  },
                 ],
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "default",
                    position: (23, 9),
                   },
                  ],
                 },
                 Map {
                  bindings: [
                   KeyValue(
                    AttributePath {
                     attributes: [
                      Raw {
                       content: "bridge",
                       position: (24, 11),
                      },
                      Raw {
                       content: "port",
                       position: (24, 18),
                      },
                     ],
                    },
                    Int {
                     value: 8434,
                     position: (24, 25),
                    },
                   ),
                   KeyValue(
                    AttributePath {
                     attributes: [
                      Raw {
                       content: "presence",
                       position: (25, 11),
                      },
                     ],
                    },
                    Map {
                     bindings: [
                      KeyValue(
                       AttributePath {
                        attributes: [
                         Raw {
                          content: "enabled",
                          position: (26, 13),
                         },
                        ],
                       },
                       Variable {
                        identifier: "true",
                        position: (26, 23),
                       },
                      ),
                      KeyValue(
                       AttributePath {
                        attributes: [
                         Raw {
                          content: "interval",
                          position: (27, 13),
                         },
                        ],
                       },
                       Int {
                        value: 500,
                        position: (27, 24),
                       },
                      ),
                     ],
                     recursive: false,
                     position: (25, 22),
                    },
                   ),
                   KeyValue(
                    AttributePath {
                     attributes: [
                      Raw {
                       content: "provisioning",
                       position: (29, 11),
                      },
                      Raw {
                       content: "whitelist",
                       position: (29, 24),
                      },
                     ],
                    },
                    List {
                     elements: [],
                     position: (29, 36),
                    },
                   ),
                   KeyValue(
                    AttributePath {
                     attributes: [
                      Raw {
                       content: "relay",
                       position: (30, 11),
                      },
                      Raw {
                       content: "whitelist",
                       position: (30, 17),
                      },
                     ],
                    },
                    List {
                     elements: [],
                     position: (30, 29),
                    },
                   ),
                   KeyValue(
                    AttributePath {
                     attributes: [
                      Raw {
                       content: "namePatterns",
                       position: (33, 11),
                      },
                     ],
                    },
                    Map {
                     bindings: [
                      KeyValue(
                       AttributePath {
                        attributes: [
                         Raw {
                          content: "user",
                          position: (34, 13),
                         },
                        ],
                       },
                       String {
                        parts: [
                         Raw {
                          content: ":name",
                          position: (34, 21),
                         },
                        ],
                       },
                      ),
                      KeyValue(
                       AttributePath {
                        attributes: [
                         Raw {
                          content: "userOverride",
                          position: (35, 13),
                         },
                        ],
                       },
                       String {
                        parts: [
                         Raw {
                          content: ":displayname",
                          position: (35, 29),
                         },
                        ],
                       },
                      ),
                      KeyValue(
                       AttributePath {
                        attributes: [
                         Raw {
                          content: "room",
                          position: (36, 13),
                         },
                        ],
                       },
                       String {
                        parts: [
                         Raw {
                          content: ":name",
                          position: (36, 21),
                         },
                        ],
                       },
                      ),
                      KeyValue(
                       AttributePath {
                        attributes: [
                         Raw {
                          content: "group",
                          position: (37, 13),
                         },
                        ],
                       },
                       String {
                        parts: [
                         Raw {
                          content: ":name",
                          position: (37, 22),
                         },
                        ],
                       },
                      ),
                     ],
                     recursive: false,
                     position: (33, 26),
                    },
                   ),
                   KeyValue(
                    AttributePath {
                     attributes: [
                      Raw {
                       content: "database",
                       position: (42, 11),
                      },
                      Raw {
                       content: "filename",
                       position: (42, 20),
                      },
                     ],
                    },
                    String {
                     parts: [
                      Expression {
                       expression: Variable {
                        identifier: "dataDir",
                        position: (42, 34),
                       },
                      },
                      Raw {
                       content: "/database.db",
                       position: (42, 42),
                      },
                     ],
                    },
                   ),
                   KeyValue(
                    AttributePath {
                     attributes: [
                      Raw {
                       content: "logging",
                       position: (43, 11),
                      },
                     ],
                    },
                    Map {
                     bindings: [
                      KeyValue(
                       AttributePath {
                        attributes: [
                         Raw {
                          content: "console",
                          position: (44, 13),
                         },
                        ],
                       },
                       String {
                        parts: [
                         Raw {
                          content: "info",
                          position: (44, 24),
                         },
                        ],
                       },
                      ),
                      KeyValue(
                       AttributePath {
                        attributes: [
                         Raw {
                          content: "lineDateFormat",
                          position: (45, 13),
                         },
                        ],
                       },
                       String {
                        parts: [
                         Raw {
                          content: "MMM-D HH:mm:ss.SSS",
                          position: (45, 31),
                         },
                        ],
                       },
                      ),
                     ],
                     recursive: false,
                     position: (43, 21),
                    },
                   ),
                  ],
                  recursive: false,
                  position: (23, 19),
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "example",
                    position: (48, 9),
                   },
                  ],
                 },
                 FunctionApplication {
                  function: Variable {
                   identifier: "literalExpression",
                   position: (48, 19),
                  },
                  arguments: [
                   String {
                    parts: [
                     Raw {
                      content: "{\n  bridge = {\n    bindAddress = \"localhost\";\n    domain = \"example.com\";\n    homeserverUrl = \"https://example.com\";\n  };\n\n  provisioning.whitelist = [ \"@admin:example.com\" ];\n  relay.whitelist = [ \"@.*:example.com\" ];\n}\n",
                      position: (49, 1),
                     },
                    ],
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "description",
                    position: (60, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "<filename>config.yaml</filename> configuration as a Nix attribute set.\nConfiguration options should match those described in\n<link xlink:href=\"https://github.com/matrix-discord/mx-puppet-discord/blob/master/sample.config.yaml\">\nsample.config.yaml</link>.\n",
                    position: (61, 1),
                   },
                  ],
                 },
                ),
               ],
               recursive: true,
               position: (20, 27),
              },
             ],
            },
           ),
           KeyValue(
            AttributePath {
             attributes: [
              Raw {
               content: "serviceDependencies",
               position: (67, 7),
              },
             ],
            },
            FunctionApplication {
             function: Variable {
              identifier: "mkOption",
              position: (67, 29),
             },
             arguments: [
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "type",
                    position: (68, 9),
                   },
                  ],
                 },
                 With {
                  expression: Variable {
                   identifier: "types",
                   position: (68, 21),
                  },
                  target: FunctionApplication {
                   function: Variable {
                    identifier: "listOf",
                    position: (68, 28),
                   },
                   arguments: [
                    Variable {
                     identifier: "str",
                     position: (68, 35),
                    },
                   ],
                  },
                  position: (68, 16),
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "default",
                    position: (69, 9),
                   },
                  ],
                 },
                 FunctionApplication {
                  function: Variable {
                   identifier: "optional",
                   position: (69, 19),
                  },
                  arguments: [
                   PropertyAccess {
                    expression: Variable {
                     identifier: "config",
                     position: (69, 28),
                    },
                    attribute_path: AttributePath {
                     attributes: [
                      Raw {
                       content: "services",
                       position: (69, 35),
                      },
                      Raw {
                       content: "matrix-synapse",
                       position: (69, 44),
                      },
                      Raw {
                       content: "enable",
                       position: (69, 59),
                      },
                     ],
                    },
                    default: None,
                   },
                   String {
                    parts: [
                     Raw {
                      content: "matrix-synapse.service",
                      position: (69, 67),
                     },
                    ],
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "defaultText",
                    position: (70, 9),
                   },
                  ],
                 },
                 FunctionApplication {
                  function: Variable {
                   identifier: "literalExpression",
                   position: (70, 23),
                  },
                  arguments: [
                   String {
                    parts: [
                     Raw {
                      content: "optional config.services.matrix-synapse.enable \"matrix-synapse.service\"\n",
                      position: (71, 1),
                     },
                    ],
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "description",
                    position: (73, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "List of Systemd services to require and wait for when starting the application service.\n",
                    position: (74, 1),
                   },
                  ],
                 },
                ),
               ],
               recursive: false,
               position: (67, 38),
              },
             ],
            },
           ),
          ],
          recursive: false,
          position: (14, 34),
         },
        ),
       ],
       recursive: false,
       position: (13, 13),
      },
     ),
     KeyValue(
      AttributePath {
       attributes: [
        Raw {
         content: "config",
         position: (80, 3),
        },
       ],
      },
      FunctionApplication {
       function: Variable {
        identifier: "mkIf",
        position: (80, 12),
       },
       arguments: [
        PropertyAccess {
         expression: Variable {
          identifier: "cfg",
          position: (80, 17),
         },
         attribute_path: AttributePath {
          attributes: [
           Raw {
            content: "enable",
            position: (80, 21),
           },
          ],
         },
         default: None,
        },
        Map {
         bindings: [
          KeyValue(
           AttributePath {
            attributes: [
             Raw {
              content: "systemd",
              position: (81, 5),
             },
             Raw {
              content: "services",
              position: (81, 13),
             },
             Raw {
              content: "mx-puppet-discord",
              position: (81, 22),
             },
            ],
           },
           Map {
            bindings: [
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "description",
                 position: (82, 7),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "Matrix to Discord puppeting bridge",
                 position: (82, 22),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "wantedBy",
                 position: (84, 7),
                },
               ],
              },
              List {
               elements: [
                String {
                 parts: [
                  Raw {
                   content: "multi-user.target",
                   position: (84, 21),
                  },
                 ],
                },
               ],
               position: (84, 18),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "wants",
                 position: (85, 7),
                },
               ],
              },
              BinaryOperation {
               operator: Concatenation,
               operands: [
                List {
                 elements: [
                  String {
                   parts: [
                    Raw {
                     content: "network-online.target",
                     position: (85, 18),
                    },
                   ],
                  },
                 ],
                 position: (85, 15),
                },
                PropertyAccess {
                 expression: Variable {
                  identifier: "cfg",
                  position: (85, 46),
                 },
                 attribute_path: AttributePath {
                  attributes: [
                   Raw {
                    content: "serviceDependencies",
                    position: (85, 50),
                   },
                  ],
                 },
                 default: None,
                },
               ],
               position: (85, 43),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "after",
                 position: (86, 7),
                },
               ],
              },
              BinaryOperation {
               operator: Concatenation,
               operands: [
                List {
                 elements: [
                  String {
                   parts: [
                    Raw {
                     content: "network-online.target",
                     position: (86, 18),
                    },
                   ],
                  },
                 ],
                 position: (86, 15),
                },
                PropertyAccess {
                 expression: Variable {
                  identifier: "cfg",
                  position: (86, 46),
                 },
                 attribute_path: AttributePath {
                  attributes: [
                   Raw {
                    content: "serviceDependencies",
                    position: (86, 50),
                   },
                  ],
                 },
                 default: None,
                },
               ],
               position: (86, 43),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "preStart",
                 position: (88, 7),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "# generate the appservice's registration file if absent\nif [ ! -f ",
                 position: (89, 1),
                },
                Raw {
                 content: "'",
                 position: (90, 19),
                },
                Expression {
                 expression: Variable {
                  identifier: "registrationFile",
                  position: (90, 22),
                 },
                },
                Raw {
                 content: "' ]; then\n  ",
                 position: (90, 39),
                },
                Expression {
                 expression: PropertyAccess {
                  expression: Variable {
                   identifier: "pkgs",
                   position: (91, 13),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "mx-puppet-discord",
                     position: (91, 18),
                    },
                   ],
                  },
                  default: None,
                 },
                },
                Raw {
                 content: "/bin/mx-puppet-discord -r -c ",
                 position: (91, 36),
                },
                Expression {
                 expression: Variable {
                  identifier: "settingsFile",
                  position: (91, 67),
                 },
                },
                Raw {
                 content: " \\\n  -f ",
                 position: (91, 80),
                },
                Expression {
                 expression: Variable {
                  identifier: "registrationFile",
                  position: (92, 16),
                 },
                },
                Raw {
                 content: "\nfi\n",
                 position: (92, 33),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "serviceConfig",
                 position: (96, 7),
                },
               ],
              },
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "Type",
                    position: (97, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "simple",
                    position: (97, 17),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "Restart",
                    position: (98, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "always",
                    position: (98, 20),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "ProtectSystem",
                    position: (100, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "strict",
                    position: (100, 26),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "ProtectHome",
                    position: (101, 9),
                   },
                  ],
                 },
                 Variable {
                  identifier: "true",
                  position: (101, 23),
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "ProtectKernelTunables",
                    position: (102, 9),
                   },
                  ],
                 },
                 Variable {
                  identifier: "true",
                  position: (102, 33),
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "ProtectKernelModules",
                    position: (103, 9),
                   },
                  ],
                 },
                 Variable {
                  identifier: "true",
                  position: (103, 32),
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "ProtectControlGroups",
                    position: (104, 9),
                   },
                  ],
                 },
                 Variable {
                  identifier: "true",
                  position: (104, 32),
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "DynamicUser",
                    position: (106, 9),
                   },
                  ],
                 },
                 Variable {
                  identifier: "true",
                  position: (106, 23),
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "PrivateTmp",
                    position: (107, 9),
                   },
                  ],
                 },
                 Variable {
                  identifier: "true",
                  position: (107, 22),
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "WorkingDirectory",
                    position: (108, 9),
                   },
                  ],
                 },
                 PropertyAccess {
                  expression: Variable {
                   identifier: "pkgs",
                   position: (108, 28),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "mx-puppet-discord",
                     position: (108, 33),
                    },
                   ],
                  },
                  default: None,
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "StateDirectory",
                    position: (109, 9),
                   },
                  ],
                 },
                 FunctionApplication {
                  function: Variable {
                   identifier: "baseNameOf",
                   position: (109, 26),
                  },
                  arguments: [
                   Variable {
                    identifier: "dataDir",
                    position: (109, 37),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "UMask",
                    position: (110, 9),
                   },
                  ],
                 },
                 Int {
                  value: 27,
                  position: (110, 17),
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "ExecStart",
                    position: (112, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "",
                    position: (113, 1),
                   },
                   Expression {
                    expression: PropertyAccess {
                     expression: Variable {
                      identifier: "pkgs",
                      position: (113, 13),
                     },
                     attribute_path: AttributePath {
                      attributes: [
                       Raw {
                        content: "mx-puppet-discord",
                        position: (113, 18),
                       },
                      ],
                     },
                     default: None,
                    },
                   },
                   Raw {
                    content: "/bin/mx-puppet-discord \\\n  -c ",
                    position: (113, 36),
                   },
                   Expression {
                    expression: Variable {
                     identifier: "settingsFile",
                     position: (114, 18),
                    },
                   },
                   Raw {
                    content: " \\\n  -f ",
                    position: (114, 31),
                   },
                   Expression {
                    expression: Variable {
                     identifier: "registrationFile",
                     position: (115, 18),
                    },
                   },
                   Raw {
                    content: "\n",
                    position: (115, 35),
                   },
                  ],
                 },
                ),
               ],
               recursive: false,
               position: (96, 23),
              },
             ),
            ],
            recursive: false,
            position: (81, 42),
           },
          ),
         ],
         recursive: false,
         position: (80, 28),
        },
       ],
      },
     ),
     KeyValue(
      AttributePath {
       attributes: [
        Raw {
         content: "meta",
         position: (121, 3),
        },
        Raw {
         content: "maintainers",
         position: (121, 8),
        },
       ],
      },
      With {
       expression: Variable {
        identifier: "maintainers",
        position: (121, 27),
       },
       target: List {
        elements: [
         Variable {
          identifier: "govanify",
          position: (121, 42),
         },
        ],
        position: (121, 40),
       },
       position: (121, 22),
      },
     ),
    ],
    recursive: false,
    position: (12, 4),
   },
   position: (5, 1),
  },
  position: (3, 1),
 },
 position: (1, 1),
}