Terrible backward compatibility hack

This commit is contained in:
Eelco Dolstra 2013-10-11 13:33:44 +02:00
parent d374bff41e
commit a2600b7bc3
3 changed files with 12 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{ system, minimal ? false }:
let pkgs = import ../.. { config = {}; inherit system; }; in
let pkgs = import ./nixpkgs.nix { config = {}; inherit system; }; in
with pkgs.lib;
with import ../lib/qemu-flags.nix;

View File

@ -30,7 +30,7 @@ rec {
extraArgs = extraArgs_ // {
inherit pkgs modules baseModules;
modulesPath = ../modules;
pkgs_i686 = import ../.. { system = "i686-linux"; };
pkgs_i686 = import ./nixpkgs.nix { system = "i686-linux"; };
utils = import ./utils.nix pkgs;
};
@ -47,7 +47,7 @@ rec {
pkgs =
if pkgs_ != null
then pkgs_
else import ../.. (
else import ./nixpkgs.nix (
let
system = if nixpkgsOptions.system != "" then nixpkgsOptions.system else system_;
nixpkgsOptions = (import ./eval-config.nix {
@ -55,7 +55,7 @@ rec {
# For efficiency, leave out most NixOS modules; they don't
# define nixpkgs.config, so it's pointless to evaluate them.
baseModules = [ ../modules/misc/nixpkgs.nix ];
pkgs = import ../.. { system = system_; config = {}; };
pkgs = import ./nixpkgs.nix { system = system_; config = {}; };
}).optionDefinitions.nixpkgs;
in
{

8
nixos/lib/nixpkgs.nix Normal file
View File

@ -0,0 +1,8 @@
/* Terrible backward compatibility hack to get the path to Nixpkgs
from here. Usually, that's the relative path ../... However,
when using the NixOS channel, <nixos> resolves to a symlink to
nixpkgs/nixos, so ../.. doesn't resolve to the top-level Nixpkgs
directory but one above it. So check for that situation. */
if builtins.pathExists ../../.version then import ../..
else if builtins.pathExists ../../nixpkgs then import ../../nixpkgs
else abort "Can't find Nixpkgs, please set NIX_PATH=nixpkgs=/path/to/nixpkgs."