lib: deduplicate version/suffix references

The logic regarding the generated `.version-suffix` file is already
defined in `lib/trivial.nix` and shouldn't be duplicated in
`nixos/version`.
This commit is contained in:
Maximilian Bosch
2018-04-24 20:33:35 +02:00
parent f66cdc71a3
commit 39909289f4
2 changed files with 7 additions and 8 deletions

View File

@@ -58,11 +58,12 @@ rec {
inherit (lib.strings) fileContents;
version = fileContents ../.version;
suffix = let suffixFile = ../.version-suffix; in
if pathExists suffixFile then fileContents suffixFile else "pre-git";
# Return the Nixpkgs version number.
nixpkgsVersion =
let suffixFile = ../.version-suffix; in
fileContents ../.version
+ (if pathExists suffixFile then fileContents suffixFile else "pre-git");
nixpkgsVersion = version + suffix;
# Whether we're being called by nix-shell.
inNixShell = builtins.getEnv "IN_NIX_SHELL" != "";