2009-05-27 09:16:56 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								# From an end-user configuration file (`configuration'), build a NixOS
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								# configuration object (`config') from which we can retrieve option
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								# values.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-27 11:57:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								{ system ? builtins.currentSystem
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-26 16:52:38 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								, pkgs ? null
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								, baseModules ? import ../modules/module-list.nix
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-05 14:43:13 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								, extraArgs ? {}
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-27 11:57:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								, modules
							 | 
						
					
						
							
								
									
										
										
										
											2013-10-28 15:48:20 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								, check ? true
							 | 
						
					
						
							
								
									
										
										
										
											2013-11-27 16:54:20 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								, prefix ? []
							 | 
						
					
						
							
								
									
										
										
										
											2009-06-05 13:19:39 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								}:
							 | 
						
					
						
							
								
									
										
										
										
											2009-05-27 09:16:56 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-12-16 17:07:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								let extraArgs_ = extraArgs; pkgs_ = pkgs; system_ = system;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    extraModules = let e = builtins.getEnv "NIXOS_EXTRA_MODULE_PATH";
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								                   in if e == "" then [] else [(import (builtins.toPath e))];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								in rec {
							 | 
						
					
						
							
								
									
										
										
										
											2009-06-05 13:19:39 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-26 16:52:38 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  # Merge the option definitions in all modules, forming the full
							 | 
						
					
						
							
								
									
										
										
										
											2013-10-28 15:48:20 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  # system configuration.
							 | 
						
					
						
							
								
									
										
										
										
											2013-10-28 22:43:29 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  inherit (pkgs.lib.evalModules {
							 | 
						
					
						
							
								
									
										
										
										
											2013-11-27 16:54:20 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    inherit prefix;
							 | 
						
					
						
							
								
									
										
										
										
											2014-12-16 17:07:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    modules = modules ++ extraModules ++ baseModules;
							 | 
						
					
						
							
								
									
										
										
										
											2013-10-28 22:43:29 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    args = extraArgs;
							 | 
						
					
						
							
								
									
										
										
										
											2013-10-29 16:14:58 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    check = check && options.environment.checkConfigurationOptions.value;
							 | 
						
					
						
							
								
									
										
										
										
											2013-10-28 22:43:29 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  }) config options;
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-26 16:52:38 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  # These are the extra arguments passed to every module.  In
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  # particular, Nixpkgs is passed through the "pkgs" argument.
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-09 00:09:31 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  # FIXME: we enable config.allowUnfree to make packages like
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  # nvidia-x11 available. This isn't a problem because if the user has
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
										
									
								 | 
							
							
								  # ‘nixpkgs.config.allowUnfree = false’, then evaluation will fail on
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  # the 64-bit package anyway. However, it would be cleaner to respect
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  # nixpkgs.config here.
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-05 14:43:13 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  extraArgs = extraArgs_ // {
							 | 
						
					
						
							
								
									
										
										
										
											2010-05-08 17:18:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    inherit pkgs modules baseModules;
							 | 
						
					
						
							
								
									
										
										
										
											2009-07-14 12:36:02 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    modulesPath = ../modules;
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-09 00:09:31 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    pkgs_i686 = import ./nixpkgs.nix { system = "i686-linux"; config.allowUnfree = true; };
							 | 
						
					
						
							
								
									
										
										
										
											2012-10-12 17:01:49 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    utils = import ./utils.nix pkgs;
							 | 
						
					
						
							
								
									
										
										
										
											2009-07-14 12:36:02 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  };
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-26 16:52:38 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  # 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
							 | 
						
					
						
							
								
									
										
										
										
											2010-11-23 16:07:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  # overrides such as changing GCC throughout the system), and the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  # option nixpkgs.system to override the platform type.  This is
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-26 16:52:38 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  # 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.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  # So we call ourselves here with "pkgs" explicitly set to an
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  # instance that doesn't depend on nixpkgs.config.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								  pkgs =
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    if pkgs_ != null
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    then pkgs_
							 | 
						
					
						
							
								
									
										
										
										
											2013-10-11 13:33:44 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    else import ./nixpkgs.nix (
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-27 18:37:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      let
							 | 
						
					
						
							
								
									
										
										
										
											2010-11-23 16:07:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								        system = if nixpkgsOptions.system != "" then nixpkgsOptions.system else system_;
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-27 18:37:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								        nixpkgsOptions = (import ./eval-config.nix {
							 | 
						
					
						
							
								
									
										
										
										
											2013-11-27 16:54:20 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								          inherit system extraArgs modules prefix;
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-26 16:52:38 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								          # For efficiency, leave out most NixOS modules; they don't
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								          # define nixpkgs.config, so it's pointless to evaluate them.
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-16 16:58:06 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								          baseModules = [ ../modules/misc/nixpkgs.nix ../modules/config/no-x-libs.nix ];
							 | 
						
					
						
							
								
									
										
										
										
											2013-10-11 13:33:44 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								          pkgs = import ./nixpkgs.nix { system = system_; config = {}; };
							 | 
						
					
						
							
								
									
										
										
										
											2013-10-28 15:48:20 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								          check = false;
							 | 
						
					
						
							
								
									
										
										
										
											2013-10-28 00:56:22 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								        }).config.nixpkgs;
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-27 18:37:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      in
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								        inherit system;
							 | 
						
					
						
							
								
									
										
										
										
											2010-09-08 16:52:15 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								        inherit (nixpkgsOptions) config;
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-27 18:37:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								      });
							 | 
						
					
						
							
								
									
										
										
										
											2009-05-27 09:16:56 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								}
							 |