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.
This commit is contained in:
Eelco Dolstra 2013-10-15 17:43:15 +02:00
parent bbe265e8c2
commit ceb8ab7ffa

View File

@ -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";