nix: dont install fake binaries and fix dirty jj version

This commit is contained in:
Anton Bulakh 2023-06-24 08:39:27 +03:00 committed by Anton Bulakh
parent bdb6db88e1
commit 83dd591272
2 changed files with 12 additions and 0 deletions

View file

@ -37,6 +37,12 @@ fn main() -> std::io::Result<()> {
}
fn get_git_hash() -> Option<String> {
if let Some(nix_hash) = std::env::var("NIX_JJ_GIT_HASH")
.ok()
.filter(|s| !s.is_empty())
{
return Some(nix_hash);
}
if let Ok(output) = Command::new("jj")
.args([
"--ignore-working-copy",

View file

@ -41,6 +41,8 @@
version = "unstable-${self.shortRev or "dirty"}";
buildNoDefaultFeatures = true;
buildFeatures = [];
cargoBuildFlags = ["--bin" "jj"]; # don't build and install the fake editors
useNextest = true;
src = filterSrc ./. [
".*\\.nix$"
"^.jj/"
@ -64,6 +66,7 @@
];
ZSTD_SYS_USE_PKG_CONFIG = "1";
LIBSSH2_SYS_USE_PKG_CONFIG = "1";
NIX_JJ_GIT_HASH = self.rev or "";
postInstall = ''
$out/bin/jj util mangen > ./jj.1
installManPage ./jj.1
@ -106,6 +109,9 @@
openssl zstd libgit2 libssh2
pkg-config
# Make sure rust-analyzer is present
rust-analyzer
# Additional tools recommended by contributing.md
cargo-deny
cargo-insta