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:
1 parent
435a54a02d
commit
1a30b20ac0
18 files changed
+322
-18
No files matched your search
@@ -8,10 +8,22 @@
|
||||
system = "x86_64-linux";
|
||||
systems = [ "x86_64-linux" "aarch64-linux" ];
|
||||
forAll = f: nixpkgs.lib.genAttrs systems (s: f nixpkgs.legacyPackages.${s});
|
||||
|
||||
# Stamp for `slinuxm --version`: the commit date and short sha, so the
|
||||
# build is reproducible. A flake does not know its branch; package.nix
|
||||
# defaults it to "nix".
|
||||
lastModified = self.lastModifiedDate or "19700101000000";
|
||||
stamp = {
|
||||
buildDate = "${builtins.substring 0 4 lastModified}.${builtins.substring 4 2 lastModified}.${builtins.substring 6 2 lastModified}";
|
||||
gitSha =
|
||||
if self ? shortRev
|
||||
then builtins.substring 0 7 self.shortRev
|
||||
else self.dirtyShortRev or "unknown";
|
||||
};
|
||||
in
|
||||
{
|
||||
packages = forAll (pkgs: rec {
|
||||
skyg-linux-tracker = pkgs.callPackage ./nix/package.nix { };
|
||||
skyg-linux-tracker = pkgs.callPackage ./nix/package.nix stamp;
|
||||
default = skyg-linux-tracker;
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user