From ceb8ab7ffa9435a66568bba17d153c82a4e4e824 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 15 Oct 2013 17:43:15 +0200 Subject: [PATCH] Really fix use of NixOps with the merged Nixpkgs/NixOS tree Note that there is a subtle difference in Nix that causes nixos-rebuild to work and NixOps to fail: $ nix-instantiate '' -A config.system.nixosVersion --eval-only "13.10pre34915.50f4822" $ nix-instantiate '' -A config.system.nixosVersion --eval-only error: opening file `/nix/var/nix/profiles/per-user/root/channels/nixos/.version': No such file or directory Fixes NixOS/nixops#145. --- nixos/modules/misc/version.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix index fa7baf36fb9..e9ee476d36a 100644 --- a/nixos/modules/misc/version.nix +++ b/nixos/modules/misc/version.nix @@ -26,10 +26,11 @@ with pkgs.lib; config = { system.nixosVersion = - mkDefault (builtins.readFile ../../../.version + config.system.nixosVersionSuffix); + mkDefault (builtins.readFile "${pkgs.path}/.version" + config.system.nixosVersionSuffix); system.nixosVersionSuffix = - mkDefault (if builtins.pathExists ../../../.version-suffix then builtins.readFile ../../../.version-suffix else "pre-git"); + let suffixFile = "${pkgs.path}/.version-suffix"; in + mkDefault (if builtins.pathExists suffixFile then builtins.readFile suffixFile else "pre-git"); # Note: code names must only increase in alphabetical order. system.nixosCodeName = "Aardvark";