Skip to content

Commit

Permalink
nixos/os-release: add additional info (#338461)
Browse files Browse the repository at this point in the history
  • Loading branch information
jopejoe1 authored Oct 31, 2024
2 parents 0632524 + 3dec4d4 commit 846ec9d
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions nixos/modules/misc/version.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,26 @@ let
{
NAME = "${cfg.distroName}";
ID = "${cfg.distroId}";
ID_LIKE = optionalString (!isNixos) "nixos";
VENDOR_NAME = cfg.vendorName;
VERSION = "${cfg.release} (${cfg.codeName})";
VERSION_CODENAME = toLower cfg.codeName;
VERSION_ID = cfg.release;
BUILD_ID = cfg.version;
PRETTY_NAME = "${cfg.distroName} ${cfg.release} (${cfg.codeName})";
CPE_NAME = "cpe:/o:${cfg.vendorId}:${cfg.distroId}:${cfg.release}";
LOGO = "nix-snowflake";
HOME_URL = optionalString isNixos "https://nixos.org/";
VENDOR_URL = optionalString isNixos "https://nixos.org/";
DOCUMENTATION_URL = optionalString isNixos "https://nixos.org/learn.html";
SUPPORT_URL = optionalString isNixos "https://nixos.org/community.html";
BUG_REPORT_URL = optionalString isNixos "https://github.com/NixOS/nixpkgs/issues";
ANSI_COLOR = optionalString isNixos "1;34";
IMAGE_ID = optionalString (config.system.image.id != null) config.system.image.id;
IMAGE_VERSION = optionalString (config.system.image.version != null) config.system.image.version;
} // lib.optionalAttrs (cfg.variant_id != null) {
VARIANT_ID = cfg.variant_id;
VARIANT = optionalString (cfg.variantName != null) cfg.variantName;
VARIANT_ID = optionalString (cfg.variant_id != null) cfg.variant_id;
DEFAULT_HOSTNAME = config.networking.fqdnOrHostName;
};

initrdReleaseContents = (removeAttrs osReleaseContents [ "BUILD_ID" ]) // {
Expand Down Expand Up @@ -116,6 +121,27 @@ in
description = "A lower-case string identifying a specific variant or edition of the operating system";
example = "installer";
};

variantName = mkOption {
type = types.nullOr types.str;
default = null;
description = "A string identifying a specific variant or edition of the operating system suitable for presentation to the user";
example = "NixOS Installer Image";
};

vendorId = mkOption {
internal = true;
type = types.str;
default = "nixos";
description = "The id of the operating system vendor";
};

vendorName = mkOption {
internal = true;
type = types.str;
default = "NixOS";
description = "The name of the operating system vendor";
};
};

image = {
Expand Down

0 comments on commit 846ec9d

Please sign in to comment.