From e9e4316569d91ea16be868626d6c87476521f2f0 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Thu, 4 Sep 2025 14:07:08 -0400 Subject: [PATCH] feat(xtask): update nix --- crates/xtask/src/bump.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/crates/xtask/src/bump.rs b/crates/xtask/src/bump.rs index a8788bb5..55ff1a6f 100644 --- a/crates/xtask/src/bump.rs +++ b/crates/xtask/src/bump.rs @@ -166,6 +166,7 @@ pub fn run(args: BumpVersion) -> Result<()> { update_crates(¤t_version, &next_version)?; update_makefile(&next_version)?; update_cmake(&next_version)?; + update_nix(&next_version)?; update_npm(&next_version)?; update_zig(&next_version)?; tag_next_version(&next_version)?; @@ -181,6 +182,7 @@ fn tag_next_version(next_version: &Version) -> Result<()> { "Cargo.toml", "Makefile", "build.zig.zon", + "flake.nix", "crates/cli/Cargo.toml", "crates/cli/npm/package.json", "crates/cli/npm/package-lock.json", @@ -264,6 +266,26 @@ fn update_cmake(next_version: &Version) -> Result<()> { Ok(()) } +fn update_nix(next_version: &Version) -> Result<()> { + let nix = std::fs::read_to_string("flake.nix")?; + let nix = nix + .lines() + .map(|line| { + if line.trim_start().starts_with("version =") { + format!(" version = \"{next_version}\";") + } else { + line.to_string() + } + }) + .collect::>() + .join("\n") + + "\n"; + + std::fs::write("flake.nix", nix)?; + + Ok(()) +} + fn update_crates(current_version: &Version, next_version: &Version) -> Result<()> { let mut cmd = std::process::Command::new("cargo"); cmd.arg("workspaces").arg("version");