From e276842f6adef45554f05f2aee8c938c8c651ed1 Mon Sep 17 00:00:00 2001 From: Eric Sagnes Date: Sun, 31 Jul 2016 21:59:30 +0900 Subject: [PATCH] lib: refactor nixpkgsVersion with fileContents --- lib/trivial.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/trivial.nix b/lib/trivial.nix index 9821e3c138d..f85c74ab88e 100644 --- a/lib/trivial.nix +++ b/lib/trivial.nix @@ -62,11 +62,13 @@ rec { isInt add sub lessThan seq deepSeq genericClosure; + inherit (import ./strings.nix) fileContents; + # Return the Nixpkgs version number. nixpkgsVersion = let suffixFile = ../.version-suffix; in - readFile ../.version - + (if pathExists suffixFile then readFile suffixFile else "pre-git"); + fileContents ../.version + + (if pathExists suffixFile then fileContents suffixFile else "pre-git"); # Whether we're being called by nix-shell. inNixShell = builtins.getEnv "IN_NIX_SHELL" == "1";