core/lib/flake-version-info.nix

22 lines
695 B
Nix
Raw Normal View History

2024-05-01 22:14:04 +00:00
# This function produces a lib overlay to be used by the nixpkgs
# & nixpkgs/lib flakes to provide meaningful values for
# `lib.trivial.version` et al..
#
# Internal and subject to change, don't use this anywhere else!
# Instead, consider using a public interface, such as this flake here
# in this directory, `lib/`, or use the nixpkgs flake, which applies
# this logic for you in its `lib` output attribute.
self: # from the flake
finalLib: prevLib: # lib overlay
{
trivial = prevLib.trivial // {
2024-06-30 08:16:52 +00:00
versionSuffix = ".${
finalLib.substring 0 8 (self.lastModifiedDate or "19700101")
}.${self.shortRev or "dirty"}";
2024-05-01 22:14:04 +00:00
revisionWithDefault = default: self.rev or default;
};
}