1{
2 lib,
3 config,
4 pkgs,
5 ...
6}:
7{
8 options.image = {
9 baseName = lib.mkOption {
10 type = lib.types.str;
11 default = "nixos-image-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}";
12 defaultText = lib.literalExpression "nixos-image-\${config.system.nixos.label}-\${pkgs.stdenv.hostPlatform.system}";
13 description = ''
14 Basename of the image filename without any extension (e.g. `image_1`).
15 '';
16 };
17
18 extension = lib.mkOption {
19 type = lib.types.str;
20 description = ''
21 Extension of the image filename (e.g. `raw`).
22 '';
23 };
24
25 # FIXME: this should be marked readOnly, when there are no
26 # mkRenamedOptionModuleWith calls with `image.fileName` as
27 # as a target left anymore (i.e. 24.11). We can't do it
28 # before, as some source options where writable before.
29 # Those should use image.baseName and image.extension instead.
30 fileName = lib.mkOption {
31 type = lib.types.str;
32 default = "${config.image.baseName}.${config.image.extension}";
33 defaultText = lib.literalExpression "\${config.image.baseName}.\${config.image.extension}";
34 description = ''
35 Filename of the image including all extensions (e.g `image_1.raw` or
36 `image_1.raw.zst`).
37 '';
38 };
39
40 filePath = lib.mkOption {
41 type = lib.types.str;
42 default = config.image.fileName;
43 defaultText = lib.literalExpression "config.image.fileName";
44 description = ''
45 Path of the image, relative to `$out` in `system.build.image`.
46 While it defaults to `config.image.fileName`, it can be different for builders where
47 the image is in sub directory, such as `iso`, `sd-card` or `kexec` images.
48 '';
49 };
50 };
51}