---
Function {
 argument: None,
 arguments: FunctionArguments {
  arguments: [
   FunctionArgument {
    identifier: "additionalPaths",
    default: Some(
     List {
      elements: [],
      position: (80, 21),
     },
    ),
   },
   FunctionArgument {
    identifier: "copyChannel",
    default: Some(
     Variable {
      identifier: "true",
      position: (77, 17),
     },
    ),
   },
   FunctionArgument {
    identifier: "format",
    default: Some(
     String {
      parts: [
       Raw {
        content: "raw",
        position: (71, 13),
       },
      ],
     },
    ),
   },
   FunctionArgument {
    identifier: "name",
    default: Some(
     String {
      parts: [
       Raw {
        content: "nixos-disk-image",
        position: (68, 11),
       },
      ],
     },
    ),
   },
   FunctionArgument {
    identifier: "onlyNixStore",
    default: Some(
     Variable {
      identifier: "false",
      position: (66, 18),
     },
    ),
   },
   FunctionArgument {
    identifier: "postVM",
    default: Some(
     String {
      parts: [],
     },
    ),
   },
   FunctionArgument {
    identifier: "configFile",
    default: Some(
     Variable {
      identifier: "null",
      position: (58, 16),
     },
    ),
   },
   FunctionArgument {
    identifier: "label",
    default: Some(
     IfThenElse {
      predicate: Variable {
       identifier: "onlyNixStore",
       position: (54, 14),
      },
      then: String {
       parts: [
        Raw {
         content: "nix-store",
         position: (54, 33),
        },
       ],
      },
      else_: String {
       parts: [
        Raw {
         content: "nixos",
         position: (54, 50),
        },
       ],
      },
      position: (54, 11),
     },
    ),
   },
   FunctionArgument {
    identifier: "fsType",
    default: Some(
     String {
      parts: [
       Raw {
        content: "ext4",
        position: (51, 13),
       },
      ],
     },
    ),
   },
   FunctionArgument {
    identifier: "installBootLoader",
    default: Some(
     Variable {
      identifier: "true",
      position: (48, 23),
     },
    ),
   },
   FunctionArgument {
    identifier: "partitionTableType",
    default: Some(
     String {
      parts: [
       Raw {
        content: "legacy",
        position: (45, 25),
       },
      ],
     },
    ),
   },
   FunctionArgument {
    identifier: "contents",
    default: Some(
     List {
      elements: [],
      position: (30, 14),
     },
    ),
   },
   FunctionArgument {
    identifier: "bootSize",
    default: Some(
     String {
      parts: [
       Raw {
        content: "256M",
        position: (20, 15),
       },
      ],
     },
    ),
   },
   FunctionArgument {
    identifier: "additionalSpace",
    default: Some(
     String {
      parts: [
       Raw {
        content: "512M",
        position: (14, 22),
       },
      ],
     },
    ),
   },
   FunctionArgument {
    identifier: "diskSize",
    default: Some(
     String {
      parts: [
       Raw {
        content: "auto",
        position: (10, 15),
       },
      ],
     },
    ),
   },
   FunctionArgument {
    identifier: "config",
    default: None,
   },
   FunctionArgument {
    identifier: "lib",
    default: None,
   },
   FunctionArgument {
    identifier: "pkgs",
    default: None,
   },
  ],
  ellipsis: false,
 },
 definition: Assert {
  expression: BinaryOperation {
   operator: LogicalOr,
   operands: [
    BinaryOperation {
     operator: LogicalOr,
     operands: [
      BinaryOperation {
       operator: LogicalOr,
       operands: [
        BinaryOperation {
         operator: LogicalOr,
         operands: [
          BinaryOperation {
           operator: EqualTo,
           operands: [
            Variable {
             identifier: "partitionTableType",
             position: (83, 8),
            },
            String {
             parts: [
              Raw {
               content: "legacy",
               position: (83, 31),
              },
             ],
            },
           ],
           position: (83, 27),
          },
          BinaryOperation {
           operator: EqualTo,
           operands: [
            Variable {
             identifier: "partitionTableType",
             position: (83, 42),
            },
            String {
             parts: [
              Raw {
               content: "legacy+gpt",
               position: (83, 65),
              },
             ],
            },
           ],
           position: (83, 61),
          },
         ],
         position: (83, 39),
        },
        BinaryOperation {
         operator: EqualTo,
         operands: [
          Variable {
           identifier: "partitionTableType",
           position: (83, 80),
          },
          String {
           parts: [
            Raw {
             content: "efi",
             position: (83, 103),
            },
           ],
          },
         ],
         position: (83, 99),
        },
       ],
       position: (83, 77),
      },
      BinaryOperation {
       operator: EqualTo,
       operands: [
        Variable {
         identifier: "partitionTableType",
         position: (83, 111),
        },
        String {
         parts: [
          Raw {
           content: "hybrid",
           position: (83, 134),
          },
         ],
        },
       ],
       position: (83, 130),
      },
     ],
     position: (83, 108),
    },
    BinaryOperation {
     operator: EqualTo,
     operands: [
      Variable {
       identifier: "partitionTableType",
       position: (83, 145),
      },
      String {
       parts: [
        Raw {
         content: "none",
         position: (83, 168),
        },
       ],
      },
     ],
     position: (83, 164),
    },
   ],
   position: (83, 142),
  },
  target: Assert {
   expression: BinaryOperation {
    operator: Implication,
    operands: [
     BinaryOperation {
      operator: NotEqualTo,
      operands: [
       Variable {
        identifier: "partitionTableType",
        position: (85, 8),
       },
       String {
        parts: [
         Raw {
          content: "none",
          position: (85, 31),
         },
        ],
       },
      ],
      position: (85, 27),
     },
     BinaryOperation {
      operator: EqualTo,
      operands: [
       Variable {
        identifier: "fsType",
        position: (85, 40),
       },
       String {
        parts: [
         Raw {
          content: "ext4",
          position: (85, 51),
         },
        ],
       },
      ],
      position: (85, 47),
     },
    ],
    position: (85, 37),
   },
   target: Assert {
    expression: FunctionApplication {
     function: PropertyAccess {
      expression: Variable {
       identifier: "lib",
       position: (87, 8),
      },
      attribute_path: AttributePath {
       attributes: [
        Raw {
         content: "all",
         position: (87, 12),
        },
       ],
      },
      default: None,
     },
     arguments: [
      Function {
       argument: Some(
        "attrs",
       ),
       arguments: FunctionArguments {
        arguments: [],
        ellipsis: false,
       },
       definition: BinaryOperation {
        operator: EqualTo,
        operands: [
         BinaryOperation {
          operator: EqualTo,
          operands: [
           PropertyAccess {
            expression: Variable {
             identifier: "attrs",
             position: (88, 20),
            },
            attribute_path: AttributePath {
             attributes: [
              Raw {
               content: "user",
               position: (88, 26),
              },
             ],
            },
            default: Some(
             Variable {
              identifier: "null",
              position: (88, 35),
             },
            ),
           },
           Variable {
            identifier: "null",
            position: (88, 44),
           },
          ],
          position: (88, 41),
         },
         BinaryOperation {
          operator: EqualTo,
          operands: [
           PropertyAccess {
            expression: Variable {
             identifier: "attrs",
             position: (89, 20),
            },
            attribute_path: AttributePath {
             attributes: [
              Raw {
               content: "group",
               position: (89, 26),
              },
             ],
            },
            default: Some(
             Variable {
              identifier: "null",
              position: (89, 35),
             },
            ),
           },
           Variable {
            identifier: "null",
            position: (89, 44),
           },
          ],
          position: (89, 41),
         },
        ],
        position: (89, 15),
       },
       position: (88, 11),
      },
      Variable {
       identifier: "contents",
       position: (90, 10),
      },
     ],
    },
    target: Assert {
     expression: BinaryOperation {
      operator: Implication,
      operands: [
       Variable {
        identifier: "onlyNixStore",
        position: (91, 8),
       },
       BinaryOperation {
        operator: LogicalAnd,
        operands: [
         BinaryOperation {
          operator: LogicalAnd,
          operands: [
           BinaryOperation {
            operator: EqualTo,
            operands: [
             Variable {
              identifier: "contents",
              position: (91, 24),
             },
             List {
              elements: [],
              position: (91, 36),
             },
            ],
            position: (91, 33),
           },
           BinaryOperation {
            operator: EqualTo,
            operands: [
             Variable {
              identifier: "configFile",
              position: (91, 42),
             },
             Variable {
              identifier: "null",
              position: (91, 56),
             },
            ],
            position: (91, 53),
           },
          ],
          position: (91, 39),
         },
         UnaryOperation {
          operator: Not,
          operand: Variable {
           identifier: "installBootLoader",
           position: (91, 65),
          },
          position: (91, 64),
         },
        ],
        position: (91, 61),
       },
      ],
      position: (91, 21),
     },
     target: With {
      expression: Variable {
       identifier: "lib",
       position: (93, 6),
      },
      target: LetIn {
       bindings: [
        KeyValue(
         AttributePath {
          attributes: [
           Raw {
            content: "format'",
            position: (95, 5),
           },
          ],
         },
         Variable {
          identifier: "format",
          position: (95, 15),
         },
        ),
       ],
       target: LetIn {
        bindings: [
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "format",
             position: (97, 3),
            },
           ],
          },
          IfThenElse {
           predicate: BinaryOperation {
            operator: EqualTo,
            operands: [
             Variable {
              identifier: "format'",
              position: (97, 15),
             },
             String {
              parts: [
               Raw {
                content: "qcow2-compressed",
                position: (97, 27),
               },
              ],
             },
            ],
            position: (97, 23),
           },
           then: String {
            parts: [
             Raw {
              content: "qcow2",
              position: (97, 51),
             },
            ],
           },
           else_: Variable {
            identifier: "format'",
            position: (97, 63),
           },
           position: (97, 12),
          },
         ),
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "compress",
             position: (99, 3),
            },
           ],
          },
          FunctionApplication {
           function: Variable {
            identifier: "optionalString",
            position: (99, 14),
           },
           arguments: [
            BinaryOperation {
             operator: EqualTo,
             operands: [
              Variable {
               identifier: "format'",
               position: (99, 30),
              },
              String {
               parts: [
                Raw {
                 content: "qcow2-compressed",
                 position: (99, 42),
                },
               ],
              },
             ],
             position: (99, 38),
            },
            String {
             parts: [
              Raw {
               content: "-c",
               position: (99, 62),
              },
             ],
            },
           ],
          },
         ),
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "filename",
             position: (101, 3),
            },
           ],
          },
          BinaryOperation {
           operator: Addition,
           operands: [
            String {
             parts: [
              Raw {
               content: "nixos.",
               position: (101, 15),
              },
             ],
            },
            PropertyAccess {
             expression: Map {
              bindings: [
               KeyValue(
                AttributePath {
                 attributes: [
                  Raw {
                   content: "qcow2",
                   position: (102, 5),
                  },
                 ],
                },
                String {
                 parts: [
                  Raw {
                   content: "qcow2",
                   position: (102, 14),
                  },
                 ],
                },
               ),
               KeyValue(
                AttributePath {
                 attributes: [
                  Raw {
                   content: "vdi",
                   position: (103, 5),
                  },
                 ],
                },
                String {
                 parts: [
                  Raw {
                   content: "vdi",
                   position: (103, 14),
                  },
                 ],
                },
               ),
               KeyValue(
                AttributePath {
                 attributes: [
                  Raw {
                   content: "vpc",
                   position: (104, 5),
                  },
                 ],
                },
                String {
                 parts: [
                  Raw {
                   content: "vhd",
                   position: (104, 14),
                  },
                 ],
                },
               ),
               KeyValue(
                AttributePath {
                 attributes: [
                  Raw {
                   content: "raw",
                   position: (105, 5),
                  },
                 ],
                },
                String {
                 parts: [
                  Raw {
                   content: "img",
                   position: (105, 14),
                  },
                 ],
                },
               ),
              ],
              recursive: false,
              position: (101, 25),
             },
             attribute_path: AttributePath {
              attributes: [
               Expression {
                expression: Variable {
                 identifier: "format",
                 position: (106, 7),
                },
               },
              ],
             },
             default: Some(
              Variable {
               identifier: "format",
               position: (106, 18),
              },
             ),
            },
           ],
           position: (101, 23),
          },
         ),
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "rootPartition",
             position: (108, 3),
            },
           ],
          },
          PropertyAccess {
           expression: Map {
            bindings: [
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "legacy",
                 position: (109, 5),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "1",
                 position: (109, 15),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Expression {
                 expression: String {
                  parts: [
                   Raw {
                    content: "legacy+gpt",
                    position: (110, 6),
                   },
                  ],
                 },
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "2",
                 position: (110, 21),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "efi",
                 position: (111, 5),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "2",
                 position: (111, 12),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "hybrid",
                 position: (112, 5),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "3",
                 position: (112, 15),
                },
               ],
              },
             ),
            ],
            recursive: false,
            position: (108, 19),
           },
           attribute_path: AttributePath {
            attributes: [
             Expression {
              expression: Variable {
               identifier: "partitionTableType",
               position: (113, 7),
              },
             },
            ],
           },
           default: None,
          },
         ),
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "partitionDiskScript",
             position: (115, 3),
            },
           ],
          },
          PropertyAccess {
           expression: Map {
            bindings: [
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "legacy",
                 position: (116, 5),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "parted --script $diskImage -- \\\n  mklabel msdos \\\n  mkpart primary ext4 1MiB -1\n",
                 position: (117, 1),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Expression {
                 expression: String {
                  parts: [
                   Raw {
                    content: "legacy+gpt",
                    position: (121, 6),
                   },
                  ],
                 },
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "parted --script $diskImage -- \\\n  mklabel gpt \\\n  mkpart no-fs 1MB 2MB \\\n  set 1 bios_grub on \\\n  align-check optimal 1 \\\n  mkpart primary ext4 2MB -1 \\\n  align-check optimal 2 \\\n  print\n",
                 position: (122, 1),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "efi",
                 position: (131, 5),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "parted --script $diskImage -- \\\n  mklabel gpt \\\n  mkpart ESP fat32 8MiB ",
                 position: (132, 1),
                },
                Expression {
                 expression: Variable {
                  identifier: "bootSize",
                  position: (134, 33),
                 },
                },
                Raw {
                 content: " \\\n  set 1 boot on \\\n  mkpart primary ext4 ",
                 position: (134, 42),
                },
                Expression {
                 expression: Variable {
                  identifier: "bootSize",
                  position: (136, 31),
                 },
                },
                Raw {
                 content: " -1\n",
                 position: (136, 40),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "hybrid",
                 position: (138, 5),
                },
               ],
              },
              String {
               parts: [
                Raw {
                 content: "parted --script $diskImage -- \\\n  mklabel gpt \\\n  mkpart ESP fat32 8MiB ",
                 position: (139, 1),
                },
                Expression {
                 expression: Variable {
                  identifier: "bootSize",
                  position: (141, 33),
                 },
                },
                Raw {
                 content: " \\\n  set 1 boot on \\\n  mkpart no-fs 0 1024KiB \\\n  set 2 bios_grub on \\\n  mkpart primary ext4 ",
                 position: (141, 42),
                },
                Expression {
                 expression: Variable {
                  identifier: "bootSize",
                  position: (145, 31),
                 },
                },
                Raw {
                 content: " -1\n",
                 position: (145, 40),
                },
               ],
              },
             ),
             KeyValue(
              AttributePath {
               attributes: [
                Raw {
                 content: "none",
                 position: (147, 5),
                },
               ],
              },
              String {
               parts: [],
              },
             ),
            ],
            recursive: false,
            position: (115, 25),
           },
           attribute_path: AttributePath {
            attributes: [
             Expression {
              expression: Variable {
               identifier: "partitionTableType",
               position: (148, 7),
              },
             },
            ],
           },
           default: None,
          },
         ),
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "nixpkgs",
             position: (150, 3),
            },
           ],
          },
          FunctionApplication {
           function: Variable {
            identifier: "cleanSource",
            position: (150, 13),
           },
           arguments: [
            PropertyAccess {
             expression: Variable {
              identifier: "pkgs",
              position: (150, 25),
             },
             attribute_path: AttributePath {
              attributes: [
               Raw {
                content: "path",
                position: (150, 30),
               },
              ],
             },
             default: None,
            },
           ],
          },
         ),
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "channelSources",
             position: (153, 3),
            },
           ],
          },
          FunctionApplication {
           function: PropertyAccess {
            expression: Variable {
             identifier: "pkgs",
             position: (153, 20),
            },
            attribute_path: AttributePath {
             attributes: [
              Raw {
               content: "runCommand",
               position: (153, 25),
              },
             ],
            },
            default: None,
           },
           arguments: [
            String {
             parts: [
              Raw {
               content: "nixos-",
               position: (153, 37),
              },
              Expression {
               expression: PropertyAccess {
                expression: Variable {
                 identifier: "config",
                 position: (153, 45),
                },
                attribute_path: AttributePath {
                 attributes: [
                  Raw {
                   content: "system",
                   position: (153, 52),
                  },
                  Raw {
                   content: "nixos",
                   position: (153, 59),
                  },
                  Raw {
                   content: "version",
                   position: (153, 65),
                  },
                 ],
                },
                default: None,
               },
              },
             ],
            },
            Map {
             bindings: [],
             recursive: false,
             position: (153, 75),
            },
            String {
             parts: [
              Raw {
               content: "mkdir -p $out\ncp -prd ",
               position: (154, 1),
              },
              Expression {
               expression: PropertyAccess {
                expression: Variable {
                 identifier: "nixpkgs",
                 position: (155, 15),
                },
                attribute_path: AttributePath {
                 attributes: [
                  Raw {
                   content: "outPath",
                   position: (155, 23),
                  },
                 ],
                },
                default: None,
               },
              },
              Raw {
               content: " $out/nixos\nchmod -R u+w $out/nixos\nif [ ! -e $out/nixos/nixpkgs ]; then\n  ln -s . $out/nixos/nixpkgs\nfi\nrm -rf $out/nixos/.git\necho -n ",
               position: (155, 31),
              },
              Expression {
               expression: PropertyAccess {
                expression: Variable {
                 identifier: "config",
                 position: (161, 15),
                },
                attribute_path: AttributePath {
                 attributes: [
                  Raw {
                   content: "system",
                   position: (161, 22),
                  },
                  Raw {
                   content: "nixos",
                   position: (161, 29),
                  },
                  Raw {
                   content: "versionSuffix",
                   position: (161, 35),
                  },
                 ],
                },
                default: None,
               },
              },
              Raw {
               content: " > $out/nixos/.version-suffix\n",
               position: (161, 49),
              },
             ],
            },
           ],
          },
         ),
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "binPath",
             position: (164, 3),
            },
           ],
          },
          With {
           expression: Variable {
            identifier: "pkgs",
            position: (164, 18),
           },
           target: FunctionApplication {
            function: Variable {
             identifier: "makeBinPath",
             position: (164, 24),
            },
            arguments: [
             BinaryOperation {
              operator: Concatenation,
              operands: [
               List {
                elements: [
                 Variable {
                  identifier: "rsync",
                  position: (165, 7),
                 },
                 Variable {
                  identifier: "util-linux",
                  position: (166, 7),
                 },
                 Variable {
                  identifier: "parted",
                  position: (167, 7),
                 },
                 Variable {
                  identifier: "e2fsprogs",
                  position: (168, 7),
                 },
                 Variable {
                  identifier: "lkl",
                  position: (169, 7),
                 },
                 PropertyAccess {
                  expression: Variable {
                   identifier: "config",
                   position: (170, 7),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "system",
                     position: (170, 14),
                    },
                    Raw {
                     content: "build",
                     position: (170, 21),
                    },
                    Raw {
                     content: "nixos-install",
                     position: (170, 27),
                    },
                   ],
                  },
                  default: None,
                 },
                 PropertyAccess {
                  expression: Variable {
                   identifier: "config",
                   position: (171, 7),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "system",
                     position: (171, 14),
                    },
                    Raw {
                     content: "build",
                     position: (171, 21),
                    },
                    Raw {
                     content: "nixos-enter",
                     position: (171, 27),
                    },
                   ],
                  },
                  default: None,
                 },
                 Variable {
                  identifier: "nix",
                  position: (172, 7),
                 },
                ],
                position: (165, 5),
               },
               PropertyAccess {
                expression: Variable {
                 identifier: "stdenv",
                 position: (173, 10),
                },
                attribute_path: AttributePath {
                 attributes: [
                  Raw {
                   content: "initialPath",
                   position: (173, 17),
                  },
                 ],
                },
                default: None,
               },
              ],
              position: (173, 7),
             },
            ],
           },
           position: (164, 13),
          },
         ),
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "sources",
             position: (178, 3),
            },
           ],
          },
          FunctionApplication {
           function: Variable {
            identifier: "map",
            position: (178, 13),
           },
           arguments: [
            Function {
             argument: Some(
              "x",
             ),
             arguments: FunctionArguments {
              arguments: [],
              ellipsis: false,
             },
             definition: PropertyAccess {
              expression: Variable {
               identifier: "x",
               position: (178, 21),
              },
              attribute_path: AttributePath {
               attributes: [
                Raw {
                 content: "source",
                 position: (178, 23),
                },
               ],
              },
              default: None,
             },
             position: (178, 18),
            },
            Variable {
             identifier: "contents",
             position: (178, 31),
            },
           ],
          },
         ),
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "targets",
             position: (179, 3),
            },
           ],
          },
          FunctionApplication {
           function: Variable {
            identifier: "map",
            position: (179, 13),
           },
           arguments: [
            Function {
             argument: Some(
              "x",
             ),
             arguments: FunctionArguments {
              arguments: [],
              ellipsis: false,
             },
             definition: PropertyAccess {
              expression: Variable {
               identifier: "x",
               position: (179, 21),
              },
              attribute_path: AttributePath {
               attributes: [
                Raw {
                 content: "target",
                 position: (179, 23),
                },
               ],
              },
              default: None,
             },
             position: (179, 18),
            },
            Variable {
             identifier: "contents",
             position: (179, 31),
            },
           ],
          },
         ),
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "modes",
             position: (180, 3),
            },
           ],
          },
          FunctionApplication {
           function: Variable {
            identifier: "map",
            position: (180, 13),
           },
           arguments: [
            Function {
             argument: Some(
              "x",
             ),
             arguments: FunctionArguments {
              arguments: [],
              ellipsis: false,
             },
             definition: PropertyAccess {
              expression: Variable {
               identifier: "x",
               position: (180, 21),
              },
              attribute_path: AttributePath {
               attributes: [
                Raw {
                 content: "mode",
                 position: (180, 23),
                },
               ],
              },
              default: Some(
               String {
                parts: [
                 Raw {
                  content: "''",
                  position: (180, 33),
                 },
                ],
               },
              ),
             },
             position: (180, 18),
            },
            Variable {
             identifier: "contents",
             position: (180, 38),
            },
           ],
          },
         ),
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "users",
             position: (181, 3),
            },
           ],
          },
          FunctionApplication {
           function: Variable {
            identifier: "map",
            position: (181, 13),
           },
           arguments: [
            Function {
             argument: Some(
              "x",
             ),
             arguments: FunctionArguments {
              arguments: [],
              ellipsis: false,
             },
             definition: PropertyAccess {
              expression: Variable {
               identifier: "x",
               position: (181, 21),
              },
              attribute_path: AttributePath {
               attributes: [
                Raw {
                 content: "user",
                 position: (181, 23),
                },
               ],
              },
              default: Some(
               String {
                parts: [
                 Raw {
                  content: "''",
                  position: (181, 33),
                 },
                ],
               },
              ),
             },
             position: (181, 18),
            },
            Variable {
             identifier: "contents",
             position: (181, 38),
            },
           ],
          },
         ),
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "groups",
             position: (182, 3),
            },
           ],
          },
          FunctionApplication {
           function: Variable {
            identifier: "map",
            position: (182, 13),
           },
           arguments: [
            Function {
             argument: Some(
              "x",
             ),
             arguments: FunctionArguments {
              arguments: [],
              ellipsis: false,
             },
             definition: PropertyAccess {
              expression: Variable {
               identifier: "x",
               position: (182, 21),
              },
              attribute_path: AttributePath {
               attributes: [
                Raw {
                 content: "group",
                 position: (182, 23),
                },
               ],
              },
              default: Some(
               String {
                parts: [
                 Raw {
                  content: "''",
                  position: (182, 33),
                 },
                ],
               },
              ),
             },
             position: (182, 18),
            },
            Variable {
             identifier: "contents",
             position: (182, 38),
            },
           ],
          },
         ),
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "basePaths",
             position: (184, 3),
            },
           ],
          },
          BinaryOperation {
           operator: Concatenation,
           operands: [
            List {
             elements: [
              PropertyAccess {
               expression: Variable {
                identifier: "config",
                position: (184, 17),
               },
               attribute_path: AttributePath {
                attributes: [
                 Raw {
                  content: "system",
                  position: (184, 24),
                 },
                 Raw {
                  content: "build",
                  position: (184, 31),
                 },
                 Raw {
                  content: "toplevel",
                  position: (184, 37),
                 },
                ],
               },
               default: None,
              },
             ],
             position: (184, 15),
            },
            FunctionApplication {
             function: PropertyAccess {
              expression: Variable {
               identifier: "lib",
               position: (185, 8),
              },
              attribute_path: AttributePath {
               attributes: [
                Raw {
                 content: "optional",
                 position: (185, 12),
                },
               ],
              },
              default: None,
             },
             arguments: [
              Variable {
               identifier: "copyChannel",
               position: (185, 21),
              },
              Variable {
               identifier: "channelSources",
               position: (185, 33),
              },
             ],
            },
           ],
           position: (185, 5),
          },
         ),
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "additionalPaths'",
             position: (187, 3),
            },
           ],
          },
          FunctionApplication {
           function: Variable {
            identifier: "subtractLists",
            position: (187, 22),
           },
           arguments: [
            Variable {
             identifier: "basePaths",
             position: (187, 36),
            },
            Variable {
             identifier: "additionalPaths",
             position: (187, 46),
            },
           ],
          },
         ),
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "closureInfo",
             position: (189, 3),
            },
           ],
          },
          FunctionApplication {
           function: PropertyAccess {
            expression: Variable {
             identifier: "pkgs",
             position: (189, 17),
            },
            attribute_path: AttributePath {
             attributes: [
              Raw {
               content: "closureInfo",
               position: (189, 22),
              },
             ],
            },
            default: None,
           },
           arguments: [
            Map {
             bindings: [
              KeyValue(
               AttributePath {
                attributes: [
                 Raw {
                  content: "rootPaths",
                  position: (190, 5),
                 },
                ],
               },
               BinaryOperation {
                operator: Concatenation,
                operands: [
                 Variable {
                  identifier: "basePaths",
                  position: (190, 17),
                 },
                 Variable {
                  identifier: "additionalPaths'",
                  position: (190, 30),
                 },
                ],
                position: (190, 27),
               },
              ),
             ],
             recursive: false,
             position: (189, 34),
            },
           ],
          },
         ),
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "blockSize",
             position: (193, 3),
            },
           ],
          },
          FunctionApplication {
           function: Variable {
            identifier: "toString",
            position: (193, 15),
           },
           arguments: [
            BinaryOperation {
             operator: Multiplication,
             operands: [
              Int {
               value: 4,
               position: (193, 25),
              },
              Int {
               value: 1024,
               position: (193, 29),
              },
             ],
             position: (193, 27),
            },
           ],
          },
         ),
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "prepareImage",
             position: (195, 3),
            },
           ],
          },
          String {
           parts: [
            Raw {
             content: "export PATH=",
             position: (196, 1),
            },
            Expression {
             expression: Variable {
              identifier: "binPath",
              position: (196, 19),
             },
            },
            Raw {
             content: "\n\n# Yes, mkfs.ext4 takes different units in different contexts. Fun.\nsectorsToKilobytes() {\n  echo $(( ( \"$1\" * 512 ) / 1024 ))\n}\n\nsectorsToBytes() {\n  echo $(( \"$1\" * 512  ))\n}\n\n# Given lines of numbers, adds them together\nsum_lines() {\n  local acc=0\n  while read -r number; do\n    acc=$((acc+number))\n  done\n  echo \"$acc\"\n}\n\nmebibyte=$(( 1024 * 1024 ))\n\n# Approximative percentage of reserved space in an ext4 fs over 512MiB.\n# 0.05208587646484375\n#  × 1000, integer part: 52\ncompute_fudge() {\n  echo $(( $1 * 52 / 1000 ))\n}\n\nmkdir $out\n\nroot=\"$PWD/root\"\nmkdir -p $root\n\n# Copy arbitrary other files into the image\n# Semi-shamelessly copied from make-etc.sh. I (@copumpkin) shall factor this stuff out as part of\n# https://github.com/NixOS/nixpkgs/issues/23052.\nset -f\nsources_=(",
             position: (196, 27),
            },
            Expression {
             expression: FunctionApplication {
              function: Variable {
               identifier: "concatStringsSep",
               position: (234, 17),
              },
              arguments: [
               String {
                parts: [
                 Raw {
                  content: " ",
                  position: (234, 35),
                 },
                ],
               },
               Variable {
                identifier: "sources",
                position: (234, 38),
               },
              ],
             },
            },
            Raw {
             content: ")\ntargets_=(",
             position: (234, 46),
            },
            Expression {
             expression: FunctionApplication {
              function: Variable {
               identifier: "concatStringsSep",
               position: (235, 17),
              },
              arguments: [
               String {
                parts: [
                 Raw {
                  content: " ",
                  position: (235, 35),
                 },
                ],
               },
               Variable {
                identifier: "targets",
                position: (235, 38),
               },
              ],
             },
            },
            Raw {
             content: ")\nmodes_=(",
             position: (235, 46),
            },
            Expression {
             expression: FunctionApplication {
              function: Variable {
               identifier: "concatStringsSep",
               position: (236, 15),
              },
              arguments: [
               String {
                parts: [
                 Raw {
                  content: " ",
                  position: (236, 33),
                 },
                ],
               },
               Variable {
                identifier: "modes",
                position: (236, 36),
               },
              ],
             },
            },
            Raw {
             content: ")\nset +f\n\nfor ((i = 0; i < ",
             position: (236, 42),
            },
            Raw {
             content: "$",
             position: (239, 22),
            },
            Raw {
             content: "{#targets_[@]}; i++)); do\n  source=\"",
             position: (239, 25),
            },
            Raw {
             content: "$",
             position: (240, 15),
            },
            Raw {
             content: "{sources_[$i]}\"\n  target=\"",
             position: (240, 18),
            },
            Raw {
             content: "$",
             position: (241, 15),
            },
            Raw {
             content: "{targets_[$i]}\"\n  mode=\"",
             position: (241, 18),
            },
            Raw {
             content: "$",
             position: (242, 13),
            },
            Raw {
             content: "{modes_[$i]}\"\n\n  if [ -n \"$mode\" ]; then\n    rsync_chmod_flags=\"--chmod=$mode\"\n  else\n    rsync_chmod_flags=\"\"\n  fi\n  # Unfortunately cptofs only supports modes, not ownership, so we can't use\n  # rsync's --chown option. Instead, we change the ownerships in the\n  # VM script with chown.\n  rsync_flags=\"-a --no-o --no-g $rsync_chmod_flags\"\n  if [[ \"$source\" =~ '*' ]]; then\n    # If the source name contains '*', perform globbing.\n    mkdir -p $root/$target\n    for fn in $source; do\n      rsync $rsync_flags \"$fn\" $root/$target/\n    done\n  else\n    mkdir -p $root/$(dirname $target)\n    if ! [ -e $root/$target ]; then\n      rsync $rsync_flags $source $root/$target\n    else\n      echo \"duplicate entry $target -> $source\"\n      exit 1\n    fi\n  fi\ndone\n\nexport HOME=$TMPDIR\n\n# Provide a Nix database so that nixos-install can copy closures.\nexport NIX_STATE_DIR=$TMPDIR/state\nnix-store --load-db < ",
             position: (242, 16),
            },
            Expression {
             expression: Variable {
              identifier: "closureInfo",
              position: (274, 29),
             },
            },
            Raw {
             content: "/registration\n\nchmod 755 \"$TMPDIR\"\necho \"running nixos-install...\"\nnixos-install --root $root --no-bootloader --no-root-passwd \\\n  --system ",
             position: (274, 41),
            },
            Expression {
             expression: PropertyAccess {
              expression: Variable {
               identifier: "config",
               position: (279, 18),
              },
              attribute_path: AttributePath {
               attributes: [
                Raw {
                 content: "system",
                 position: (279, 25),
                },
                Raw {
                 content: "build",
                 position: (279, 32),
                },
                Raw {
                 content: "toplevel",
                 position: (279, 38),
                },
               ],
              },
              default: None,
             },
            },
            Raw {
             content: " \\\n  ",
             position: (279, 47),
            },
            Expression {
             expression: IfThenElse {
              predicate: Variable {
               identifier: "copyChannel",
               position: (280, 12),
              },
              then: String {
               parts: [
                Raw {
                 content: "--channel ",
                 position: (280, 30),
                },
                Expression {
                 expression: Variable {
                  identifier: "channelSources",
                  position: (280, 42),
                 },
                },
               ],
              },
              else_: String {
               parts: [
                Raw {
                 content: "--no-channel-copy",
                 position: (280, 65),
                },
               ],
              },
              position: (280, 9),
             },
            },
            Raw {
             content: " \\\n  --substituters \"\"\n\n",
             position: (280, 84),
            },
            Expression {
             expression: FunctionApplication {
              function: Variable {
               identifier: "optionalString",
               position: (283, 7),
              },
              arguments: [
               BinaryOperation {
                operator: NotEqualTo,
                operands: [
                 Variable {
                  identifier: "additionalPaths'",
                  position: (283, 23),
                 },
                 List {
                  elements: [],
                  position: (283, 43),
                 },
                ],
                position: (283, 40),
               },
               String {
                parts: [
                 Raw {
                  content: "nix --extra-experimental-features nix-command copy --to $root --no-check-sigs ",
                  position: (284, 1),
                 },
                 Expression {
                  expression: FunctionApplication {
                   function: Variable {
                    identifier: "concatStringsSep",
                    position: (284, 87),
                   },
                   arguments: [
                    String {
                     parts: [
                      Raw {
                       content: " ",
                       position: (284, 105),
                      },
                     ],
                    },
                    Variable {
                     identifier: "additionalPaths'",
                     position: (284, 108),
                    },
                   ],
                  },
                 },
                 Raw {
                  content: "\n",
                  position: (284, 125),
                 },
                ],
               },
              ],
             },
            },
            Raw {
             content: "\n\ndiskImage=nixos.raw\n\n",
             position: (285, 8),
            },
            Expression {
             expression: IfThenElse {
              predicate: BinaryOperation {
               operator: EqualTo,
               operands: [
                Variable {
                 identifier: "diskSize",
                 position: (289, 10),
                },
                String {
                 parts: [
                  Raw {
                   content: "auto",
                   position: (289, 23),
                  },
                 ],
                },
               ],
               position: (289, 19),
              },
              then: String {
               parts: [
                Raw {
                 content: "",
                 position: (290, 1),
                },
                Expression {
                 expression: IfThenElse {
                  predicate: BinaryOperation {
                   operator: LogicalOr,
                   operands: [
                    BinaryOperation {
                     operator: EqualTo,
                     operands: [
                      Variable {
                       identifier: "partitionTableType",
                       position: (290, 12),
                      },
                      String {
                       parts: [
                        Raw {
                         content: "efi",
                         position: (290, 35),
                        },
                       ],
                      },
                     ],
                     position: (290, 31),
                    },
                    BinaryOperation {
                     operator: EqualTo,
                     operands: [
                      Variable {
                       identifier: "partitionTableType",
                       position: (290, 43),
                      },
                      String {
                       parts: [
                        Raw {
                         content: "hybrid",
                         position: (290, 66),
                        },
                       ],
                      },
                     ],
                     position: (290, 62),
                    },
                   ],
                   position: (290, 40),
                  },
                  then: String {
                   parts: [
                    Raw {
                     content: "# Add the GPT at the end\ngptSpace=$(( 512 * 34 * 1 ))\n# Normally we'd need to account for alignment and things, if bootSize\n# represented the actual size of the boot partition. But it instead\n# represents the offset at which it ends.\n# So we know bootSize is the reserved space in front of the partition.\nreservedSpace=$(( gptSpace + $(numfmt --from=iec ",
                     position: (291, 1),
                    },
                    Raw {
                     content: "'",
                     position: (297, 58),
                    },
                    Expression {
                     expression: Variable {
                      identifier: "bootSize",
                      position: (297, 61),
                     },
                    },
                    Raw {
                     content: "') ))\n",
                     position: (297, 70),
                    },
                   ],
                  },
                  else_: IfThenElse {
                   predicate: BinaryOperation {
                    operator: EqualTo,
                    operands: [
                     Variable {
                      identifier: "partitionTableType",
                      position: (298, 18),
                     },
                     String {
                      parts: [
                       Raw {
                        content: "legacy+gpt",
                        position: (298, 41),
                       },
                      ],
                     },
                    ],
                    position: (298, 37),
                   },
                   then: String {
                    parts: [
                     Raw {
                      content: "# Add the GPT at the end\ngptSpace=$(( 512 * 34 * 1 ))\n# And include the bios_grub partition; the ext4 partition starts at 2MB exactly.\nreservedSpace=$(( gptSpace + 2 * mebibyte ))\n",
                      position: (299, 1),
                     },
                    ],
                   },
                   else_: IfThenElse {
                    predicate: BinaryOperation {
                     operator: EqualTo,
                     operands: [
                      Variable {
                       identifier: "partitionTableType",
                       position: (303, 18),
                      },
                      String {
                       parts: [
                        Raw {
                         content: "legacy",
                         position: (303, 41),
                        },
                       ],
                      },
                     ],
                     position: (303, 37),
                    },
                    then: String {
                     parts: [
                      Raw {
                       content: "# Add the 1MiB aligned reserved space (includes MBR)\nreservedSpace=$(( mebibyte ))\n",
                       position: (304, 1),
                      },
                     ],
                    },
                    else_: String {
                     parts: [
                      Raw {
                       content: "reservedSpace=0\n",
                       position: (307, 1),
                      },
                     ],
                    },
                    position: (303, 15),
                   },
                   position: (298, 15),
                  },
                  position: (290, 9),
                 },
                },
                Raw {
                 content: "\nadditionalSpace=$(( $(numfmt --from=iec ",
                 position: (308, 10),
                },
                Raw {
                 content: "'",
                 position: (309, 47),
                },
                Expression {
                 expression: Variable {
                  identifier: "additionalSpace",
                  position: (309, 50),
                 },
                },
                Raw {
                 content: "') + reservedSpace ))\n\n# Compute required space in filesystem blocks\ndiskUsage=$(find . ! -type d -print0 | du --files0-from=- --apparent-size --block-size \"",
                 position: (309, 66),
                },
                Expression {
                 expression: Variable {
                  identifier: "blockSize",
                  position: (312, 97),
                 },
                },
                Raw {
                 content: "\" | cut -f1 | sum_lines)\n# Each inode takes space!\nnumInodes=$(find . | wc -l)\n# Convert to bytes, inodes take two blocks each!\ndiskUsage=$(( (diskUsage + 2 * numInodes) * ",
                 position: (312, 107),
                },
                Expression {
                 expression: Variable {
                  identifier: "blockSize",
                  position: (316, 53),
                 },
                },
                Raw {
                 content: " ))\n# Then increase the required space to account for the reserved blocks.\nfudge=$(compute_fudge $diskUsage)\nrequiredFilesystemSpace=$(( diskUsage + fudge ))\n\ndiskSize=$(( requiredFilesystemSpace  + additionalSpace ))\n\n# Round up to the nearest mebibyte.\n# This ensures whole 512 bytes sector sizes in the disk image\n# and helps towards aligning partitions optimally.\nif (( diskSize % mebibyte )); then\n  diskSize=$(( ( diskSize / mebibyte + 1) * mebibyte ))\nfi\n\ntruncate -s \"$diskSize\" $diskImage\n\nprintf \"Automatic disk size...\\n\"\nprintf \"  Closure space use: %d bytes\\n\" $diskUsage\nprintf \"  fudge: %d bytes\\n\" $fudge\nprintf \"  Filesystem size needed: %d bytes\\n\" $requiredFilesystemSpace\nprintf \"  Additional space: %d bytes\\n\" $additionalSpace\nprintf \"  Disk image size: %d bytes\\n\" $diskSize\n",
                 position: (316, 63),
                },
               ],
              },
              else_: String {
               parts: [
                Raw {
                 content: "truncate -s ",
                 position: (339, 1),
                },
                Expression {
                 expression: FunctionApplication {
                  function: Variable {
                   identifier: "toString",
                   position: (339, 21),
                  },
                  arguments: [
                   Variable {
                    identifier: "diskSize",
                    position: (339, 30),
                   },
                  ],
                 },
                },
                Raw {
                 content: "M $diskImage\n",
                 position: (339, 39),
                },
               ],
              },
              position: (289, 7),
             },
            },
            Raw {
             content: "\n\n",
             position: (340, 8),
            },
            Expression {
             expression: Variable {
              identifier: "partitionDiskScript",
              position: (342, 7),
             },
            },
            Raw {
             content: "\n\n",
             position: (342, 27),
            },
            Expression {
             expression: IfThenElse {
              predicate: BinaryOperation {
               operator: NotEqualTo,
               operands: [
                Variable {
                 identifier: "partitionTableType",
                 position: (344, 10),
                },
                String {
                 parts: [
                  Raw {
                   content: "none",
                   position: (344, 33),
                  },
                 ],
                },
               ],
               position: (344, 29),
              },
              then: String {
               parts: [
                Raw {
                 content: "# Get start & length of the root partition in sectors to $START and $SECTORS.\neval $(partx $diskImage -o START,SECTORS --nr ",
                 position: (345, 1),
                },
                Expression {
                 expression: Variable {
                  identifier: "rootPartition",
                  position: (346, 55),
                 },
                },
                Raw {
                 content: " --pairs)\n\nmkfs.",
                 position: (346, 69),
                },
                Expression {
                 expression: Variable {
                  identifier: "fsType",
                  position: (348, 14),
                 },
                },
                Raw {
                 content: " -b ",
                 position: (348, 21),
                },
                Expression {
                 expression: Variable {
                  identifier: "blockSize",
                  position: (348, 27),
                 },
                },
                Raw {
                 content: " -F -L ",
                 position: (348, 37),
                },
                Expression {
                 expression: Variable {
                  identifier: "label",
                  position: (348, 46),
                 },
                },
                Raw {
                 content: " $diskImage -E offset=$(sectorsToBytes $START) $(sectorsToKilobytes $SECTORS)K\n",
                 position: (348, 52),
                },
               ],
              },
              else_: String {
               parts: [
                Raw {
                 content: "mkfs.",
                 position: (350, 1),
                },
                Expression {
                 expression: Variable {
                  identifier: "fsType",
                  position: (350, 14),
                 },
                },
                Raw {
                 content: " -b ",
                 position: (350, 21),
                },
                Expression {
                 expression: Variable {
                  identifier: "blockSize",
                  position: (350, 27),
                 },
                },
                Raw {
                 content: " -F -L ",
                 position: (350, 37),
                },
                Expression {
                 expression: Variable {
                  identifier: "label",
                  position: (350, 46),
                 },
                },
                Raw {
                 content: " $diskImage\n",
                 position: (350, 52),
                },
               ],
              },
              position: (344, 7),
             },
            },
            Raw {
             content: "\n\necho \"copying staging root to image...\"\ncptofs -p ",
             position: (351, 8),
            },
            Expression {
             expression: FunctionApplication {
              function: Variable {
               identifier: "optionalString",
               position: (354, 17),
              },
              arguments: [
               BinaryOperation {
                operator: NotEqualTo,
                operands: [
                 Variable {
                  identifier: "partitionTableType",
                  position: (354, 33),
                 },
                 String {
                  parts: [
                   Raw {
                    content: "none",
                    position: (354, 56),
                   },
                  ],
                 },
                ],
                position: (354, 52),
               },
               String {
                parts: [
                 Raw {
                  content: "-P ",
                  position: (354, 64),
                 },
                 Expression {
                  expression: Variable {
                   identifier: "rootPartition",
                   position: (354, 69),
                  },
                 },
                ],
               },
              ],
             },
            },
            Raw {
             content: " \\\n       -t ",
             position: (354, 85),
            },
            Expression {
             expression: Variable {
              identifier: "fsType",
              position: (355, 17),
             },
            },
            Raw {
             content: " \\\n       -i $diskImage \\\n       $root",
             position: (355, 24),
            },
            Expression {
             expression: FunctionApplication {
              function: Variable {
               identifier: "optionalString",
               position: (357, 19),
              },
              arguments: [
               Variable {
                identifier: "onlyNixStore",
                position: (357, 34),
               },
               PropertyAccess {
                expression: Variable {
                 identifier: "builtins",
                 position: (357, 47),
                },
                attribute_path: AttributePath {
                 attributes: [
                  Raw {
                   content: "storeDir",
                   position: (357, 56),
                  },
                 ],
                },
                default: None,
               },
              ],
             },
            },
            Raw {
             content: "/* / ||\n  (echo >&2 \"ERROR: cptofs failed. diskSize might be too small for closure.\"; exit 1)\n",
             position: (357, 65),
            },
           ],
          },
         ),
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "moveOrConvertImage",
             position: (361, 3),
            },
           ],
          },
          String {
           parts: [
            Raw {
             content: "",
             position: (362, 1),
            },
            Expression {
             expression: IfThenElse {
              predicate: BinaryOperation {
               operator: EqualTo,
               operands: [
                Variable {
                 identifier: "format",
                 position: (362, 10),
                },
                String {
                 parts: [
                  Raw {
                   content: "raw",
                   position: (362, 21),
                  },
                 ],
                },
               ],
               position: (362, 17),
              },
              then: String {
               parts: [
                Raw {
                 content: "mv $diskImage $out/",
                 position: (363, 1),
                },
                Expression {
                 expression: Variable {
                  identifier: "filename",
                  position: (363, 28),
                 },
                },
                Raw {
                 content: "\n",
                 position: (363, 37),
                },
               ],
              },
              else_: String {
               parts: [
                Raw {
                 content: "",
                 position: (365, 1),
                },
                Expression {
                 expression: PropertyAccess {
                  expression: Variable {
                   identifier: "pkgs",
                   position: (365, 9),
                  },
                  attribute_path: AttributePath {
                   attributes: [
                    Raw {
                     content: "qemu",
                     position: (365, 14),
                    },
                   ],
                  },
                  default: None,
                 },
                },
                Raw {
                 content: "/bin/qemu-img convert -f raw -O ",
                 position: (365, 19),
                },
                Expression {
                 expression: Variable {
                  identifier: "format",
                  position: (365, 53),
                 },
                },
                Raw {
                 content: " ",
                 position: (365, 60),
                },
                Expression {
                 expression: Variable {
                  identifier: "compress",
                  position: (365, 63),
                 },
                },
                Raw {
                 content: " $diskImage $out/",
                 position: (365, 72),
                },
                Expression {
                 expression: Variable {
                  identifier: "filename",
                  position: (365, 91),
                 },
                },
                Raw {
                 content: "\n",
                 position: (365, 100),
                },
               ],
              },
              position: (362, 7),
             },
            },
            Raw {
             content: "\ndiskImage=$out/",
             position: (366, 8),
            },
            Expression {
             expression: Variable {
              identifier: "filename",
              position: (367, 22),
             },
            },
            Raw {
             content: "\n",
             position: (367, 31),
            },
           ],
          },
         ),
         KeyValue(
          AttributePath {
           attributes: [
            Raw {
             content: "buildImage",
             position: (370, 3),
            },
           ],
          },
          FunctionApplication {
           function: PropertyAccess {
            expression: Variable {
             identifier: "pkgs",
             position: (370, 16),
            },
            attribute_path: AttributePath {
             attributes: [
              Raw {
               content: "vmTools",
               position: (370, 21),
              },
              Raw {
               content: "runInLinuxVM",
               position: (370, 29),
              },
             ],
            },
            default: None,
           },
           arguments: [
            FunctionApplication {
             function: PropertyAccess {
              expression: Variable {
               identifier: "pkgs",
               position: (371, 5),
              },
              attribute_path: AttributePath {
               attributes: [
                Raw {
                 content: "runCommand",
                 position: (371, 10),
                },
               ],
              },
              default: None,
             },
             arguments: [
              Variable {
               identifier: "name",
               position: (371, 21),
              },
              Map {
               bindings: [
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "preVM",
                    position: (372, 7),
                   },
                  ],
                 },
                 Variable {
                  identifier: "prepareImage",
                  position: (372, 15),
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "buildInputs",
                    position: (373, 7),
                   },
                  ],
                 },
                 With {
                  expression: Variable {
                   identifier: "pkgs",
                   position: (373, 26),
                  },
                  target: List {
                   elements: [
                    Variable {
                     identifier: "util-linux",
                     position: (373, 34),
                    },
                    Variable {
                     identifier: "e2fsprogs",
                     position: (373, 45),
                    },
                    Variable {
                     identifier: "dosfstools",
                     position: (373, 55),
                    },
                   ],
                   position: (373, 32),
                  },
                  position: (373, 21),
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "postVM",
                    position: (374, 7),
                   },
                  ],
                 },
                 BinaryOperation {
                  operator: Addition,
                  operands: [
                   Variable {
                    identifier: "moveOrConvertImage",
                    position: (374, 16),
                   },
                   Variable {
                    identifier: "postVM",
                    position: (374, 37),
                   },
                  ],
                  position: (374, 35),
                 },
                ),
                KeyValue(
                 AttributePath {
                  attributes: [
                   Raw {
                    content: "memSize",
                    position: (375, 7),
                   },
                  ],
                 },
                 Int {
                  value: 1024,
                  position: (375, 17),
                 },
                ),
               ],
               recursive: false,
               position: (371, 26),
              },
              String {
               parts: [
                Raw {
                 content: "export PATH=",
                 position: (377, 1),
                },
                Expression {
                 expression: Variable {
                  identifier: "binPath",
                  position: (377, 21),
                 },
                },
                Raw {
                 content: ":$PATH\n\nrootDisk=",
                 position: (377, 29),
                },
                Expression {
                 expression: IfThenElse {
                  predicate: BinaryOperation {
                   operator: NotEqualTo,
                   operands: [
                    Variable {
                     identifier: "partitionTableType",
                     position: (379, 21),
                    },
                    String {
                     parts: [
                      Raw {
                       content: "none",
                       position: (379, 44),
                      },
                     ],
                    },
                   ],
                   position: (379, 40),
                  },
                  then: String {
                   parts: [
                    Raw {
                     content: "/dev/vda",
                     position: (379, 56),
                    },
                    Expression {
                     expression: Variable {
                      identifier: "rootPartition",
                      position: (379, 66),
                     },
                    },
                   ],
                  },
                  else_: String {
                   parts: [
                    Raw {
                     content: "/dev/vda",
                     position: (379, 88),
                    },
                   ],
                  },
                  position: (379, 18),
                 },
                },
                Raw {
                 content: "\n\n# Some tools assume these exist\nln -s vda /dev/xvda\nln -s vda /dev/sda\n# make systemd-boot find ESP without udev\nmkdir /dev/block\nln -s /dev/vda1 /dev/block/254:1\n\nmountPoint=/mnt\nmkdir $mountPoint\nmount $rootDisk $mountPoint\n\n# Create the ESP and mount it. Unlike e2fsprogs, mkfs.vfat doesn't support an\n# '-E offset=X' option, so we can't do this outside the VM.\n",
                 position: (379, 98),
                },
                Expression {
                 expression: FunctionApplication {
                  function: Variable {
                   identifier: "optionalString",
                   position: (394, 9),
                  },
                  arguments: [
                   BinaryOperation {
                    operator: LogicalOr,
                    operands: [
                     BinaryOperation {
                      operator: EqualTo,
                      operands: [
                       Variable {
                        identifier: "partitionTableType",
                        position: (394, 25),
                       },
                       String {
                        parts: [
                         Raw {
                          content: "efi",
                          position: (394, 48),
                         },
                        ],
                       },
                      ],
                      position: (394, 44),
                     },
                     BinaryOperation {
                      operator: EqualTo,
                      operands: [
                       Variable {
                        identifier: "partitionTableType",
                        position: (394, 56),
                       },
                       String {
                        parts: [
                         Raw {
                          content: "hybrid",
                          position: (394, 79),
                         },
                        ],
                       },
                      ],
                      position: (394, 75),
                     },
                    ],
                    position: (394, 53),
                   },
                   String {
                    parts: [
                     Raw {
                      content: "mkdir -p /mnt/boot\nmkfs.vfat -n ESP /dev/vda1\nmount /dev/vda1 /mnt/boot\n",
                      position: (395, 1),
                     },
                    ],
                   },
                  ],
                 },
                },
                Raw {
                 content: "\n\n# Install a configuration.nix\nmkdir -p /mnt/etc/nixos\n",
                 position: (398, 10),
                },
                Expression {
                 expression: FunctionApplication {
                  function: Variable {
                   identifier: "optionalString",
                   position: (402, 9),
                  },
                  arguments: [
                   BinaryOperation {
                    operator: NotEqualTo,
                    operands: [
                     Variable {
                      identifier: "configFile",
                      position: (402, 25),
                     },
                     Variable {
                      identifier: "null",
                      position: (402, 39),
                     },
                    ],
                    position: (402, 36),
                   },
                   String {
                    parts: [
                     Raw {
                      content: "cp ",
                      position: (403, 1),
                     },
                     Expression {
                      expression: Variable {
                       identifier: "configFile",
                       position: (403, 14),
                      },
                     },
                     Raw {
                      content: " /mnt/etc/nixos/configuration.nix\n",
                      position: (403, 25),
                     },
                    ],
                   },
                  ],
                 },
                },
                Raw {
                 content: "\n\n",
                 position: (404, 10),
                },
                Expression {
                 expression: FunctionApplication {
                  function: PropertyAccess {
                   expression: Variable {
                    identifier: "lib",
                    position: (406, 9),
                   },
                   attribute_path: AttributePath {
                    attributes: [
                     Raw {
                      content: "optionalString",
                      position: (406, 13),
                     },
                    ],
                   },
                   default: None,
                  },
                  arguments: [
                   Variable {
                    identifier: "installBootLoader",
                    position: (406, 28),
                   },
                   String {
                    parts: [
                     Raw {
                      content: "# Set up core system link, GRUB, etc.\nNIXOS_INSTALL_BOOTLOADER=1 nixos-enter --root $mountPoint -- /nix/var/nix/profiles/system/bin/switch-to-configuration boot\n\n# The above scripts will generate a random machine-id and we don't want to bake a single ID into all our images\nrm -f $mountPoint/etc/machine-id\n",
                      position: (407, 1),
                     },
                    ],
                   },
                  ],
                 },
                },
                Raw {
                 content: "\n\n# Set the ownerships of the contents. The modes are set in preVM.\n# No globbing on targets, so no need to set -f\ntargets_=(",
                 position: (412, 10),
                },
                Expression {
                 expression: FunctionApplication {
                  function: Variable {
                   identifier: "concatStringsSep",
                   position: (416, 19),
                  },
                  arguments: [
                   String {
                    parts: [
                     Raw {
                      content: " ",
                      position: (416, 37),
                     },
                    ],
                   },
                   Variable {
                    identifier: "targets",
                    position: (416, 40),
                   },
                  ],
                 },
                },
                Raw {
                 content: ")\nusers_=(",
                 position: (416, 48),
                },
                Expression {
                 expression: FunctionApplication {
                  function: Variable {
                   identifier: "concatStringsSep",
                   position: (417, 17),
                  },
                  arguments: [
                   String {
                    parts: [
                     Raw {
                      content: " ",
                      position: (417, 35),
                     },
                    ],
                   },
                   Variable {
                    identifier: "users",
                    position: (417, 38),
                   },
                  ],
                 },
                },
                Raw {
                 content: ")\ngroups_=(",
                 position: (417, 44),
                },
                Expression {
                 expression: FunctionApplication {
                  function: Variable {
                   identifier: "concatStringsSep",
                   position: (418, 18),
                  },
                  arguments: [
                   String {
                    parts: [
                     Raw {
                      content: " ",
                      position: (418, 36),
                     },
                    ],
                   },
                   Variable {
                    identifier: "groups",
                    position: (418, 39),
                   },
                  ],
                 },
                },
                Raw {
                 content: ")\nfor ((i = 0; i < ",
                 position: (418, 46),
                },
                Raw {
                 content: "$",
                 position: (419, 24),
                },
                Raw {
                 content: "{#targets_[@]}; i++)); do\n  target=\"",
                 position: (419, 27),
                },
                Raw {
                 content: "$",
                 position: (420, 17),
                },
                Raw {
                 content: "{targets_[$i]}\"\n  user=\"",
                 position: (420, 20),
                },
                Raw {
                 content: "$",
                 position: (421, 15),
                },
                Raw {
                 content: "{users_[$i]}\"\n  group=\"",
                 position: (421, 18),
                },
                Raw {
                 content: "$",
                 position: (422, 16),
                },
                Raw {
                 content: "{groups_[$i]}\"\n  if [ -n \"$user$group\" ]; then\n    # We have to nixos-enter since we need to use the user and group of the VM\n    nixos-enter --root $mountPoint -- chown -R \"$user:$group\" \"$target\"\n  fi\ndone\n\numount -R /mnt\n\n# Make sure resize2fs works. Note that resize2fs has stricter criteria for resizing than a normal\n# mount, so the `-c 0` and `-i 0` don't affect it. Setting it to `now` doesn't produce deterministic\n# output, of course, but we can fix that when/if we start making images deterministic.\n",
                 position: (422, 19),
                },
                Expression {
                 expression: FunctionApplication {
                  function: Variable {
                   identifier: "optionalString",
                   position: (434, 9),
                  },
                  arguments: [
                   BinaryOperation {
                    operator: EqualTo,
                    operands: [
                     Variable {
                      identifier: "fsType",
                      position: (434, 25),
                     },
                     String {
                      parts: [
                       Raw {
                        content: "ext4",
                        position: (434, 36),
                       },
                      ],
                     },
                    ],
                    position: (434, 32),
                   },
                   String {
                    parts: [
                     Raw {
                      content: "tune2fs -T now -c 0 -i 0 $rootDisk\n",
                      position: (435, 1),
                     },
                    ],
                   },
                  ],
                 },
                },
                Raw {
                 content: "\n",
                 position: (436, 10),
                },
               ],
              },
             ],
            },
           ],
          },
         ),
        ],
        target: IfThenElse {
         predicate: Variable {
          identifier: "onlyNixStore",
          position: (440, 6),
         },
         then: FunctionApplication {
          function: PropertyAccess {
           expression: Variable {
            identifier: "pkgs",
            position: (441, 5),
           },
           attribute_path: AttributePath {
            attributes: [
             Raw {
              content: "runCommand",
              position: (441, 10),
             },
            ],
           },
           default: None,
          },
          arguments: [
           Variable {
            identifier: "name",
            position: (441, 21),
           },
           Map {
            bindings: [],
            recursive: false,
            position: (441, 26),
           },
           BinaryOperation {
            operator: Addition,
            operands: [
             BinaryOperation {
              operator: Addition,
              operands: [
               Variable {
                identifier: "prepareImage",
                position: (442, 8),
               },
               Variable {
                identifier: "moveOrConvertImage",
                position: (442, 23),
               },
              ],
              position: (442, 21),
             },
             Variable {
              identifier: "postVM",
              position: (442, 44),
             },
            ],
            position: (442, 42),
           },
          ],
         },
         else_: Variable {
          identifier: "buildImage",
          position: (443, 8),
         },
         position: (440, 3),
        },
        position: (95, 26),
       },
       position: (95, 1),
      },
      position: (93, 1),
     },
     position: (91, 1),
    },
    position: (87, 1),
   },
   position: (85, 1),
  },
  position: (83, 1),
 },
 position: (1, 1),
}