2009-05-27 11:00:45 +02:00
|
|
|
{pkgs, config, ...}:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2009-05-28 15:36:38 +02:00
|
|
|
options = {
|
|
|
|
|
|
|
|
system.build = pkgs.lib.mkOption {
|
|
|
|
default = {};
|
|
|
|
description = ''
|
|
|
|
Attribute set of derivations used to setup the system.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
nesting.children = pkgs.lib.mkOption {
|
|
|
|
default = [];
|
|
|
|
description = ''
|
|
|
|
Additional configurations to build.
|
|
|
|
'';
|
|
|
|
};
|
Making modular my previous changes for armv5tel. I updated the way to use
grub. Its options are no more inside 'boot', but inside 'boot.loader.grub'.
I added a new bootloader configuration for nixos, generationsDir. It creates
/boot/default/{init,initrd,kernel,system} symlinks, and the same for the generations
in /boot/system-$gen/{init,initrd,kernel,system}.
I can program the u-boot loader to load /boot/default files always, and have
a minimal nixos boot loader installer functionality. Additionally, I can refer
to the other system generations easily, with a simple 'ls' in /boot.
svn path=/nixos/trunk/; revision=17460
2009-09-27 23:51:37 +02:00
|
|
|
|
|
|
|
system.boot.loader.id = pkgs.lib.mkOption {
|
|
|
|
default = "";
|
|
|
|
description = ''
|
|
|
|
Id string of the used bootloader.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
system.boot.loader.kernelFile = pkgs.lib.mkOption {
|
|
|
|
default = "";
|
|
|
|
description = ''
|
|
|
|
Name of the kernel file to be passed to the bootloader.
|
|
|
|
'';
|
|
|
|
};
|
2009-05-28 15:36:38 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-05-27 11:00:45 +02:00
|
|
|
# This attribute is responsible for creating boot entries for
|
|
|
|
# child configuration. They are only (directly) accessible
|
|
|
|
# when the parent configuration is boot default. For example,
|
|
|
|
# you can provide an easy way to boot the same configuration
|
|
|
|
# as you use, but with another kernel
|
|
|
|
# !!! fix this
|
2009-10-30 12:57:23 +01:00
|
|
|
children =
|
|
|
|
map (childConfig:
|
|
|
|
(import ../../../default.nix {
|
|
|
|
configuration =
|
|
|
|
pkgs.lib.recursiveUpdate childConfig {
|
|
|
|
boot.loader.grub.device = "";
|
|
|
|
# undefined the obsolete name of the previous option.
|
|
|
|
boot.grubDevice = pkgs.lib.mkNotdef;
|
|
|
|
};
|
|
|
|
}).system
|
|
|
|
) config.nesting.children;
|
2009-05-27 11:00:45 +02:00
|
|
|
|
|
|
|
|
2009-09-29 11:50:38 +02:00
|
|
|
systemBuilder =
|
|
|
|
let
|
Making modular my previous changes for armv5tel. I updated the way to use
grub. Its options are no more inside 'boot', but inside 'boot.loader.grub'.
I added a new bootloader configuration for nixos, generationsDir. It creates
/boot/default/{init,initrd,kernel,system} symlinks, and the same for the generations
in /boot/system-$gen/{init,initrd,kernel,system}.
I can program the u-boot loader to load /boot/default files always, and have
a minimal nixos boot loader installer functionality. Additionally, I can refer
to the other system generations easily, with a simple 'ls' in /boot.
svn path=/nixos/trunk/; revision=17460
2009-09-27 23:51:37 +02:00
|
|
|
kernelPath = "${config.boot.kernelPackages.kernel}/" +
|
|
|
|
"${config.system.boot.loader.kernelFile}";
|
|
|
|
in
|
|
|
|
''
|
2009-05-27 11:00:45 +02:00
|
|
|
ensureDir $out
|
|
|
|
|
Making modular my previous changes for armv5tel. I updated the way to use
grub. Its options are no more inside 'boot', but inside 'boot.loader.grub'.
I added a new bootloader configuration for nixos, generationsDir. It creates
/boot/default/{init,initrd,kernel,system} symlinks, and the same for the generations
in /boot/system-$gen/{init,initrd,kernel,system}.
I can program the u-boot loader to load /boot/default files always, and have
a minimal nixos boot loader installer functionality. Additionally, I can refer
to the other system generations easily, with a simple 'ls' in /boot.
svn path=/nixos/trunk/; revision=17460
2009-09-27 23:51:37 +02:00
|
|
|
if [ ! -f ${kernelPath} ]; then
|
|
|
|
echo "The bootloader cannot find the proper kernel image."
|
|
|
|
echo "(Expecting ${kernelPath})"
|
|
|
|
fi
|
|
|
|
ln -s ${kernelPath} $out/kernel
|
2009-09-23 22:51:00 +02:00
|
|
|
if [ -n "$grub" ]; then
|
|
|
|
ln -s $grub $out/grub
|
|
|
|
fi
|
2009-05-27 11:00:45 +02:00
|
|
|
ln -s ${config.system.build.bootStage2} $out/init
|
|
|
|
ln -s ${config.system.build.initialRamdisk}/initrd $out/initrd
|
|
|
|
ln -s ${config.system.activationScripts.script} $out/activate
|
|
|
|
ln -s ${config.system.build.etc}/etc $out/etc
|
|
|
|
ln -s ${config.system.path} $out/sw
|
|
|
|
ln -s ${pkgs.upstart} $out/upstart
|
|
|
|
|
|
|
|
echo "$kernelParams" > $out/kernel-params
|
|
|
|
echo "$configurationName" > $out/configuration-name
|
|
|
|
echo "${toString pkgs.upstart.interfaceVersion}" > $out/upstart-interface-version
|
|
|
|
|
|
|
|
mkdir $out/fine-tune
|
|
|
|
childCount=0;
|
|
|
|
for i in $children; do
|
|
|
|
childCount=$(( childCount + 1 ));
|
|
|
|
ln -s $i $out/fine-tune/child-$childCount;
|
|
|
|
done
|
|
|
|
|
|
|
|
ensureDir $out/bin
|
|
|
|
substituteAll ${./switch-to-configuration.sh} $out/bin/switch-to-configuration
|
|
|
|
chmod +x $out/bin/switch-to-configuration
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
|
|
# Putting it all together. This builds a store path containing
|
|
|
|
# symlinks to the various parts of the built configuration (the
|
|
|
|
# kernel, the Upstart services, the init scripts, etc.) as well as a
|
|
|
|
# script `switch-to-configuration' that activates the configuration
|
|
|
|
# and makes it bootable.
|
|
|
|
system = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "system";
|
|
|
|
buildCommand = systemBuilder;
|
|
|
|
inherit children;
|
|
|
|
kernelParams =
|
|
|
|
config.boot.kernelParams ++ config.boot.extraKernelParams;
|
Making modular my previous changes for armv5tel. I updated the way to use
grub. Its options are no more inside 'boot', but inside 'boot.loader.grub'.
I added a new bootloader configuration for nixos, generationsDir. It creates
/boot/default/{init,initrd,kernel,system} symlinks, and the same for the generations
in /boot/system-$gen/{init,initrd,kernel,system}.
I can program the u-boot loader to load /boot/default files always, and have
a minimal nixos boot loader installer functionality. Additionally, I can refer
to the other system generations easily, with a simple 'ls' in /boot.
svn path=/nixos/trunk/; revision=17460
2009-09-27 23:51:37 +02:00
|
|
|
menuBuilder = config.system.build.menuBuilder;
|
2009-05-27 11:00:45 +02:00
|
|
|
# Most of these are needed by grub-install.
|
|
|
|
path = [
|
|
|
|
pkgs.coreutils
|
|
|
|
pkgs.gnused
|
|
|
|
pkgs.gnugrep
|
|
|
|
pkgs.findutils
|
|
|
|
pkgs.diffutils
|
|
|
|
pkgs.upstart # for initctl
|
|
|
|
];
|
Making modular my previous changes for armv5tel. I updated the way to use
grub. Its options are no more inside 'boot', but inside 'boot.loader.grub'.
I added a new bootloader configuration for nixos, generationsDir. It creates
/boot/default/{init,initrd,kernel,system} symlinks, and the same for the generations
in /boot/system-$gen/{init,initrd,kernel,system}.
I can program the u-boot loader to load /boot/default files always, and have
a minimal nixos boot loader installer functionality. Additionally, I can refer
to the other system generations easily, with a simple 'ls' in /boot.
svn path=/nixos/trunk/; revision=17460
2009-09-27 23:51:37 +02:00
|
|
|
|
|
|
|
# Boot loaders
|
|
|
|
bootLoader = config.system.boot.loader.id;
|
2009-10-13 23:39:18 +02:00
|
|
|
grub =
|
|
|
|
if config.boot.loader.grub.enable
|
|
|
|
then (if config.boot.loader.grub.version == 1
|
|
|
|
then pkgs.grub
|
|
|
|
else pkgs.grub2)
|
|
|
|
else null;
|
2009-09-29 11:50:38 +02:00
|
|
|
grubDevice = config.boot.loader.grub.device;
|
Making modular my previous changes for armv5tel. I updated the way to use
grub. Its options are no more inside 'boot', but inside 'boot.loader.grub'.
I added a new bootloader configuration for nixos, generationsDir. It creates
/boot/default/{init,initrd,kernel,system} symlinks, and the same for the generations
in /boot/system-$gen/{init,initrd,kernel,system}.
I can program the u-boot loader to load /boot/default files always, and have
a minimal nixos boot loader installer functionality. Additionally, I can refer
to the other system generations easily, with a simple 'ls' in /boot.
svn path=/nixos/trunk/; revision=17460
2009-09-27 23:51:37 +02:00
|
|
|
configurationName = config.boot.loader.grub.configurationName;
|
2009-05-27 11:00:45 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
in {
|
2009-05-28 15:36:38 +02:00
|
|
|
require = [options];
|
2009-05-27 11:00:45 +02:00
|
|
|
|
2009-09-04 11:29:18 +02:00
|
|
|
system.build.toplevel = system;
|
2009-05-27 11:00:45 +02:00
|
|
|
}
|