Stamp the version as YYYY.MM.DD-<branch>-<sha>

build.rs builds the string (git, or SLINUXM_* env for builds without .git)
and the lib exposes it as VERSION. --version, /healthz, /api/v1/ping, MCP
server info and OTel service.version use it; OpenAPI info.version stays on
the semver so docs/openapi.json does not change per commit. The flake passes
the commit date and short rev to the package.
This commit is contained in:
ari committed 2026-10-20 23:27:46 -04:00
1 parent 435a54a02d
commit 1a30b20ac0
18 files changed
+322 -18

No files matched your search

+20 -2
View File
@@ -1,14 +1,26 @@
{ lib, rustPlatform, pkg-config, cmake, systemd }:
{ lib
, rustPlatform
, pkg-config
, cmake
, systemd
# The build sandbox has no .git, so build.rs gets the stamp from here
# (YYYY.MM.DD-<branch>-<sha>). The flake fills these in; a flake has no
# branch name, hence the placeholder.
, gitSha ? "unknown"
, gitBranch ? "nix"
, buildDate ? "1970.01.01"
}:
rustPlatform.buildRustPackage {
pname = "skyg-linux-tracker";
version = (lib.importTOML ../Cargo.toml).package.version;
version = "${buildDate}-${gitBranch}-${gitSha}";
src = lib.fileset.toSource {
root = ../.;
fileset = lib.fileset.unions [
../Cargo.toml
../Cargo.lock
../build.rs
../config.example.toml
../migrations
../src
@@ -20,6 +32,12 @@ rustPlatform.buildRustPackage {
cargoLock.lockFile = ../Cargo.lock;
env = {
SLINUXM_GIT_SHA = gitSha;
SLINUXM_GIT_BRANCH = gitBranch;
SLINUXM_BUILD_DATE = buildDate;
};
# cmake: aws-lc-sys. Live-journal tests are #[ignore], so the sandbox runs
# the rest of the suite.
nativeBuildInputs = [ pkg-config cmake ];