diff options
Diffstat (limited to 'lib/flake-version-info.nix')
-rw-r--r-- | lib/flake-version-info.nix | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/flake-version-info.nix b/lib/flake-version-info.nix new file mode 100644 index 000000000000..de15be94bee8 --- /dev/null +++ b/lib/flake-version-info.nix @@ -0,0 +1,20 @@ +# 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; + }; +} |