---
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: "cfg",
        position: (6, 3),
       },
      ],
     },
     PropertyAccess {
      expression: Variable {
       identifier: "config",
       position: (6, 9),
      },
      attribute_path: AttributePath {
       attributes: [
        Raw {
         content: "services",
         position: (6, 16),
        },
        Raw {
         content: "bazarr",
         position: (6, 25),
        },
       ],
      },
      default: None,
     },
    ),
   ],
   target: Map {
    bindings: [
     KeyValue(
      AttributePath {
       attributes: [
        Raw {
         content: "options",
         position: (9, 3),
        },
       ],
      },
      Map {
       bindings: [
        KeyValue(
         AttributePath {
          attributes: [
           Raw {
            content: "services",
            position: (10, 5),
           },
           Raw {
            content: "bazarr",
            position: (10, 14),
           },
          ],
         },
         Map {
          bindings: [
           KeyValue(
            AttributePath {
             attributes: [
              Raw {
               content: "enable",
               position: (11, 7),
              },
             ],
            },
            FunctionApplication {
             function: Variable {
              identifier: "mkEnableOption",
              position: (11, 16),
             },
             arguments: [
              String {
               parts: [
                Raw {
                 content: "bazarr, a subtitle manager for Sonarr and Radarr",
                 position: (11, 32),
                },
               ],
              },
             ],
            },
           ),
           KeyValue(
            AttributePath {
             attributes: [
              Raw {
               content: "openFirewall",
               position: (13, 7),
              },
             ],
            },
            FunctionApplication {
             function: Variable {
              identifier: "mkOption",
              position: (13, 22),
             },
             arguments: [
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "type",
                    position: (14, 9),
                   },
                  ],
                 },
                 PropertyAccess {
                  expression: Variable {
                   identifier: "types",
                   position: (14, 16),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "bool",
                     position: (14, 22),
                    },
                   ],
                  },
                  default: None,
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "default",
                    position: (15, 9),
                   },
                  ],
                 },
                 Variable {
                  identifier: "false",
                  position: (15, 19),
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "description",
                    position: (16, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "Open ports in the firewall for the bazarr web interface.",
                    position: (16, 24),
                   },
                  ],
                 },
                ),
               ],
               recursive: false,
               position: (13, 31),
              },
             ],
            },
           ),
           KeyValue(
            AttributePath {
             attributes: [
              Raw {
               content: "listenPort",
               position: (19, 7),
              },
             ],
            },
            FunctionApplication {
             function: Variable {
              identifier: "mkOption",
              position: (19, 20),
             },
             arguments: [
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "type",
                    position: (20, 9),
                   },
                  ],
                 },
                 PropertyAccess {
                  expression: Variable {
                   identifier: "types",
                   position: (20, 16),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "port",
                     position: (20, 22),
                    },
                   ],
                  },
                  default: None,
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "default",
                    position: (21, 9),
                   },
                  ],
                 },
                 Int {
                  value: 6767,
                  position: (21, 19),
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "description",
                    position: (22, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "Port on which the bazarr web interface should listen",
                    position: (22, 24),
                   },
                  ],
                 },
                ),
               ],
               recursive: false,
               position: (19, 29),
              },
             ],
            },
           ),
           KeyValue(
            AttributePath {
             attributes: [
              Raw {
               content: "user",
               position: (25, 7),
              },
             ],
            },
            FunctionApplication {
             function: Variable {
              identifier: "mkOption",
              position: (25, 14),
             },
             arguments: [
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "type",
                    position: (26, 9),
                   },
                  ],
                 },
                 PropertyAccess {
                  expression: Variable {
                   identifier: "types",
                   position: (26, 16),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "str",
                     position: (26, 22),
                    },
                   ],
                  },
                  default: None,
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "default",
                    position: (27, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "bazarr",
                    position: (27, 20),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "description",
                    position: (28, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "User account under which bazarr runs.",
                    position: (28, 24),
                   },
                  ],
                 },
                ),
               ],
               recursive: false,
               position: (25, 23),
              },
             ],
            },
           ),
           KeyValue(
            AttributePath {
             attributes: [
              Raw {
               content: "group",
               position: (31, 7),
              },
             ],
            },
            FunctionApplication {
             function: Variable {
              identifier: "mkOption",
              position: (31, 15),
             },
             arguments: [
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "type",
                    position: (32, 9),
                   },
                  ],
                 },
                 PropertyAccess {
                  expression: Variable {
                   identifier: "types",
                   position: (32, 16),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "str",
                     position: (32, 22),
                    },
                   ],
                  },
                  default: None,
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "default",
                    position: (33, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "bazarr",
                    position: (33, 20),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "description",
                    position: (34, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "Group under which bazarr runs.",
                    position: (34, 24),
                   },
                  ],
                 },
                ),
               ],
               recursive: false,
               position: (31, 24),
              },
             ],
            },
           ),
          ],
          recursive: false,
          position: (10, 23),
         },
        ),
       ],
       recursive: false,
       position: (9, 13),
      },
     ),
     KeyValue(
      AttributePath {
       attributes: [
        Raw {
         content: "config",
         position: (39, 3),
        },
       ],
      },
      FunctionApplication {
       function: Variable {
        identifier: "mkIf",
        position: (39, 12),
       },
       arguments: [
        PropertyAccess {
         expression: Variable {
          identifier: "cfg",
          position: (39, 17),
         },
         attribute_path: AttributePath {
          attributes: [
           Raw {
            content: "enable",
            position: (39, 21),
           },
          ],
         },
         default: None,
        },
        Map {
         bindings: [
          KeyValue(
           AttributePath {
            attributes: [
             Raw {
              content: "systemd",
              position: (40, 5),
             },
             Raw {
              content: "services",
              position: (40, 13),
             },
             Raw {
              content: "bazarr",
              position: (40, 22),
             },
            ],
           },
           Map {
            bindings: [
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "description",
                 position: (41, 7),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "bazarr",
                 position: (41, 22),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "after",
                 position: (42, 7),
                },
               ],
              },
              List {
               elements: [
                String {
                 parts: [
                  Raw {
                   content: "network.target",
                   position: (42, 18),
                  },
                 ],
                },
               ],
               position: (42, 15),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "wantedBy",
                 position: (43, 7),
                },
               ],
              },
              List {
               elements: [
                String {
                 parts: [
                  Raw {
                   content: "multi-user.target",
                   position: (43, 21),
                  },
                 ],
                },
               ],
               position: (43, 18),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "serviceConfig",
                 position: (45, 7),
                },
               ],
              },
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "Type",
                    position: (46, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "simple",
                    position: (46, 17),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "User",
                    position: (47, 9),
                   },
                  ],
                 },
                 PropertyAccess {
                  expression: Variable {
                   identifier: "cfg",
                   position: (47, 16),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "user",
                     position: (47, 20),
                    },
                   ],
                  },
                  default: None,
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "Group",
                    position: (48, 9),
                   },
                  ],
                 },
                 PropertyAccess {
                  expression: Variable {
                   identifier: "cfg",
                   position: (48, 17),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "group",
                     position: (48, 21),
                    },
                   ],
                  },
                  default: None,
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "StateDirectory",
                    position: (49, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "bazarr",
                    position: (49, 27),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "SyslogIdentifier",
                    position: (50, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "bazarr",
                    position: (50, 29),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "ExecStart",
                    position: (51, 9),
                   },
                  ],
                 },
                 FunctionApplication {
                  function: PropertyAccess {
                   expression: Variable {
                    identifier: "pkgs",
                    position: (51, 21),
                   },
                   attribute_path: AttributePath {
                    attributes: [
                     Raw {
                      content: "writeShellScript",
                      position: (51, 26),
                     },
                    ],
                   },
                   default: None,
                  },
                  arguments: [
                   String {
                    parts: [
                     Raw {
                      content: "start-bazarr",
                      position: (51, 44),
                     },
                    ],
                   },
                   String {
                    parts: [
                     Raw {
                      content: "",
                      position: (52, 1),
                     },
                     Expression {
                      expression: PropertyAccess {
                       expression: Variable {
                        identifier: "pkgs",
                        position: (52, 13),
                       },
                       attribute_path: AttributePath {
                        attributes: [
                         Raw {
                          content: "bazarr",
                          position: (52, 18),
                         },
                        ],
                       },
                       default: None,
                      },
                     },
                     Raw {
                      content: "/bin/bazarr \\\n  --config '/var/lib/",
                      position: (52, 25),
                     },
                     Expression {
                      expression: Variable {
                       identifier: "StateDirectory",
                       position: (53, 34),
                      },
                     },
                     Raw {
                      content: "' \\\n  --port ",
                      position: (53, 49),
                     },
                     Expression {
                      expression: FunctionApplication {
                       function: Variable {
                        identifier: "toString",
                        position: (54, 22),
                       },
                       arguments: [
                        PropertyAccess {
                         expression: Variable {
                          identifier: "cfg",
                          position: (54, 31),
                         },
                         attribute_path: AttributePath {
                          attributes: [
                           Raw {
                            content: "listenPort",
                            position: (54, 35),
                           },
                          ],
                         },
                         default: None,
                        },
                       ],
                      },
                     },
                     Raw {
                      content: " \\\n  --no-update True\n",
                      position: (54, 46),
                     },
                    ],
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "Restart",
                    position: (57, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "on-failure",
                    position: (57, 20),
                   },
                  ],
                 },
                ),
               ],
               recursive: true,
               position: (45, 23),
              },
             ),
            ],
            recursive: false,
            position: (40, 31),
           },
          ),
          KeyValue(
           AttributePath {
            attributes: [
             Raw {
              content: "networking",
              position: (61, 5),
             },
             Raw {
              content: "firewall",
              position: (61, 16),
             },
            ],
           },
           FunctionApplication {
            function: Variable {
             identifier: "mkIf",
             position: (61, 27),
            },
            arguments: [
             PropertyAccess {
              expression: Variable {
               identifier: "cfg",
               position: (61, 32),
              },
              attribute_path: AttributePath {
               attributes: [
                Raw {
                 content: "openFirewall",
                 position: (61, 36),
                },
               ],
              },
              default: None,
             },
             Map {
              bindings: [
               KeyValue(
                AttributePath {
                 attributes: [
                  Raw {
                   content: "allowedTCPPorts",
                   position: (62, 7),
                  },
                 ],
                },
                List {
                 elements: [
                  PropertyAccess {
                   expression: Variable {
                    identifier: "cfg",
                    position: (62, 27),
                   },
                   attribute_path: AttributePath {
                    attributes: [
                     Raw {
                      content: "listenPort",
                      position: (62, 31),
                     },
                    ],
                   },
                   default: None,
                  },
                 ],
                 position: (62, 25),
                },
               ),
              ],
              recursive: false,
              position: (61, 49),
             },
            ],
           },
          ),
          KeyValue(
           AttributePath {
            attributes: [
             Raw {
              content: "users",
              position: (65, 5),
             },
             Raw {
              content: "users",
              position: (65, 11),
             },
            ],
           },
           FunctionApplication {
            function: Variable {
             identifier: "mkIf",
             position: (65, 19),
            },
            arguments: [
             BinaryOperation {
              operator: EqualTo,
              operands: [
               PropertyAccess {
                expression: Variable {
                 identifier: "cfg",
                 position: (65, 25),
                },
                attribute_path: AttributePath {
                 attributes: [
                  Raw {
                   content: "user",
                   position: (65, 29),
                  },
                 ],
                },
                default: None,
               },
               String {
                parts: [
                 Raw {
                  content: "bazarr",
                  position: (65, 38),
                 },
                ],
               },
              ],
              position: (65, 34),
             },
             Map {
              bindings: [
               KeyValue(
                AttributePath {
                 attributes: [
                  Raw {
                   content: "bazarr",
                   position: (66, 7),
                  },
                 ],
                },
                Map {
                 bindings: [
                  KeyValue(
                   AttributePath {
                    attributes: [
                     Raw {
                      content: "isSystemUser",
                      position: (67, 9),
                     },
                    ],
                   },
                   Variable {
                    identifier: "true",
                    position: (67, 24),
                   },
                  ),
                  KeyValue(
                   AttributePath {
                    attributes: [
                     Raw {
                      content: "group",
                      position: (68, 9),
                     },
                    ],
                   },
                   PropertyAccess {
                    expression: Variable {
                     identifier: "cfg",
                     position: (68, 17),
                    },
                    attribute_path: AttributePath {
                     attributes: [
                      Raw {
                       content: "group",
                       position: (68, 21),
                      },
                     ],
                    },
                    default: None,
                   },
                  ),
                  KeyValue(
                   AttributePath {
                    attributes: [
                     Raw {
                      content: "home",
                      position: (69, 9),
                     },
                    ],
                   },
                   String {
                    parts: [
                     Raw {
                      content: "/var/lib/",
                      position: (69, 17),
                     },
                     Expression {
                      expression: PropertyAccess {
                       expression: Variable {
                        identifier: "config",
                        position: (69, 28),
                       },
                       attribute_path: AttributePath {
                        attributes: [
                         Raw {
                          content: "systemd",
                          position: (69, 35),
                         },
                         Raw {
                          content: "services",
                          position: (69, 43),
                         },
                         Raw {
                          content: "bazarr",
                          position: (69, 52),
                         },
                         Raw {
                          content: "serviceConfig",
                          position: (69, 59),
                         },
                         Raw {
                          content: "StateDirectory",
                          position: (69, 73),
                         },
                        ],
                       },
                       default: None,
                      },
                     },
                    ],
                   },
                  ),
                 ],
                 recursive: false,
                 position: (66, 16),
                },
               ),
              ],
              recursive: false,
              position: (65, 47),
             },
            ],
           },
          ),
          KeyValue(
           AttributePath {
            attributes: [
             Raw {
              content: "users",
              position: (73, 5),
             },
             Raw {
              content: "groups",
              position: (73, 11),
             },
            ],
           },
           FunctionApplication {
            function: Variable {
             identifier: "mkIf",
             position: (73, 20),
            },
            arguments: [
             BinaryOperation {
              operator: EqualTo,
              operands: [
               PropertyAccess {
                expression: Variable {
                 identifier: "cfg",
                 position: (73, 26),
                },
                attribute_path: AttributePath {
                 attributes: [
                  Raw {
                   content: "group",
                   position: (73, 30),
                  },
                 ],
                },
                default: None,
               },
               String {
                parts: [
                 Raw {
                  content: "bazarr",
                  position: (73, 40),
                 },
                ],
               },
              ],
              position: (73, 36),
             },
             Map {
              bindings: [
               KeyValue(
                AttributePath {
                 attributes: [
                  Raw {
                   content: "bazarr",
                   position: (74, 7),
                  },
                 ],
                },
                Map {
                 bindings: [],
                 recursive: false,
                 position: (74, 16),
                },
               ),
              ],
              recursive: false,
              position: (73, 49),
             },
            ],
           },
          ),
         ],
         recursive: false,
         position: (39, 28),
        },
       ],
      },
     ),
    ],
    recursive: false,
    position: (8, 1),
   },
   position: (5, 1),
  },
  position: (3, 1),
 },
 position: (1, 1),
}