diff --git a/site.nix b/site.nix index b917edd..06876b7 100644 --- a/site.nix +++ b/site.nix @@ -13,7 +13,7 @@ let xesite = naersk.buildPackage { inherit src; - buildInputs = [ pkg-config openssl ]; + buildInputs = [ pkg-config openssl git ]; remapPathPrefix = true; }; diff --git a/src/build.rs b/src/build.rs index 9a6d3c3..3b73241 100644 --- a/src/build.rs +++ b/src/build.rs @@ -1,5 +1,11 @@ use ructe::{Result, Ructe}; +use std::process::Command; fn main() -> Result<()> { - Ructe::from_env()?.compile_templates("templates") + Ructe::from_env()?.compile_templates("templates")?; + + let output = Command::new("git").args(&["rev-parse", "HEAD"]).output().unwrap(); + let git_hash = String::from_utf8(output.stdout).unwrap(); + println!("cargo:rustc-env=GITHUB_SHA={}", git_hash); + Ok(()) } diff --git a/templates/footer.rs.html b/templates/footer.rs.html index 3059da7..7f46c49 100644 --- a/templates/footer.rs.html +++ b/templates/footer.rs.html @@ -7,7 +7,7 @@
Copyright 2020 Christine Dodrill. Any and all opinions listed here are my own and not representative of my employers; future, past and present.

Looking for someone for your team? Take a look here.

-

Served by @APP running commit @env!("GITHUB_SHA"), see source code here.

+

Served by @APP running commit @env!("GITHUB_SHA"), see source code here.