2009-05-27 05:16:56 -04:00
|
|
|
|
# From an end-user configuration file (`configuration'), build a NixOS
|
|
|
|
|
# configuration object (`config') from which we can retrieve option
|
|
|
|
|
# values.
|
|
|
|
|
|
2009-08-27 07:57:43 -04:00
|
|
|
|
{ system ? builtins.currentSystem
|
2009-08-26 12:52:38 -04:00
|
|
|
|
, pkgs ? null
|
|
|
|
|
, baseModules ? import ../modules/module-list.nix
|
2009-08-05 10:43:13 -04:00
|
|
|
|
, extraArgs ? {}
|
2009-08-27 07:57:43 -04:00
|
|
|
|
, modules
|
2013-10-28 10:48:20 -04:00
|
|
|
|
, check ? true
|
2013-11-27 10:54:20 -05:00
|
|
|
|
, prefix ? []
|
2014-05-05 15:52:33 -04:00
|
|
|
|
, lib ? import ../../lib
|
2009-06-05 09:19:39 -04:00
|
|
|
|
}:
|
2009-05-27 05:16:56 -04:00
|
|
|
|
|
2014-12-16 11:07:14 -05: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))];
|
2014-05-05 15:52:33 -04:00
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
let
|
|
|
|
|
pkgsModule = rec {
|
|
|
|
|
_file = ./eval-config.nix;
|
|
|
|
|
key = _file;
|
|
|
|
|
config = {
|
|
|
|
|
nixpkgs.system = lib.mkDefault system_;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2014-12-16 11:07:14 -05:00
|
|
|
|
in rec {
|
2009-06-05 09:19:39 -04:00
|
|
|
|
|
2009-08-26 12:52:38 -04:00
|
|
|
|
# Merge the option definitions in all modules, forming the full
|
2013-10-28 10:48:20 -04:00
|
|
|
|
# system configuration.
|
2014-05-05 15:52:33 -04:00
|
|
|
|
inherit (lib.evalModules {
|
2013-11-27 10:54:20 -05:00
|
|
|
|
inherit prefix;
|
2014-05-05 15:52:33 -04:00
|
|
|
|
modules = modules ++ extraModules ++ baseModules ++ [ pkgsModule ];
|
2013-10-28 17:43:29 -04:00
|
|
|
|
args = extraArgs;
|
2013-10-29 11:14:58 -04:00
|
|
|
|
check = check && options.environment.checkConfigurationOptions.value;
|
2013-10-28 17:43:29 -04:00
|
|
|
|
}) config options;
|
2009-08-26 12:52:38 -04:00
|
|
|
|
|
|
|
|
|
# These are the extra arguments passed to every module. In
|
|
|
|
|
# particular, Nixpkgs is passed through the "pkgs" argument.
|
2014-04-08 18:09:31 -04: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 10:43:13 -04:00
|
|
|
|
extraArgs = extraArgs_ // {
|
2010-05-08 13:18:26 -04:00
|
|
|
|
inherit pkgs modules baseModules;
|
2009-07-14 08:36:02 -04:00
|
|
|
|
modulesPath = ../modules;
|
2014-04-08 18:09:31 -04: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 08:36:02 -04:00
|
|
|
|
};
|
|
|
|
|
|
2009-08-26 12:52:38 -04:00
|
|
|
|
pkgs =
|
|
|
|
|
if pkgs_ != null
|
|
|
|
|
then pkgs_
|
2013-10-11 07:33:44 -04:00
|
|
|
|
else import ./nixpkgs.nix (
|
2010-02-27 13:37:12 -05:00
|
|
|
|
let
|
2010-11-23 11:07:00 -05:00
|
|
|
|
system = if nixpkgsOptions.system != "" then nixpkgsOptions.system else system_;
|
2014-05-05 15:52:33 -04:00
|
|
|
|
nixpkgsOptions = config.nixpkgs;
|
2010-02-27 13:37:12 -05:00
|
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
inherit system;
|
2010-09-08 12:52:15 -04:00
|
|
|
|
inherit (nixpkgsOptions) config;
|
2010-02-27 13:37:12 -05:00
|
|
|
|
});
|
2009-05-27 05:16:56 -04:00
|
|
|
|
|
|
|
|
|
}
|