From 484403bf0e229f857cafb67ec2e516ed7dfdc2d2 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 19 Feb 2014 18:47:48 +0100 Subject: [PATCH] =?UTF-8?q?Add=20a=20constant=20=E2=80=98nixpkgsVersion?= =?UTF-8?q?=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes it a bit easier to find out the current Nixpkgs version, e.g. $ nix-instantiate --eval '' -A lib.nixpkgsVersion "14.02.35657.66f51a9" --- lib/trivial.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/trivial.nix b/lib/trivial.nix index 760a74ce666..190cda6abd6 100644 --- a/lib/trivial.nix +++ b/lib/trivial.nix @@ -41,4 +41,10 @@ rec { pathExists readFile isBool isFunction isInt add sub lessThan; + # Return the Nixpkgs version number. + nixpkgsVersion = + let suffixFile = ../.version-suffix; in + readFile ../.version + + (if pathExists suffixFile then readFile suffixFile else "pre-git"); + }