Skip to content

Commit 7b9b932

Browse files
authored
Make git revision available for nix flake builds (helix-editor#12331)
1 parent c262fe4 commit 7b9b932

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

flake.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@
138138
cp contrib/helix.png $out/share/icons/hicolor/256x256/apps
139139
installShellCompletion contrib/completion/hx.{bash,fish,zsh}
140140
'';
141+
# set git revision for nix flake builds, see 'git_hash' in helix-loader/build.rs
142+
HELIX_NIX_BUILD_REV = self.rev or self.dirtyRev or null;
141143
});
142144
helix = makeOverridableHelix self.packages.${system}.helix-unwrapped {};
143145
default = self.packages.${system}.helix;

helix-loader/build.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ fn main() {
2020
.output()
2121
.ok()
2222
.filter(|output| output.status.success())
23-
.and_then(|x| String::from_utf8(x.stdout).ok());
23+
.and_then(|x| String::from_utf8(x.stdout).ok())
24+
.or_else(|| option_env!("HELIX_NIX_BUILD_REV").map(|s| s.to_string()));
2425

2526
let calver = get_calver();
2627
let version: Cow<_> = match &git_hash {

0 commit comments

Comments
 (0)