From ebd4ba4f792526c45bc5de1754cd763da941408f Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Tue, 20 May 2025 23:30:22 +0100 Subject: [PATCH] lib.version: add `correctNixpkgsChannel` --- lib/version.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/version.nix b/lib/version.nix index 993e6959..120ca3f5 100644 --- a/lib/version.nix +++ b/lib/version.nix @@ -121,4 +121,20 @@ in inherit (lib.nixvim.version) release; in if release == "unstable" then "main" else "nixos-" + release; + + /** + Whether the nixpkgs input is correct for this release of nixvim. + + Can be used to identify mismatched nixpkgs inputs, usually caused our input + following a user's input from another channel + */ + correctNixpkgsChannel = + let + nixvimRelease = lib.nixvim.version.release; + nixpkgsRelease = lib.trivial.release; + in + if nixvimRelease == "unstable" then + true # TODO: how do we know what channel a nixpkgs instance is on? + else + nixvimRelease == nixpkgsRelease; }