release.nix: Generate a VirtualBox image

This commit is contained in:
Eelco Dolstra 2013-07-02 00:23:48 +02:00
parent db17b68d81
commit 1a2e4f37d0
3 changed files with 41 additions and 4 deletions

View File

@ -0,0 +1,5 @@
{ config, pkgs, modulesPath, ... }:
{
require = [ "${modulesPath}/virtualisation/virtualbox-image.nix" ];
}

View File

@ -61,7 +61,7 @@ with pkgs.lib;
# Install a configuration.nix.
mkdir -p /mnt/etc/nixos
cp ${./nova-config.nix} /mnt/etc/nixos/configuration.nix
cp ${./virtualbox-config.nix} /mnt/etc/nixos/configuration.nix
# `switch-to-configuration' requires a /bin/sh
mkdir -p /mnt/bin

View File

@ -43,7 +43,7 @@ let
passthru = { inherit config; };
}
''
ensureDir $out/nix-support
mkdir -p $out/nix-support
echo "file iso" $iso/iso/*.iso* >> $out/nix-support/hydra-build-products
''; # */
@ -86,7 +86,7 @@ in {
distPhase = ''
echo -n $VERSION_SUFFIX > .version-suffix
releaseName=nixos-$VERSION$VERSION_SUFFIX
ensureDir "$out/tarballs"
mkdir -p $out/tarballs
mkdir ../$releaseName
cp -prd . ../$releaseName
cd ..
@ -112,7 +112,7 @@ in {
distPhase = ''
echo -n $VERSION_SUFFIX > .version-suffix
releaseName=nixos-$VERSION$VERSION_SUFFIX
ensureDir "$out/tarballs"
mkdir -p $out/tarballs
mkdir ../$releaseName
cp -prd . ../$releaseName/nixos
cp -prd ${nixpkgs} ../$releaseName/nixpkgs
@ -175,6 +175,38 @@ in {
});
# A bootable VirtualBox image. FIXME: generate a OVF appliance?
vdi.x86_64-linux =
with import <nixpkgs> { system = "x86_64-linux"; };
let
config = (import lib/eval-config.nix {
inherit system;
modules =
[ ./modules/virtualisation/virtualbox-image.nix
./modules/installer/cd-dvd/channel.nix
./modules/profiles/graphical.nix
];
}).config;
in
# Declare the VDI as a build product so that it shows up in Hydra.
runCommand "nixos-vdi-${config.system.nixosVersion}"
{ meta = {
description = "NixOS VirtualBox disk image (64-bit)";
maintainers = lib.maintainers.eelco;
};
vdi = config.system.build.virtualBoxImage;
}
''
mkdir -p $out/nix-support
fn=$out/nixos-${config.system.nixosVersion}.vdi.xz
xz < $vdi/*.vdi > $fn
echo "file vdi $fn" >> $out/nix-support/hydra-build-products
''; # */
# Provide a tarball that can be unpacked into an SD card, and easily
# boot that system from uboot (like for the sheevaplug).
# The pc variant helps preparing the expression for the system tarball