diff options
author | nikstur <nikstur@outlook.com> | 2024-01-19 15:25:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-19 15:25:08 +0100 |
commit | 066151e0de86260d87852c096ded2cd55af49bcf (patch) | |
tree | 1d749d7f299e19faa771cabf2a808af3a6154dc7 /nixos/modules/misc | |
parent | e18f8d69fb90bc71c33dc0851e6482284fe2e71e (diff) | |
parent | a34af9a9556e205fe0a72014a335b96037b41823 (diff) |
Merge pull request #277633 from nikstur/image-repart-improvements
Image repart improvements
Diffstat (limited to 'nixos/modules/misc')
-rw-r--r-- | nixos/modules/misc/version.nix | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix index 45dbf45b3ae70..c929c3b37285b 100644 --- a/nixos/modules/misc/version.nix +++ b/nixos/modules/misc/version.nix @@ -28,6 +28,8 @@ let DOCUMENTATION_URL = lib.optionalString (cfg.distroId == "nixos") "https://nixos.org/learn.html"; SUPPORT_URL = lib.optionalString (cfg.distroId == "nixos") "https://nixos.org/community.html"; BUG_REPORT_URL = lib.optionalString (cfg.distroId == "nixos") "https://github.com/NixOS/nixpkgs/issues"; + IMAGE_ID = lib.optionalString (config.system.image.id != null) config.system.image.id; + IMAGE_VERSION = lib.optionalString (config.system.image.version != null) config.system.image.version; } // lib.optionalAttrs (cfg.variant_id != null) { VARIANT_ID = cfg.variant_id; }; @@ -110,6 +112,38 @@ in example = "installer"; }; + image = { + + id = lib.mkOption { + type = types.nullOr (types.strMatching "^[a-z0-9._-]+$"); + default = null; + description = lib.mdDoc '' + Image identifier. + + This corresponds to the IMAGE_ID field in os-release. See the + upstream docs for more details on valid characters for this field: + https://www.freedesktop.org/software/systemd/man/latest/os-release.html#IMAGE_ID= + + You would only want to set this option if you're build NixOS appliance images. + ''; + }; + + version = lib.mkOption { + type = types.nullOr (types.strMatching "^[a-z0-9._-]+$"); + default = null; + description = lib.mdDoc '' + Image version. + + This corresponds to the IMAGE_VERSION field in os-release. See the + upstream docs for more details on valid characters for this field: + https://www.freedesktop.org/software/systemd/man/latest/os-release.html#IMAGE_VERSION= + + You would only want to set this option if you're build NixOS appliance images. + ''; + }; + + }; + stateVersion = mkOption { type = types.str; # TODO Remove this and drop the default of the option so people are forced to set it. |