From 2892aed71227bc326fc619d03062a6e5a2130880 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 27 Aug 2009 11:57:43 +0000 Subject: [PATCH] * lib/eval-config.nix: combined "configuration" and "extraModules" into one argument "modules". * release.nix: fixed the manual job. * ISO generation: break an infinite recursion. Don't know why this suddenly happens. Probably because of the nixpkgs.config change, but I don't see why. Maybe the option evaluation is too strict. svn path=/nixos/trunk/; revision=16878 --- default.nix | 5 ++--- lib/eval-config.nix | 12 ++++-------- modules/installer/cd-dvd/iso-image.nix | 7 ++++++- modules/system/boot/stage-1-init.sh | 7 ++++--- release.nix | 16 ++++++++++------ 5 files changed, 26 insertions(+), 21 deletions(-) diff --git a/default.nix b/default.nix index 863a8339f122..28049ebd146a 100644 --- a/default.nix +++ b/default.nix @@ -3,13 +3,12 @@ let - eval = import ./lib/eval-config.nix {inherit configuration;}; + eval = import ./lib/eval-config.nix { modules = [ configuration ]; }; inherit (eval) config pkgs; vmConfig = (import ./lib/eval-config.nix { - inherit configuration; - extraModules = [./modules/virtualisation/qemu-vm.nix]; + modules = [ configuration ./modules/virtualisation/qemu-vm.nix ]; }).config; in diff --git a/lib/eval-config.nix b/lib/eval-config.nix index 653a260fb9bf..dd23867ef0d4 100644 --- a/lib/eval-config.nix +++ b/lib/eval-config.nix @@ -2,13 +2,12 @@ # configuration object (`config') from which we can retrieve option # values. -{ configuration -, system ? builtins.currentSystem +{ system ? builtins.currentSystem , nixpkgs ? import ./from-env.nix "NIXPKGS" /etc/nixos/nixpkgs , pkgs ? null , baseModules ? import ../modules/module-list.nix , extraArgs ? {} -, extraModules ? [] +, modules }: let extraArgs_ = extraArgs; pkgs_ = pkgs; in @@ -16,10 +15,7 @@ let extraArgs_ = extraArgs; pkgs_ = pkgs; in rec { # These are the NixOS modules that constitute the system configuration. - configComponents = - [ configuration ] - ++ extraModules - ++ baseModules; + configComponents = modules ++ baseModules; # Merge the option definitions in all modules, forming the full # system configuration. This is called "configFast" because it's @@ -50,7 +46,7 @@ rec { inherit system; config = (import ./eval-config.nix { - inherit configuration system nixpkgs extraArgs extraModules; + inherit system nixpkgs 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 ]; diff --git a/modules/installer/cd-dvd/iso-image.nix b/modules/installer/cd-dvd/iso-image.nix index a3bd94805dca..3b26628148fc 100644 --- a/modules/installer/cd-dvd/iso-image.nix +++ b/modules/installer/cd-dvd/iso-image.nix @@ -140,6 +140,11 @@ in "ln -s ${config.system.build.system} $out"; target = "/system"; } + { # Idem for the stage-2 init script. + source = pkgs.runCommand "system" {} + "ln -s ${config.system.build.bootStage2} $out"; + target = "/init"; + } ]; # The Grub menu. @@ -150,7 +155,7 @@ in chainloader +1 title NixOS Installer / Rescue - kernel /boot/vmlinuz init=${config.system.build.bootStage2} systemConfig=/system ${toString config.boot.kernelParams} + kernel /boot/vmlinuz init=/init systemConfig=/system ${toString config.boot.kernelParams} initrd /boot/initrd ''; diff --git a/modules/system/boot/stage-1-init.sh b/modules/system/boot/stage-1-init.sh index 121605ab479f..5c3ad57af659 100644 --- a/modules/system/boot/stage-1-init.sh +++ b/modules/system/boot/stage-1-init.sh @@ -63,7 +63,7 @@ mount -t sysfs none /sys # Process the kernel command line. -stage2Init=/init +export stage2Init=/init for o in $(cat /proc/cmdline); do case $o in init=*) @@ -297,8 +297,9 @@ fi # Start stage 2. `run-init' deletes all files in the ramfs on the -# current /. -if test -z "$stage2Init" -o ! -e "$targetRoot/$stage2Init"; then +# current /. Note that $stage2Init might be an absolute symlink, in +# which case "-e" won't work because we're not in the chroot yet. +if ! test -e "$targetRoot/$stage2Init" -o -L "$targetRoot/$stage2Init"; then echo "stage 2 init script not found" fail fi diff --git a/release.nix b/release.nix index 17e34f42fb41..abf1ed956698 100644 --- a/release.nix +++ b/release.nix @@ -1,4 +1,4 @@ -{ nixpkgs ? ../nixpkgs-wc }: +{ nixpkgs ? ../nixpkgs }: let @@ -16,12 +16,11 @@ let version = builtins.readFile ./VERSION + (if officialRelease then "" else "pre${toString nixosSrc.rev}"); + versionModule = { system.nixosVersion = version; }; + iso = (import lib/eval-config.nix { - inherit system nixpkgs; - configuration = - { require = module; - system.nixosVersion = version; - }; + inherit system nixpkgs; + modules = [ module versionModule ]; }).config.system.build.isoImage; in @@ -75,6 +74,11 @@ let import "${nixosSrc}/doc/manual" { pkgs = import nixpkgs {}; + optionDeclarations = + (import lib/eval-config.nix { + inherit nixpkgs; + modules = [ ]; + }).optionDeclarations; };