lib.version: add release info

This commit is contained in:
Matt Sturgeon 2025-05-20 23:29:12 +01:00
parent 211f532644
commit 8f782c7af9
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299

View file

@ -90,4 +90,35 @@ in
locked = lockedInputs.${name}.locked.narHash; locked = lockedInputs.${name}.locked.narHash;
in in
real != locked; real != locked;
/**
Nixvim's current commit, or the specified default when nixvim's repo is dirty.
*/
revisionWithDefault = default: flake.sourceInfo.rev or default;
/**
Nixvim's current commit, defaulting to the canonical branch name for this release.
*/
revision = with lib.nixvim.version; revisionWithDefault releaseBranch;
/**
Nixvim's release.
Derived from the nixpkgs branch targeted in `flake.lock`.
*/
release =
let
inherit (lockedInputs.nixpkgs.original) ref;
parts = lib.splitString "-" ref;
in
lib.last parts;
/**
The canonical branch name associated with this release of nixvim.
*/
releaseBranch =
let
inherit (lib.nixvim.version) release;
in
if release == "unstable" then "main" else "nixos-" + release;
} }