From 38645a1c1cfd67d327d5a012336d0e55ea1bced6 Mon Sep 17 00:00:00 2001 From: Thomas Zahner Date: Thu, 19 Dec 2024 22:00:10 +0100 Subject: [PATCH] Extract version number programmatically --- default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 8e006b7..2a9a80e 100644 --- a/default.nix +++ b/default.nix @@ -1,10 +1,16 @@ { pkgs }: let + version = + let + cargoToml = builtins.readFile ./Cargo.toml; + match = builtins.match ''.*version = "([^"]+)".*'' cargoToml; + in + if match != null then builtins.elemAt match 0 else throw "Version not found in Cargo.toml"; in { app = pkgs.rustPlatform.buildRustPackage { pname = "lychee"; - version = "0.17.0"; + inherit version; src = ./.; cargoLock = {