Author: eelco
Date: Tue Nov 23 16:07:00 2010
New Revision: 24823
URL: https://svn.nixos.org/websvn/nix/?rev=24823&sc=1
Log:
* 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.
Modified:
nixos/trunk/lib/eval-config.nix
nixos/trunk/modules/misc/nixpkgs.nix
Modified: nixos/trunk/lib/eval-config.nix
==============================================================================
--- nixos/trunk/lib/eval-config.nix Tue Nov 23 15:47:18 2010 (r24822)
+++ nixos/trunk/lib/eval-config.nix Tue Nov 23 16:07:00 2010 (r24823)
@@ -11,7 +11,7 @@
, modules
}:
-let extraArgs_ = extraArgs; pkgs_ = pkgs; in
+let extraArgs_ = extraArgs; pkgs_ = pkgs; system_ = system; in
rec {
@@ -39,7 +39,8 @@
# 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 @@
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
{
Modified: nixos/trunk/modules/misc/nixpkgs.nix
==============================================================================
--- nixos/trunk/modules/misc/nixpkgs.nix Tue Nov 23 15:47:18 2010
(r24822)
+++ nixos/trunk/modules/misc/nixpkgs.nix Tue Nov 23 16:07:00 2010
(r24823)
@@ -13,6 +13,17 @@
'';
};
+ nixpkgs.system = pkgs.lib.mkOption {
+ default = "";
+ description = ''
+ Specifies the Nix platform type for which NixOS should be built.
+ If unset, it defaults to the platform type of your host system
+ (<literal>${builtins.currentSystem}</literal>).
+ Specifying this option is useful when doing distributed
+ multi-platform deployment, or when building virtual machines.
+ '';
+ };
+
nixpkgs.platform = pkgs.lib.mkOption {
default = pkgs.platforms.pc;
description = ''
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits