3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/lib/flake-version-info.nix
Maximilian Bosch ede5720a0d
flake/version overlay: review fixes
* Improves the comments of `lib/flake-version-info.nix` and drops the
  `__`-prefix from the filename.
* `lib'` -> `lib0` in `nixpkgs/lib`.
* Drop the declaration of `trivial.version` in the overlay because this
  declaration already uses the final expressions of `versionSuffix` and
  `release` now.
* No need to fall back to `self.lastModified` anymore, this was a
  workaround for pre2.4 Nix.

Co-authored-by: Robert Hensing <robert@roberthensing.nl>
Co-authored-by: Silvan Mosberger <contact@infinisil.com>
2023-12-10 13:25:24 +01:00

21 lines
689 B
Nix

# 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 // {
versionSuffix =
".${finalLib.substring 0 8 (self.lastModifiedDate or "19700101")}.${self.shortRev or "dirty"}";
revisionWithDefault = default: self.rev or default;
};
}