Fix nix build (#1171)

I forgot nix builds in a sandbox, so my laziness earlier meant that the
nix build fails - sandbox has no git!
This commit is contained in:
Ellie Huxtable 2023-08-14 09:58:57 +01:00 committed by GitHub
parent b48de9bd9d
commit f3e9f27456
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,10 +1,11 @@
use std::process::Command; use std::process::Command;
fn main() { fn main() {
let output = Command::new("git") let output = Command::new("git").args(["rev-parse", "HEAD"]).output();
.args(["rev-parse", "HEAD"])
.output()
.unwrap();
let git_hash = String::from_utf8(output.stdout).unwrap(); let sha = match output {
println!("cargo:rustc-env=GIT_HASH={}", git_hash); Ok(sha) => String::from_utf8(sha.stdout).unwrap(),
Err(_) => String::from("NO_GIT"),
};
println!("cargo:rustc-env=GIT_HASH={}", sha);
} }