about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-15 17:43:15 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-15 17:50:09 +0200
commitceb8ab7ffa9435a66568bba17d153c82a4e4e824 (patch)
tree550240d6fa47d9dec18731589cefdf92f3b50ee7 /nixos
parentbbe265e8c291d542f5f5a9ea0217e78b4ba6624e (diff)
downloadnixlib-ceb8ab7ffa9435a66568bba17d153c82a4e4e824.tar
nixlib-ceb8ab7ffa9435a66568bba17d153c82a4e4e824.tar.gz
nixlib-ceb8ab7ffa9435a66568bba17d153c82a4e4e824.tar.bz2
nixlib-ceb8ab7ffa9435a66568bba17d153c82a4e4e824.tar.lz
nixlib-ceb8ab7ffa9435a66568bba17d153c82a4e4e824.tar.xz
nixlib-ceb8ab7ffa9435a66568bba17d153c82a4e4e824.tar.zst
nixlib-ceb8ab7ffa9435a66568bba17d153c82a4e4e824.zip
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 '<nixos>' -A config.system.nixosVersion --eval-only
  "13.10pre34915.50f4822"

  $ nix-instantiate '<nixos/default.nix>' -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.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/misc/version.nix5
1 files changed, 3 insertions, 2 deletions
diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix
index fa7baf36fb9c..e9ee476d36a9 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";