Change the policy used to select files added in the import list of the

generated configuration.  Use all files listed as modules of eval-config.

svn path=/nixos/trunk/; revision=23914
This commit is contained in:
Nicolas Pierron 2010-09-25 09:32:52 +00:00
parent d2d139e920
commit 59429aa449
2 changed files with 46 additions and 28 deletions

View File

@ -7,21 +7,6 @@ with pkgs.lib;
let let
options = {
# you can retrieve the profiles which have been used by looking at the
# list of modules use to configure the installation device.
installer.configModule = mkOption {
example = "./nixos/modules/installer/cd-dvd/installation-cd.nix";
description = ''
Filename of the configuration module that builds the CD
configuration. Must be specified to support reconfiguration
in live CDs.
'';
};
};
# We need a copy of the Nix expressions for Nixpkgs and NixOS on the # We need a copy of the Nix expressions for Nixpkgs and NixOS on the
# CD. We put them in a tarball because accessing that many small # CD. We put them in a tarball because accessing that many small
# files from a slow device like a CD-ROM takes too long. !!! Once # files from a slow device like a CD-ROM takes too long. !!! Once
@ -45,8 +30,7 @@ in
{ {
require = require =
[ options [ ./memtest.nix
./memtest.nix
./iso-image.nix ./iso-image.nix
# Profiles of this basic installation CD. # Profiles of this basic installation CD.

View File

@ -1,21 +1,40 @@
{config, pkgs, ...}: # Provide a basic cponfiguration for installation devices like CDs.
{config, pkgs, modules, ...}:
with pkgs.lib; with pkgs.lib;
let let
# Location of the repository on the harddrive # Location of the repository on the harddrive
profilePath = toString ./.; nixosPath = toString ../../.;
# Check if the path is from the NixOS repository # Check if the path is from the NixOS repository
isProfile = path: isNixOSFile = path:
let s = toString path; in let s = toString path; in
removePrefix profilePath s != s; removePrefix nixosPath s != s;
# Rename NixOS modules used to setup the current device to make findable form # Copy modules given as extra configuration files. Unfortunately, we
# the default location of the configuration.nix file. # cannot serialized attribute set given in the list of modules (that's why
getProfileModules = # you should use files).
map (path: "./nixos/modules/profiles" + removePrefix isProfile (toString path)) moduleFiles =
filter (m: isPath m && isProfile m) modules; filter isPath modules;
# Partition module files because between NixOS and non-NixOS files. NixOS
# files may change if the repository is updated.
partitionnedModuleFiles =
let p = partition isNixOSFile moduleFiles; in
{ nixos = p.right; others = p.wrong; };
# Path transformed to be valid on the installation device. Thus the
# device configuration could be rebuild.
relocatedModuleFiles =
let
relocateNixOS = path:
"/etc/nixos/nixos" + removePrefix nixosPath (toString path);
relocateOthers = null;
in
{ nixos = map relocateNixOS partitionnedModuleFiles.nixos;
others = []; # TODO: copy the modules to the install-device repository.
};
# A dummy /etc/nixos/configuration.nix in the booted CD that # A dummy /etc/nixos/configuration.nix in the booted CD that
# rebuilds the CD's configuration (and allows the configuration to # rebuilds the CD's configuration (and allows the configuration to
@ -28,7 +47,9 @@ let
{config, pkgs, ...}: {config, pkgs, ...}:
{ {
require = [${toString config.installer.cloneConfigIncludes}]; require = [
${toString config.installer.cloneConfigIncludes}
];
# Add your own options below and run "nixos-rebuild switch". # Add your own options below and run "nixos-rebuild switch".
# E.g., # E.g.,
@ -61,10 +82,23 @@ in
List of modules used to re-build this installation device profile. List of modules used to re-build this installation device profile.
''; '';
}; };
# Ignored. Kept for Backward compatibiliy.
# you can retrieve the profiles which have been used by looking at the
# list of modules use to configure the installation device.
installer.configModule = mkOption {
example = "./nixos/modules/installer/cd-dvd/installation-cd.nix";
description = ''
Filename of the configuration module that builds the CD
configuration. Must be specified to support reconfiguration
in live CDs.
'';
};
}; };
config = { config = {
installer.cloneConfigIncludes = getProfileModules; installer.cloneConfigIncludes =
relocatedModuleFiles.nixos ++ relocatedModuleFiles.others;
# Show the manual. # Show the manual.
services.nixosManual.showManual = true; services.nixosManual.showManual = true;