From d3528cdc3dbe82a0551707fe869aec02bba72956 Mon Sep 17 00:00:00 2001 From: Victor Fuentes Date: Sat, 17 Dec 2022 18:00:58 -0500 Subject: nixos/version: add config.system.nixos.distroName and config.system.nixos.distroId --- nixos/modules/misc/version.nix | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'nixos/modules/misc') diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix index c9e06382b7ac2..30d11913c533b 100644 --- a/nixos/modules/misc/version.nix +++ b/nixos/modules/misc/version.nix @@ -16,18 +16,18 @@ let ) + "\n"; osReleaseContents = { - NAME = "NixOS"; - ID = "nixos"; + NAME = "${cfg.distroName}"; + ID = "${cfg.distroId}"; VERSION = "${cfg.release} (${cfg.codeName})"; VERSION_CODENAME = toLower cfg.codeName; VERSION_ID = cfg.release; BUILD_ID = cfg.version; - PRETTY_NAME = "NixOS ${cfg.release} (${cfg.codeName})"; + PRETTY_NAME = "${cfg.distroName} ${cfg.release} (${cfg.codeName})"; LOGO = "nix-snowflake"; - HOME_URL = "https://nixos.org/"; - DOCUMENTATION_URL = "https://nixos.org/learn.html"; - SUPPORT_URL = "https://nixos.org/community.html"; - BUG_REPORT_URL = "https://github.com/NixOS/nixpkgs/issues"; + HOME_URL = lib.optionalString (cfg.distroId == "nixos") "https://nixos.org/"; + 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"; } // lib.optionalAttrs (cfg.variant_id != null) { VARIANT_ID = cfg.variant_id; }; @@ -89,6 +89,20 @@ in description = lib.mdDoc "The NixOS release code name (e.g. `Emu`)."; }; + nixos.distroId = mkOption { + internal = true; + type = types.str; + default = "nixos"; + description = lib.mdDoc "The id of the operating system"; + }; + + nixos.distroName = mkOption { + internal = true; + type = types.str; + default = "NixOS"; + description = lib.mdDoc "The name of the operating system"; + }; + nixos.variant_id = mkOption { type = types.nullOr (types.strMatching "^[a-z0-9._-]+$"); default = null; @@ -155,10 +169,10 @@ in environment.etc = { "lsb-release".text = attrsToText { LSB_VERSION = "${cfg.release} (${cfg.codeName})"; - DISTRIB_ID = "nixos"; + DISTRIB_ID = "${cfg.distroId}"; DISTRIB_RELEASE = cfg.release; DISTRIB_CODENAME = toLower cfg.codeName; - DISTRIB_DESCRIPTION = "NixOS ${cfg.release} (${cfg.codeName})"; + DISTRIB_DESCRIPTION = "${cfg.distroName} ${cfg.release} (${cfg.codeName})"; }; "os-release".text = attrsToText osReleaseContents; -- cgit 1.4.1