summary refs log tree commit diff
path: root/lib/eval-config.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2010-11-23 16:07:00 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2010-11-23 16:07:00 +0000
commitc958902d4473e6abec41e383d43c28f7ec674a09 (patch)
treecc6735be05f4bc0b33d2225fb96d05e80d8ac85b /lib/eval-config.nix
parentfcf53be5bd1ce31bd0862bdeb5144e388a07a4b7 (diff)
downloadnixlib-c958902d4473e6abec41e383d43c28f7ec674a09.tar
nixlib-c958902d4473e6abec41e383d43c28f7ec674a09.tar.gz
nixlib-c958902d4473e6abec41e383d43c28f7ec674a09.tar.bz2
nixlib-c958902d4473e6abec41e383d43c28f7ec674a09.tar.lz
nixlib-c958902d4473e6abec41e383d43c28f7ec674a09.tar.xz
nixlib-c958902d4473e6abec41e383d43c28f7ec674a09.tar.zst
nixlib-c958902d4473e6abec41e383d43c28f7ec674a09.zip
* Added an option "nixpkgs.system" to specify the system type for
  which NixOS should be built.  This is useful in NixOS network
  specifications, because it allows machines in the network to have
  different types, e.g.,

    {
      machine1 =
        { config, pkgs, ... }:
        { nixpkgs.system = "i686-linux";
          ... other config ...
        };

      machine2 =
        { config, pkgs, ... }:
        { nixpkgs.system = "x86_64-linux";
          ... other config ...
        };
    }

  It can also be useful in distributed NixOS tests.

svn path=/nixos/trunk/; revision=24823
Diffstat (limited to 'lib/eval-config.nix')
-rw-r--r--lib/eval-config.nix8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/eval-config.nix b/lib/eval-config.nix
index 8a7b225e8500..d34a73fd1661 100644
--- a/lib/eval-config.nix
+++ b/lib/eval-config.nix
@@ -11,7 +11,7 @@
 , modules
 }:
 
-let extraArgs_ = extraArgs; pkgs_ = pkgs; in
+let extraArgs_ = extraArgs; pkgs_ = pkgs; system_ = system; in
 
 rec {
 
@@ -39,7 +39,8 @@ rec {
   # Import Nixpkgs, allowing the NixOS option nixpkgs.config to
   # specify the Nixpkgs configuration (e.g., to set package options
   # such as firefox.enableGeckoMediaPlayer, or to apply global
-  # overrides such as changing GCC throughout the system).  This is
+  # overrides such as changing GCC throughout the system), and the
+  # option nixpkgs.system to override the platform type.  This is
   # tricky, because we have to prevent an infinite recursion: "pkgs"
   # is passed as an argument to NixOS modules, but the value of "pkgs"
   # depends on config.nixpkgs.config, which we get from the modules.
@@ -50,12 +51,13 @@ rec {
     then pkgs_
     else import nixpkgs (
       let
+        system = if nixpkgsOptions.system != "" then nixpkgsOptions.system else system_;
         nixpkgsOptions = (import ./eval-config.nix {
           inherit system nixpkgs services extraArgs modules;
           # 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 nixpkgs { inherit system; config = {}; };
+          pkgs = import nixpkgs { system = system_; config = {}; };
         }).optionDefinitions.nixpkgs;
       in
       {