* Store the NixOS version in the top-level derivation.

* Change the name of the top-level derivation from "system" to
  "nixos-<version>".
* Show the NixOS version in the GRUB boot menu instead of the kernel
  version.

svn path=/nixos/trunk/; revision=33785
This commit is contained in:
Eelco Dolstra 2012-04-14 17:09:59 +00:00
parent 91b91cc847
commit e3879fe365
2 changed files with 9 additions and 6 deletions

View File

@ -274,9 +274,10 @@ for generation in $(
| sed 's/system-\([0-9]\+\)-link/\1/' \
| sort -n -r); do
link=/nix/var/nix/profiles/system-$generation-link
date=$(stat --printf="%y\n" $link | sed 's/\..*//')
date=$(stat --printf="%y\n" $link | sed 's/\..*//' | sed 's/ .*//')
kernelVersion=$(cd $(dirname $(readlink -f $link/kernel))/lib/modules && echo *)
addEntry "NixOS - Configuration $generation ($date - $kernelVersion)" $link "$generation ($date)"
nixosVersion=$(if [ -e $link/nixos-version ]; then cat $link/nixos-version; fi)
addEntry "NixOS - Configuration $generation ($date - ${nixosVersion:-$kernelVersion})" $link "$generation ($date)"
done

View File

@ -120,9 +120,10 @@ let
ln -s ${config.system.build.upstart} $out/upstart
ln -s ${config.hardware.firmware} $out/firmware
echo "$kernelParams" > $out/kernel-params
echo "$configurationName" > $out/configuration-name
echo "${toString config.system.build.upstart.interfaceVersion}" > $out/upstart-interface-version
echo -n "$kernelParams" > $out/kernel-params
echo -n "$configurationName" > $out/configuration-name
echo -n "${toString config.system.build.upstart.interfaceVersion}" > $out/upstart-interface-version
echo -n "$nixosVersion" > $out/nixos-version
mkdir $out/fine-tune
childCount=0
@ -145,7 +146,7 @@ let
# script `switch-to-configuration' that activates the configuration
# and makes it bootable.
system = pkgs.stdenv.mkDerivation {
name = "system";
name = "nixos-${config.system.nixosVersion}";
buildCommand = systemBuilder;
inherit children;
kernelParams =
@ -153,6 +154,7 @@ let
menuBuilder = config.system.build.menuBuilder;
initScriptBuilder = config.system.build.initScriptBuilder;
activationScript = config.system.activationScripts.script;
nixosVersion = config.system.nixosVersion;
jobs = map (j: j.name) (attrValues config.jobs);