---
Function {
 argument: None,
 arguments: FunctionArguments {
  arguments: [
   FunctionArgument {
    identifier: "pkgs",
    default: None,
   },
   FunctionArgument {
    identifier: "lib",
    default: None,
   },
   FunctionArgument {
    identifier: "config",
    default: None,
   },
  ],
  ellipsis: true,
 },
 definition: With {
  expression: Variable {
   identifier: "lib",
   position: (3, 6),
  },
  target: LetIn {
   bindings: [
    KeyValue(
     AttributePath {
      attributes: [
       Raw {
        content: "cfg",
        position: (7, 3),
       },
      ],
     },
     PropertyAccess {
      expression: Variable {
       identifier: "config",
       position: (7, 9),
      },
      attribute_path: AttributePath {
       attributes: [
        Raw {
         content: "services",
         position: (7, 16),
        },
        Raw {
         content: "calibre-server",
         position: (7, 25),
        },
       ],
      },
      default: None,
     },
    ),
   ],
   target: Map {
    bindings: [
     KeyValue(
      AttributePath {
       attributes: [
        Raw {
         content: "imports",
         position: (12, 3),
        },
       ],
      },
      List {
       elements: [
        FunctionApplication {
         function: Variable {
          identifier: "mkChangedOptionModule",
          position: (13, 6),
         },
         arguments: [
          List {
           elements: [
            String {
             parts: [
              Raw {
               content: "services",
               position: (13, 31),
              },
             ],
            },
            String {
             parts: [
              Raw {
               content: "calibre-server",
               position: (13, 42),
              },
             ],
            },
            String {
             parts: [
              Raw {
               content: "libraryDir",
               position: (13, 59),
              },
             ],
            },
           ],
           position: (13, 28),
          },
          List {
           elements: [
            String {
             parts: [
              Raw {
               content: "services",
               position: (13, 76),
              },
             ],
            },
            String {
             parts: [
              Raw {
               content: "calibre-server",
               position: (13, 87),
              },
             ],
            },
            String {
             parts: [
              Raw {
               content: "libraries",
               position: (13, 104),
              },
             ],
            },
           ],
           position: (13, 73),
          },
          Function {
           argument: Some(
            "config",
           ),
           arguments: FunctionArguments {
            arguments: [],
            ellipsis: false,
           },
           definition: LetIn {
            bindings: [
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "libraryDir",
                 position: (15, 13),
                },
               ],
              },
              FunctionApplication {
               function: Variable {
                identifier: "getAttrFromPath",
                position: (15, 26),
               },
               arguments: [
                List {
                 elements: [
                  String {
                   parts: [
                    Raw {
                     content: "services",
                     position: (15, 45),
                    },
                   ],
                  },
                  String {
                   parts: [
                    Raw {
                     content: "calibre-server",
                     position: (15, 56),
                    },
                   ],
                  },
                  String {
                   parts: [
                    Raw {
                     content: "libraryDir",
                     position: (15, 73),
                    },
                   ],
                  },
                 ],
                 position: (15, 42),
                },
                Variable {
                 identifier: "config",
                 position: (15, 87),
                },
               ],
              },
             ),
            ],
            target: List {
             elements: [
              Variable {
               identifier: "libraryDir",
               position: (16, 14),
              },
             ],
             position: (16, 12),
            },
            position: (15, 9),
           },
           position: (14, 8),
          },
         ],
        },
       ],
       position: (12, 13),
      },
     ),
     KeyValue(
      AttributePath {
       attributes: [
        Raw {
         content: "options",
         position: (23, 3),
        },
       ],
      },
      Map {
       bindings: [
        KeyValue(
         AttributePath {
          attributes: [
           Raw {
            content: "services",
            position: (24, 5),
           },
           Raw {
            content: "calibre-server",
            position: (24, 14),
           },
          ],
         },
         Map {
          bindings: [
           KeyValue(
            AttributePath {
             attributes: [
              Raw {
               content: "enable",
               position: (26, 7),
              },
             ],
            },
            FunctionApplication {
             function: Variable {
              identifier: "mkEnableOption",
              position: (26, 16),
             },
             arguments: [
              String {
               parts: [
                Raw {
                 content: "calibre-server",
                 position: (26, 32),
                },
               ],
              },
             ],
            },
           ),
           KeyValue(
            AttributePath {
             attributes: [
              Raw {
               content: "libraries",
               position: (28, 7),
              },
             ],
            },
            FunctionApplication {
             function: Variable {
              identifier: "mkOption",
              position: (28, 19),
             },
             arguments: [
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "description",
                    position: (29, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "The directories of the libraries to serve. They must be readable for the user under which the server runs.\n",
                    position: (30, 1),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "type",
                    position: (32, 9),
                   },
                  ],
                 },
                 FunctionApplication {
                  function: PropertyAccess {
                   expression: Variable {
                    identifier: "types",
                    position: (32, 16),
                   },
                   attribute_path: AttributePath {
                    attributes: [
                     Raw {
                      content: "listOf",
                      position: (32, 22),
                     },
                    ],
                   },
                   default: None,
                  },
                  arguments: [
                   PropertyAccess {
                    expression: Variable {
                     identifier: "types",
                     position: (32, 29),
                    },
                    attribute_path: AttributePath {
                     attributes: [
                      Raw {
                       content: "path",
                       position: (32, 35),
                      },
                     ],
                    },
                    default: None,
                   },
                  ],
                 },
                ),
               ],
               recursive: false,
               position: (28, 28),
              },
             ],
            },
           ),
           KeyValue(
            AttributePath {
             attributes: [
              Raw {
               content: "user",
               position: (35, 7),
              },
             ],
            },
            FunctionApplication {
             function: Variable {
              identifier: "mkOption",
              position: (35, 14),
             },
             arguments: [
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "description",
                    position: (36, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "The user under which calibre-server runs.",
                    position: (36, 24),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "type",
                    position: (37, 9),
                   },
                  ],
                 },
                 PropertyAccess {
                  expression: Variable {
                   identifier: "types",
                   position: (37, 16),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "str",
                     position: (37, 22),
                    },
                   ],
                  },
                  default: None,
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "default",
                    position: (38, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "calibre-server",
                    position: (38, 20),
                   },
                  ],
                 },
                ),
               ],
               recursive: false,
               position: (35, 23),
              },
             ],
            },
           ),
           KeyValue(
            AttributePath {
             attributes: [
              Raw {
               content: "group",
               position: (41, 7),
              },
             ],
            },
            FunctionApplication {
             function: Variable {
              identifier: "mkOption",
              position: (41, 15),
             },
             arguments: [
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "description",
                    position: (42, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "The group under which calibre-server runs.",
                    position: (42, 24),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "type",
                    position: (43, 9),
                   },
                  ],
                 },
                 PropertyAccess {
                  expression: Variable {
                   identifier: "types",
                   position: (43, 16),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "str",
                     position: (43, 22),
                    },
                   ],
                  },
                  default: None,
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "default",
                    position: (44, 9),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "calibre-server",
                    position: (44, 20),
                   },
                  ],
                 },
                ),
               ],
               recursive: false,
               position: (41, 24),
              },
             ],
            },
           ),
          ],
          recursive: false,
          position: (24, 31),
         },
        ),
       ],
       recursive: false,
       position: (23, 13),
      },
     ),
     KeyValue(
      AttributePath {
       attributes: [
        Raw {
         content: "config",
         position: (53, 3),
        },
       ],
      },
      FunctionApplication {
       function: Variable {
        identifier: "mkIf",
        position: (53, 12),
       },
       arguments: [
        PropertyAccess {
         expression: Variable {
          identifier: "cfg",
          position: (53, 17),
         },
         attribute_path: AttributePath {
          attributes: [
           Raw {
            content: "enable",
            position: (53, 21),
           },
          ],
         },
         default: None,
        },
        Map {
         bindings: [
          KeyValue(
           AttributePath {
            attributes: [
             Raw {
              content: "systemd",
              position: (55, 5),
             },
             Raw {
              content: "services",
              position: (55, 13),
             },
             Raw {
              content: "calibre-server",
              position: (55, 22),
             },
            ],
           },
           Map {
            bindings: [
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "description",
                 position: (56, 9),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "Calibre Server",
                 position: (56, 24),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "after",
                 position: (57, 9),
                },
               ],
              },
              List {
               elements: [
                String {
                 parts: [
                  Raw {
                   content: "network.target",
                   position: (57, 20),
                  },
                 ],
                },
               ],
               position: (57, 17),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "wantedBy",
                 position: (58, 9),
                },
               ],
              },
              List {
               elements: [
                String {
                 parts: [
                  Raw {
                   content: "multi-user.target",
                   position: (58, 23),
                  },
                 ],
                },
               ],
               position: (58, 20),
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "serviceConfig",
                 position: (59, 9),
                },
               ],
              },
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "User",
                    position: (60, 11),
                   },
                  ],
                 },
                 PropertyAccess {
                  expression: Variable {
                   identifier: "cfg",
                   position: (60, 18),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "user",
                     position: (60, 22),
                    },
                   ],
                  },
                  default: None,
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "Restart",
                    position: (61, 11),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Raw {
                    content: "always",
                    position: (61, 22),
                   },
                  ],
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "ExecStart",
                    position: (62, 11),
                   },
                  ],
                 },
                 String {
                  parts: [
                   Expression {
                    expression: PropertyAccess {
                     expression: Variable {
                      identifier: "pkgs",
                      position: (62, 26),
                     },
                     attribute_path: AttributePath {
                      attributes: [
                       Raw {
                        content: "calibre",
                        position: (62, 31),
                       },
                      ],
                     },
                     default: None,
                    },
                   },
                   Raw {
                    content: "/bin/calibre-server ",
                    position: (62, 39),
                   },
                   Expression {
                    expression: FunctionApplication {
                     function: PropertyAccess {
                      expression: Variable {
                       identifier: "lib",
                       position: (62, 61),
                      },
                      attribute_path: AttributePath {
                       attributes: [
                        Raw {
                         content: "concatStringsSep",
                         position: (62, 65),
                        },
                       ],
                      },
                      default: None,
                     },
                     arguments: [
                      String {
                       parts: [
                        Raw {
                         content: " ",
                         position: (62, 83),
                        },
                       ],
                      },
                      PropertyAccess {
                       expression: Variable {
                        identifier: "cfg",
                        position: (62, 86),
                       },
                       attribute_path: AttributePath {
                        attributes: [
                         Raw {
                          content: "libraries",
                          position: (62, 90),
                         },
                        ],
                       },
                       default: None,
                      },
                     ],
                    },
                   },
                  ],
                 },
                ),
               ],
               recursive: false,
               position: (59, 25),
              },
             ),
            ],
            recursive: false,
            position: (55, 39),
           },
          ),
          KeyValue(
           AttributePath {
            attributes: [
             Raw {
              content: "environment",
              position: (67, 5),
             },
             Raw {
              content: "systemPackages",
              position: (67, 17),
             },
            ],
           },
           List {
            elements: [
             PropertyAccess {
              expression: Variable {
               identifier: "pkgs",
               position: (67, 36),
              },
              attribute_path: AttributePath {
               attributes: [
                Raw {
                 content: "calibre",
                 position: (67, 41),
                },
               ],
              },
              default: None,
             },
            ],
            position: (67, 34),
           },
          ),
          KeyValue(
           AttributePath {
            attributes: [
             Raw {
              content: "users",
              position: (69, 5),
             },
             Raw {
              content: "users",
              position: (69, 11),
             },
            ],
           },
           FunctionApplication {
            function: Variable {
             identifier: "optionalAttrs",
             position: (69, 19),
            },
            arguments: [
             BinaryOperation {
              operator: EqualTo,
              operands: [
               PropertyAccess {
                expression: Variable {
                 identifier: "cfg",
                 position: (69, 34),
                },
                attribute_path: AttributePath {
                 attributes: [
                  Raw {
                   content: "user",
                   position: (69, 38),
                  },
                 ],
                },
                default: None,
               },
               String {
                parts: [
                 Raw {
                  content: "calibre-server",
                  position: (69, 47),
                 },
                ],
               },
              ],
              position: (69, 43),
             },
             Map {
              bindings: [
               KeyValue(
                AttributePath {
                 attributes: [
                  Raw {
                   content: "calibre-server",
                   position: (70, 7),
                  },
                 ],
                },
                Map {
                 bindings: [
                  KeyValue(
                   AttributePath {
                    attributes: [
                     Raw {
                      content: "home",
                      position: (71, 9),
                     },
                    ],
                   },
                   String {
                    parts: [
                     Raw {
                      content: "/var/lib/calibre-server",
                      position: (71, 17),
                     },
                    ],
                   },
                  ),
                  KeyValue(
                   AttributePath {
                    attributes: [
                     Raw {
                      content: "createHome",
                      position: (72, 9),
                     },
                    ],
                   },
                   Variable {
                    identifier: "true",
                    position: (72, 22),
                   },
                  ),
                  KeyValue(
                   AttributePath {
                    attributes: [
                     Raw {
                      content: "uid",
                      position: (73, 9),
                     },
                    ],
                   },
                   PropertyAccess {
                    expression: Variable {
                     identifier: "config",
                     position: (73, 15),
                    },
                    attribute_path: AttributePath {
                     attributes: [
                      Raw {
                       content: "ids",
                       position: (73, 22),
                      },
                      Raw {
                       content: "uids",
                       position: (73, 26),
                      },
                      Raw {
                       content: "calibre-server",
                       position: (73, 31),
                      },
                     ],
                    },
                    default: None,
                   },
                  ),
                  KeyValue(
                   AttributePath {
                    attributes: [
                     Raw {
                      content: "group",
                      position: (74, 9),
                     },
                    ],
                   },
                   PropertyAccess {
                    expression: Variable {
                     identifier: "cfg",
                     position: (74, 17),
                    },
                    attribute_path: AttributePath {
                     attributes: [
                      Raw {
                       content: "group",
                       position: (74, 21),
                      },
                     ],
                    },
                    default: None,
                   },
                  ),
                 ],
                 recursive: false,
                 position: (70, 24),
                },
               ),
              ],
              recursive: false,
              position: (69, 64),
             },
            ],
           },
          ),
          KeyValue(
           AttributePath {
            attributes: [
             Raw {
              content: "users",
              position: (78, 5),
             },
             Raw {
              content: "groups",
              position: (78, 11),
             },
            ],
           },
           FunctionApplication {
            function: Variable {
             identifier: "optionalAttrs",
             position: (78, 20),
            },
            arguments: [
             BinaryOperation {
              operator: EqualTo,
              operands: [
               PropertyAccess {
                expression: Variable {
                 identifier: "cfg",
                 position: (78, 35),
                },
                attribute_path: AttributePath {
                 attributes: [
                  Raw {
                   content: "group",
                   position: (78, 39),
                  },
                 ],
                },
                default: None,
               },
               String {
                parts: [
                 Raw {
                  content: "calibre-server",
                  position: (78, 49),
                 },
                ],
               },
              ],
              position: (78, 45),
             },
             Map {
              bindings: [
               KeyValue(
                AttributePath {
                 attributes: [
                  Raw {
                   content: "calibre-server",
                   position: (79, 7),
                  },
                 ],
                },
                Map {
                 bindings: [
                  KeyValue(
                   AttributePath {
                    attributes: [
                     Raw {
                      content: "gid",
                      position: (80, 9),
                     },
                    ],
                   },
                   PropertyAccess {
                    expression: Variable {
                     identifier: "config",
                     position: (80, 15),
                    },
                    attribute_path: AttributePath {
                     attributes: [
                      Raw {
                       content: "ids",
                       position: (80, 22),
                      },
                      Raw {
                       content: "gids",
                       position: (80, 26),
                      },
                      Raw {
                       content: "calibre-server",
                       position: (80, 31),
                      },
                     ],
                    },
                    default: None,
                   },
                  ),
                 ],
                 recursive: false,
                 position: (79, 24),
                },
               ),
              ],
              recursive: false,
              position: (78, 66),
             },
            ],
           },
          ),
         ],
         recursive: false,
         position: (53, 28),
        },
       ],
      },
     ),
    ],
    recursive: false,
    position: (11, 1),
   },
   position: (5, 1),
  },
  position: (3, 1),
 },
 position: (1, 1),
}