diff options
author | Eric Sagnes <eric.sagnes@gmail.com> | 2016-07-31 21:59:30 +0900 |
---|---|---|
committer | Eric Sagnes <eric.sagnes@gmail.com> | 2016-08-01 18:35:26 +0900 |
commit | e276842f6adef45554f05f2aee8c938c8c651ed1 (patch) | |
tree | 7a40d6e282539634830040229157377366df8b77 /lib/trivial.nix | |
parent | 85d8b016600925791cbf970f69873dfac1f781cb (diff) |
lib: refactor nixpkgsVersion with fileContents
Diffstat (limited to 'lib/trivial.nix')
-rw-r--r-- | lib/trivial.nix | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/trivial.nix b/lib/trivial.nix index 9821e3c138dd4..f85c74ab88e3a 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"; |