* Make eval-config.nix a bit more general to make it easier to build
other kinds of configurations (like the installation CD). svn path=/nixos/branches/modular-nixos/; revision=15864
This commit is contained in:
parent
dc8cbffe31
commit
02d26fc77d
23
default.nix
23
default.nix
@ -1,27 +1,16 @@
|
|||||||
|
{ configuration ? import (import ./lib/from-env.nix "NIXOS_CONFIG" /etc/nixos/configuration.nix)
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
fromEnv = name: default:
|
|
||||||
let env = builtins.getEnv name; in
|
|
||||||
if env == "" then default else env;
|
|
||||||
|
|
||||||
configuration = import (fromEnv "NIXOS_CONFIG" /etc/nixos/configuration.nix);
|
|
||||||
|
|
||||||
nixpkgs = fromEnv "NIXPKGS" /etc/nixos/nixpkgs;
|
|
||||||
|
|
||||||
pkgs = import nixpkgs {system = builtins.currentSystem;};
|
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
(import ./lib/eval-config.nix {inherit configuration pkgs;})
|
(import ./lib/eval-config.nix {inherit configuration;})
|
||||||
config optionDeclarations;
|
config optionDeclarations pkgs;
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
# Optionally check wether all config values have corresponding
|
system = config.system.build.system;
|
||||||
# option declarations.
|
|
||||||
system = pkgs.checker config.system.build.system
|
|
||||||
config.environment.checkConfigurationOptions
|
|
||||||
optionDeclarations config;
|
|
||||||
|
|
||||||
# The following are used by nixos-rebuild.
|
# The following are used by nixos-rebuild.
|
||||||
nixFallback = pkgs.nixUnstable;
|
nixFallback = pkgs.nixUnstable;
|
||||||
|
@ -2,9 +2,15 @@
|
|||||||
# configuration object (`config') from which we can retrieve option
|
# configuration object (`config') from which we can retrieve option
|
||||||
# values.
|
# values.
|
||||||
|
|
||||||
{configuration, pkgs}:
|
{ configuration
|
||||||
|
, system ? builtins.currentSystem
|
||||||
|
, nixpkgs ? import ./from-env.nix "NIXPKGS" /etc/nixos/nixpkgs
|
||||||
|
, pkgs ? import nixpkgs {inherit system;}
|
||||||
|
}:
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
|
inherit nixpkgs pkgs;
|
||||||
|
|
||||||
configComponents = [
|
configComponents = [
|
||||||
configuration
|
configuration
|
||||||
{
|
{
|
||||||
@ -19,7 +25,7 @@ rec {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
config =
|
config_ =
|
||||||
pkgs.lib.fixOptionSets
|
pkgs.lib.fixOptionSets
|
||||||
pkgs.lib.mergeOptionSets
|
pkgs.lib.mergeOptionSets
|
||||||
pkgs configComponents;
|
pkgs configComponents;
|
||||||
@ -28,5 +34,11 @@ rec {
|
|||||||
pkgs.lib.fixOptionSetsFun
|
pkgs.lib.fixOptionSetsFun
|
||||||
pkgs.lib.filterOptionSets
|
pkgs.lib.filterOptionSets
|
||||||
pkgs configComponents
|
pkgs configComponents
|
||||||
config;
|
config_;
|
||||||
|
|
||||||
|
# Optionally check wether all config values have corresponding
|
||||||
|
# option declarations.
|
||||||
|
config = pkgs.checker config_
|
||||||
|
config_.environment.checkConfigurationOptions
|
||||||
|
optionDeclarations config_;
|
||||||
}
|
}
|
||||||
|
3
lib/from-env.nix
Normal file
3
lib/from-env.nix
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
name: default:
|
||||||
|
let value = builtins.getEnv name; in
|
||||||
|
if value == "" then default else value
|
Loading…
x
Reference in New Issue
Block a user