From df8fb93416973a96a6f56bce7af9ee5fb0cc1c87 Mon Sep 17 00:00:00 2001 From: Fernando Ayats Date: Wed, 27 Nov 2024 11:06:49 +0100 Subject: [PATCH] build with rev --- package.nix | 4 ++++ src/main.rs | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/package.nix b/package.nix index 03570cf..68ad8af 100644 --- a/package.nix +++ b/package.nix @@ -55,6 +55,10 @@ rustPlatform.buildRustPackage { cargoLock.lockFile = ./Cargo.lock; + env = { + NH_REV = rev; + }; + meta = { description = "Yet another nix cli helper"; homepage = "https://github.com/viperML/nh"; diff --git a/src/main.rs b/src/main.rs index 93368d9..1770baa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,7 @@ use color_eyre::Result; use tracing::debug; const NH_VERSION: &str = env!("CARGO_PKG_VERSION"); +const NH_REV: Option<&str> = option_env!("NH_REV"); fn main() -> Result<()> { let mut do_warn = false; @@ -28,7 +29,7 @@ fn main() -> Result<()> { let args = ::parse(); crate::logging::setup_logging(args.verbose)?; tracing::debug!("{args:#?}"); - tracing::debug!(%NH_VERSION); + tracing::debug!(%NH_VERSION, ?NH_REV); if do_warn { tracing::warn!(