Commit graph

6 commits

Author SHA1 Message Date
Arian van Putten 3eb0214551 modules/image/repart: Fix stripNixStorePrefix
It seems it wasn't working
2023-08-22 13:09:03 +02:00
Vincent Haupert f652755434 nixos/image: add image.repart.package option
Allow giving a custom package containing the `systemd-repart` binary.
Defaults to `pkgs.systemd`. This option opens up the possibility to use
a different package for the image builder and the system configuration.

For example, someone could use this option to build an image with a
patched systemd while still using the upstream nixpkgs systemd package
(i.e., `pkgs.systemd`) for the system configuration installed to the
created image.
2023-08-04 13:49:18 +02:00
Vincent Haupert 5fd478506d nixos/image: use stable target dir for amended repart definitions
Output the amended repart definitions to a well-known directory in
$TMPDIR instead of using a temporary directory with a random directory
name.

The output file `repart-output.json` also contains the full path to the
repart definition file used to create the partition. As
`amend-repart-definitions.py` uses `tempfile.mkdtemp`, this introduces
an impurity:

```json
{
        "type" : "root-x86-64",
        "label" : "rootfs",
        "uuid" : "f2fa2e49-e443-45d2-a2e2-c3754cab6363",
        "file" : "/build/tmppjo7kv5o/rootfs.conf",
        "node" : "image.raw2",
        "offset" : 135266304,
        "old_size" : 0,
        "raw_size" : 1651101696,
        "old_padding" : 0,
        "raw_padding" : 0,
        "activity" : "create",
}
```

This commit changes the parent directory of the amended repart
definitions to `/build/amended-repart.d/`.
2023-08-03 11:46:35 +02:00
Vincent Haupert 7f70abf80c nixos/image: write systemd-repart output to $out/repart-output.json
Write the output of `systemd-repart` as a JSON file to
`$out/repart-output.json`.

Depending on the repart configuration, the output of `systemd-repart`
contains important information, for example, when creating verity
partitions:

> The verity root hash itself will be included in the output of
> systemd-repart.

See `Verity=` in repart.d(5).
2023-08-02 00:10:14 +02:00
nikstur cb2d047c57 nixos/image: add repart builder docs 2023-07-26 23:36:18 +02:00
nikstur ec8d30cc50 nixos/image: add repart builder 2023-07-26 23:33:14 +02:00