Skip to content

Commit e3f8dd0

Browse files
authored
feat: read version in flake from cargo.toml (cashubtc#1684)
1 parent 4c14c33 commit e3f8dd0

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

flake.nix

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
}.${system} or null;
5353

5454
overlays = [ (import rust-overlay) ];
55+
56+
# Derive version from Cargo.toml so there is a single source of truth
57+
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).workspace.package.version;
58+
5559
lib = pkgs.lib;
5660
stdenv = pkgs.stdenv;
5761
isDarwin = stdenv.isDarwin;
@@ -159,9 +163,8 @@
159163

160164
# Common args for all Crane builds
161165
commonCraneArgs = {
162-
inherit src;
166+
inherit src version;
163167
pname = "cdk";
164-
version = "0.15.0-rc.0";
165168

166169
nativeBuildInputs = with pkgs; [
167170
pkg-config
@@ -193,9 +196,8 @@
193196
# Common args for static musl builds (Linux only)
194197
# Produces fully statically-linked binaries that run on any Linux system
195198
commonCraneArgsStatic = {
196-
inherit src;
199+
inherit src version;
197200
pname = "cdk-static";
198-
version = "0.15.0-rc.0";
199201

200202
# Cross-compile to musl for fully static linking
201203
CARGO_BUILD_TARGET = muslTarget;
@@ -300,9 +302,8 @@
300302
# Helper function to create WASM build checks
301303
# WASM builds don't need native libs like openssl
302304
mkWasmBuild = name: cargoArgs: craneLib.cargoBuild ({
303-
inherit src;
305+
inherit src version;
304306
pname = "cdk-wasm-${name}";
305-
version = "0.15.0-rc.0";
306307
cargoArtifacts = workspaceDeps;
307308
cargoExtraArgs = "${cargoArgs} --target wasm32-unknown-unknown";
308309
# WASM doesn't need native build inputs

0 commit comments

Comments
 (0)