Merge branch 'master' of github.com:NixOS/nixos into systemd

This commit is contained in:
Eelco Dolstra 2012-08-20 11:27:38 -04:00
commit 08f14b33c1
30 changed files with 305 additions and 107 deletions

View File

@ -1,4 +1,4 @@
{ system }: { system, minimal ? false }:
let pkgs = import <nixpkgs> { config = {}; inherit system; }; in let pkgs = import <nixpkgs> { config = {}; inherit system; }; in
@ -27,7 +27,7 @@ rec {
[ ../modules/virtualisation/qemu-vm.nix [ ../modules/virtualisation/qemu-vm.nix
../modules/testing/test-instrumentation.nix # !!! should only get added for automated test runs ../modules/testing/test-instrumentation.nix # !!! should only get added for automated test runs
{ key = "no-manual"; services.nixosManual.enable = false; } { key = "no-manual"; services.nixosManual.enable = false; }
]; ] ++ lib.optional minimal ../modules/testing/minimal-kernel.nix;
extraArgs = { inherit nodes; }; extraArgs = { inherit nodes; };
}; };

View File

@ -8,10 +8,13 @@ use POSIX qw(dup2);
use FileHandle; use FileHandle;
use Cwd; use Cwd;
use File::Basename; use File::Basename;
use File::Path qw(make_path);
my $showGraphics = defined $ENV{'DISPLAY'}; my $showGraphics = defined $ENV{'DISPLAY'};
my $sharedDir;
sub new { sub new {
my ($class, $args) = @_; my ($class, $args) = @_;
@ -40,7 +43,11 @@ sub new {
} }
my $tmpDir = $ENV{'TMPDIR'} || "/tmp"; my $tmpDir = $ENV{'TMPDIR'} || "/tmp";
unless (defined $sharedDir) {
$sharedDir = $tmpDir . "/xchg-shared";
make_path($sharedDir, { mode => 0700, owner => $< });
}
my $self = { my $self = {
startCommand => $startCommand, startCommand => $startCommand,
name => $name, name => $name,
@ -126,6 +133,7 @@ sub start {
dup2(fileno($serialC), fileno(STDERR)); dup2(fileno($serialC), fileno(STDERR));
} }
$ENV{TMPDIR} = $self->{stateDir}; $ENV{TMPDIR} = $self->{stateDir};
$ENV{SHARED_DIR} = $sharedDir;
$ENV{USE_TMPDIR} = 1; $ENV{USE_TMPDIR} = 1;
$ENV{QEMU_OPTS} = $ENV{QEMU_OPTS} =
"-no-reboot -monitor unix:./monitor -chardev socket,id=shell,path=./shell " . "-no-reboot -monitor unix:./monitor -chardev socket,id=shell,path=./shell " .

View File

@ -1,6 +1,6 @@
{ system }: { system, minimal ? false }:
with import ./build-vms.nix { inherit system; }; with import ./build-vms.nix { inherit system minimal; };
with pkgs; with pkgs;
rec { rec {

View File

@ -73,4 +73,10 @@ with pkgs.lib;
}; };
config = mkIf ((length config.swapDevices) != 0) {
system.requiredKernelConfig = with config.lib.kernelConfig; [
(isYes "SWAP")
];
};
} }

View File

@ -266,15 +266,11 @@ in
oldIFS="$IFS"; IFS=:; set -- $curEnt; IFS="$oldIFS" oldIFS="$IFS"; IFS=:; set -- $curEnt; IFS="$oldIFS"
prevUid=$3 prevUid=$3
prevHome=$6 prevHome=$6
# Don't change the UID if it's the same, otherwise usermod
# will complain.
if test "$prevUid" = "$uid"; then unset uid; fi
# Don't change the home directory if it's the same to prevent # Don't change the home directory if it's the same to prevent
# unnecessary warnings about logged in users. # unnecessary warnings about logged in users.
if test "$prevHome" = "$home"; then unset home; fi if test "$prevHome" = "$home"; then unset home; fi
usermod \ usermod \
--comment "$description" \ --comment "$description" \
''${uid:+--uid $uid} \
--gid "$group" \ --gid "$group" \
--groups "$extraGroups" \ --groups "$extraGroups" \
''${home:+--home "$home"} \ ''${home:+--home "$home"} \
@ -297,13 +293,6 @@ in
groupadd --system \ groupadd --system \
''${gid:+--gid $gid} \ ''${gid:+--gid $gid} \
"$name" "$name"
else
#echo "updating group $name..."
oldIFS="$IFS"; IFS=:; set -- $curEnt; IFS="$oldIFS"
prevGid=$3
if test -n "$gid" -a "$prevGid" != "$gid"; then
groupmod --gid $gid "$name"
fi
fi fi
} }

View File

@ -6,7 +6,7 @@
options = { options = {
networking.enableRT73Firmware = pkgs.lib.mkOption { networking.enableRalinkFirmware = pkgs.lib.mkOption {
default = false; default = false;
type = pkgs.lib.types.bool; type = pkgs.lib.types.bool;
description = '' description = ''
@ -19,8 +19,8 @@
###### implementation ###### implementation
config = pkgs.lib.mkIf config.networking.enableRT73Firmware { config = pkgs.lib.mkIf config.networking.enableRalinkFirmware {
hardware.firmware = [ pkgs.rt73fw ]; hardware.firmware = [ pkgs.ralink_fw ];
}; };
} }

View File

@ -128,7 +128,7 @@ in
''; '';
# Include the firmware for various wireless cards. # Include the firmware for various wireless cards.
networking.enableRT73Firmware = true; networking.enableRalinkFirmware = true;
networking.enableIntel2200BGFirmware = true; networking.enableIntel2200BGFirmware = true;
# To speed up further installation of packages, include the complete stdenv # To speed up further installation of packages, include the complete stdenv

View File

@ -152,7 +152,7 @@ in
services.nixosManual.enable = false; services.nixosManual.enable = false;
# Include the firmware for various wireless cards. # Include the firmware for various wireless cards.
networking.enableRT73Firmware = true; networking.enableRalinkFirmware = true;
networking.enableIntel2200BGFirmware = true; networking.enableIntel2200BGFirmware = true;
# To speed up further installation of packages, include the complete stdenv # To speed up further installation of packages, include the complete stdenv

View File

@ -19,6 +19,6 @@ with pkgs.lib;
config = mkDefault { config = mkDefault {
# That wireless card firmware not enabled because the corresponding # That wireless card firmware not enabled because the corresponding
# build expression 'rt73fw' is broken. # build expression 'rt73fw' is broken.
networking.enableRT73Firmware = false; networking.enableRalinkFirmware = false;
}; };
} }

View File

@ -72,6 +72,7 @@ in
clamav = 51; clamav = 51;
fprot = 52; fprot = 52;
bind = 53; bind = 53;
wwwrun = 54;
# When adding a uid, make sure it doesn't match an existing gid. # When adding a uid, make sure it doesn't match an existing gid.
@ -123,6 +124,7 @@ in
mpd = 50; mpd = 50;
clamav = 51; clamav = 51;
fprot = 52; fprot = 52;
wwwrun = 54;
adm = 55; adm = 55;
# When adding a gid, make sure it doesn't match an existing uid. # When adding a gid, make sure it doesn't match an existing uid.

View File

@ -20,7 +20,7 @@
./hardware/network/intel-2100bg.nix ./hardware/network/intel-2100bg.nix
./hardware/network/intel-2200bg.nix ./hardware/network/intel-2200bg.nix
./hardware/network/intel-3945abg.nix ./hardware/network/intel-3945abg.nix
./hardware/network/rt73.nix ./hardware/network/ralink.nix
./hardware/network/rtl8192c.nix ./hardware/network/rtl8192c.nix
./hardware/pcmcia.nix ./hardware/pcmcia.nix
./installer/tools/nixos-checkout.nix ./installer/tools/nixos-checkout.nix
@ -85,6 +85,7 @@
./services/mail/freepops.nix ./services/mail/freepops.nix
./services/mail/mail.nix ./services/mail/mail.nix
./services/mail/postfix.nix ./services/mail/postfix.nix
./services/mail/spamassassin.nix
./services/misc/autofs.nix ./services/misc/autofs.nix
./services/misc/disnix.nix ./services/misc/disnix.nix
./services/misc/felix.nix ./services/misc/felix.nix

View File

@ -31,13 +31,9 @@ fi
# programmable completion. If we do, and if the current user has # programmable completion. If we do, and if the current user has
# installed the package 'bash-completion' in her $HOME/.nix-profile, # installed the package 'bash-completion' in her $HOME/.nix-profile,
# then completion is enabled automatically. # then completion is enabled automatically.
if [ -f "$HOME/.nix-profile/etc/bash_completion" ]; then if [ -f "$HOME/.nix-profile/etc/profile.d/bash_completion.sh" ]; then
if [ -d "$HOME/.nix-profile/etc/bash_completion.d" ]; then if shopt -q progcomp &>/dev/null; then
if shopt -q progcomp &>/dev/null; then . "$HOME/.nix-profile/etc/profile.d/bash_completion.sh"
BASH_COMPLETION_DIR="$HOME/.nix-profile/etc/bash_completion.d"
BASH_COMPLETION="$HOME/.nix-profile/etc/bash_completion"
. "$BASH_COMPLETION"
fi
fi fi
fi fi

View File

@ -69,6 +69,7 @@ in zipModules ([]
++ rename obsolete "security.extraSetuidPrograms" "security.setuidPrograms" ++ rename obsolete "security.extraSetuidPrograms" "security.setuidPrograms"
++ rename obsolete "networking.enableWLAN" "networking.wireless.enable" ++ rename obsolete "networking.enableWLAN" "networking.wireless.enable"
++ rename obsolete "networking.enableRT73Firmware" "networking.enableRalinkFirmware"
# Old Grub-related options. # Old Grub-related options.
++ rename obsolete "boot.copyKernels" "boot.loader.grub.copyKernels" ++ rename obsolete "boot.copyKernels" "boot.loader.grub.copyKernels"

View File

@ -25,6 +25,15 @@ in
''; '';
}; };
security.sudo.wheelNeedsPassword = mkOption {
default = true;
description =
''
Whether users of the <code>wheel</code> group can execute
commands as super user without entering a password.
'';
};
security.sudo.configFile = mkOption { security.sudo.configFile = mkOption {
# Note: if syntax errors are detected in this file, the NixOS # Note: if syntax errors are detected in this file, the NixOS
# configuration will fail to build. # configuration will fail to build.
@ -45,7 +54,7 @@ in
root ALL=(ALL) SETENV: ALL root ALL=(ALL) SETENV: ALL
# Users in the "wheel" group can do anything. # Users in the "wheel" group can do anything.
%wheel ALL=(ALL) SETENV: ALL %wheel ALL=(ALL) ${if cfg.wheelNeedsPassword then "" else "NOPASSWD: ALL, "}SETENV: ALL
''; '';
description = description =
'' ''

View File

@ -20,7 +20,7 @@ let
''; '';
}; };
postgresql = postgresqlAndPlugins pkgs.postgresql; postgresql = postgresqlAndPlugins cfg.package;
run = "su -s ${pkgs.stdenv.shell} postgres"; run = "su -s ${pkgs.stdenv.shell} postgres";
@ -54,6 +54,13 @@ in
''; '';
}; };
package = mkOption {
default = pkgs.postgresql;
description = ''
PostgreSQL package to use.
'';
};
port = mkOption { port = mkOption {
default = "5432"; default = "5432";
description = '' description = ''

View File

@ -195,6 +195,11 @@ in
} }
]; ];
system.requiredKernelConfig = with config.lib.kernelConfig; [
(isEnabled "UNIX")
(isYes "INOTIFY_USER")
(isYes "NET")
];
}; };
} }

View File

@ -0,0 +1,45 @@
{ config, pkgs, ... }:
with pkgs.lib;
let
cfg = config.services.spamassassin;
in
{
###### interface
options = {
services.spamassassin = {
enable = mkOption {
default = false;
description = "Whether to run the SpamAssassin daemon.";
};
};
};
###### implementation
config = mkIf cfg.enable {
# Allow users to run 'spamc'.
environment.systemPackages = [ pkgs.spamassassin ];
jobs.spamd = {
description = "Spam Assassin Server";
startOn = "started networking and filesystem";
environment.TZ = config.time.timeZone;
exec = "${pkgs.spamassassin}/bin/spamd -C /etc/spamassassin/init.pre --siteconfigpath=/etc/spamassassin --debug --pidfile=/var/run/spamd.pid";
};
};
}

View File

@ -557,14 +557,16 @@ in
config = mkIf config.services.httpd.enable { config = mkIf config.services.httpd.enable {
users.extraUsers = singleton users.extraUsers = optionalAttrs (mainCfg.user == "wwwrun") singleton
{ name = mainCfg.user; { name = "wwwrun";
group = mainCfg.group; group = "wwwrun";
description = "Apache httpd user"; description = "Apache httpd user";
uid = config.ids.uids.wwwrun;
}; };
users.extraGroups = singleton users.extraGroups = optionalAttrs (mainCfg.group == "wwwrun") singleton
{ name = mainCfg.group; { name = "wwwrun";
gid = config.ids.gids.wwwrun;
}; };
environment.systemPackages = [httpd] ++ concatMap (svc: svc.extraPath) allSubservices; environment.systemPackages = [httpd] ++ concatMap (svc: svc.extraPath) allSubservices;

View File

@ -37,6 +37,7 @@ let
system.boot.loader.kernelFile = mkOption { system.boot.loader.kernelFile = mkOption {
default = pkgs.stdenv.platform.kernelTarget; default = pkgs.stdenv.platform.kernelTarget;
type = types.uniq types.string;
description = '' description = ''
Name of the kernel file to be passed to the bootloader. Name of the kernel file to be passed to the bootloader.
''; '';

View File

@ -108,6 +108,24 @@ let kernel = config.boot.kernelPackages.kernel; in
apply = pkgs.aggregateModules; apply = pkgs.aggregateModules;
}; };
system.requiredKernelConfig = mkOption {
default = [];
example = literalExample ''
with config.lib.kernelConfig; [
(isYes "MODULES")
(isEnabled "FB_CON_DECOR")
(isEnabled "BLK_DEV_INITRD")
]
'';
internal = true;
type = types.listOf types.attrs;
description = ''
This option allows modules to specify the kernel config options that
must be set (or unset) for the module to work. Please use the
lib.kernelConfig functions to build list elements.
'';
};
}; };
@ -185,6 +203,54 @@ let kernel = config.boot.kernelPackages.kernel; in
''; '';
}; };
lib.kernelConfig = {
isYes = option: {
assertion = config: config.isYes option;
message = "CONFIG_${option} is not yes!";
configLine = "CONFIG_${option}=y";
};
isNo = option: {
assertion = config: config.isNo option;
message = "CONFIG_${option} is not no!";
configLine = "CONFIG_${option}=n";
};
isModule = option: {
assertion = config: config.isModule option;
message = "CONFIG_${option} is not built as a module!";
configLine = "CONFIG_${option}=m";
};
### Usually you will just want to use these two
# True if yes or module
isEnabled = option: {
assertion = config: config.isEnabled option;
message = "CONFIG_${option} is not enabled!";
configLine = "CONFIG_${option}=y";
};
# True if no or omitted
isDisabled = option: {
assertion = config: config.isDisabled option;
message = "CONFIG_${option} is not disabled!";
configLine = "CONFIG_${option}=n";
};
};
# The config options that all modules can depend upon
system.requiredKernelConfig = with config.lib.kernelConfig; [
# !!! Should this really be needed?
(isYes "MODULES")
(isYes "BINFMT_ELF")
];
# nixpkgs kernels are assumed to have all required features
assertions = if config.boot.kernelPackages.kernel ? features then [] else
let cfg = config.boot.kernelPackages.kernel.config; in map (attrs:
{ assertion = attrs.assertion cfg; inherit (attrs) message; }
) config.system.requiredKernelConfig;
}; };
} }

View File

@ -1,9 +1,42 @@
{pkgs, config, ...}: {pkgs, config, ...}:
###### interface with pkgs.lib;
let
inherit (pkgs.lib) mkOption mkIf;
let
efiBootStubBuilder = pkgs.substituteAll {
src = ./efi-boot-stub-builder.sh;
isExecutable = true;
inherit (pkgs) bash;
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.glibc] ++ (pkgs.stdenv.lib.optionals config.boot.loader.efiBootStub.runEfibootmgr [pkgs.efibootmgr pkgs.module_init_tools]);
inherit (config.boot.loader.efiBootStub) efiSysMountPoint runEfibootmgr installStartupNsh efiDisk efiPartition;
efiShell = if config.boot.loader.efiBootStub.installShell then
if pkgs.stdenv.isi686 then
pkgs.fetchurl {
url = "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/Ia32/Shell_Full.efi";
sha256 = "1gv6kyaspczdp7x8qnx5x76ilriaygkfs99ay7ihhdi6riclkhfl";
}
else
pkgs.fetchurl {
url = "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi";
sha256 = "1g18z84rlavxr5gsrh2g942rfr6znv9fs3fqww5m7dhmnysgyv8p";
}
else
null;
kernelFile = platform.kernelTarget;
targetArch = if pkgs.stdenv.isi686 then
"IA32"
else if pkgs.stdenv.isx86_64 then
"X64"
else
throw "Unsupported architecture";
};
# Temporary check, for nixos to cope both with nixpkgs stdenv-updates and trunk
platform = pkgs.stdenv.platform;
in
{
options = { options = {
boot = { boot = {
loader = { loader = {
@ -75,56 +108,17 @@ let
}; };
}; };
in config = mkIf config.boot.loader.efiBootStub.enable {
assertions = [ { assertion = ! config.boot.kernelPackages.kernel ? features || config.boot.kernelPackages.kernel.features ? efiBootStub; message = "This kernel does not support the EFI boot stub"; } ];
###### implementation
let system = {
efiBootStubBuilder = pkgs.substituteAll { build.installBootLoader = efiBootStubBuilder;
src = ./efi-boot-stub-builder.sh; boot.loader.id = "efiBootStub";
isExecutable = true; boot.loader.kernelFile = platform.kernelTarget;
inherit (pkgs) bash; requiredKernelConfig = with config.lib.kernelConfig; [
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.glibc] ++ (pkgs.stdenv.lib.optionals config.boot.loader.efiBootStub.runEfibootmgr [pkgs.efibootmgr pkgs.module_init_tools]); (isYes "EFI_STUB")
inherit (config.boot.loader.efiBootStub) efiSysMountPoint runEfibootmgr installStartupNsh efiDisk efiPartition; ];
};
efiShell = if config.boot.loader.efiBootStub.installShell then
if pkgs.stdenv.isi686 then
pkgs.fetchurl {
url = "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/Ia32/Shell_Full.efi";
sha256 = "1gv6kyaspczdp7x8qnx5x76ilriaygkfs99ay7ihhdi6riclkhfl";
}
else
pkgs.fetchurl {
url = "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi";
sha256 = "1g18z84rlavxr5gsrh2g942rfr6znv9fs3fqww5m7dhmnysgyv8p";
}
else
null;
kernelFile = platform.kernelTarget;
targetArch = if pkgs.stdenv.isi686 then
"IA32"
else if pkgs.stdenv.isx86_64 then
"X64"
else
throw "Unsupported architecture";
}; };
# Temporary check, for nixos to cope both with nixpkgs stdenv-updates and trunk
platform = pkgs.stdenv.platform;
in
{
require = [
options
# config.system.build
# ../system/system-options.nix
];
system = mkIf (config.boot.loader.efiBootStub.enable && (assert
(config.boot.kernelPackages.kernel.features ? efiBootStub &&
config.boot.kernelPackages.kernel.features.efiBootStub); true)) {
build.installBootLoader = efiBootStubBuilder;
boot.loader.id = "efiBootStub";
boot.loader.kernelFile = platform.kernelTarget;
};
} }

View File

@ -255,11 +255,7 @@ mountFS() {
# For CIFS mounts, retry a few times before giving up. # For CIFS mounts, retry a few times before giving up.
local n=0 local n=0
while true; do while true; do
if [ "$fsType" = "nfs" ]; then mount "/mnt-root$mountPoint" && break
nfsmount "$device" "/mnt-root$mountPoint" && break
else
mount "/mnt-root$mountPoint" && break
fi
if [ "$fsType" != cifs -o "$n" -ge 10 ]; then fail; break; fi if [ "$fsType" != cifs -o "$n" -ge 10 ]; then fail; break; fi
echo "retrying..." echo "retrying..."
n=$((n + 1)) n=$((n + 1))
@ -322,6 +318,8 @@ while read -u 3 mountPoint; do
mountFS "$device" "$mountPoint" "$options" "$fsType" mountFS "$device" "$mountPoint" "$options" "$fsType"
done done
exec 3>&-
@postMountCommands@ @postMountCommands@

View File

@ -239,6 +239,7 @@ let
--replace ata_id ${extraUtils}/bin/ata_id \ --replace ata_id ${extraUtils}/bin/ata_id \
--replace scsi_id ${extraUtils}/bin/scsi_id \ --replace scsi_id ${extraUtils}/bin/scsi_id \
--replace cdrom_id ${extraUtils}/bin/cdrom_id \ --replace cdrom_id ${extraUtils}/bin/cdrom_id \
--replace ${pkgs.utillinux}/sbin/blkid ${extraUtils}/bin/blkid \
--replace /sbin/blkid ${extraUtils}/bin/blkid \ --replace /sbin/blkid ${extraUtils}/bin/blkid \
--replace ${pkgs.lvm2}/sbin ${extraUtils}/bin \ --replace ${pkgs.lvm2}/sbin ${extraUtils}/bin \
--replace /sbin/mdadm ${extraUtils}/bin/mdadm --replace /sbin/mdadm ${extraUtils}/bin/mdadm
@ -314,4 +315,8 @@ in {
system.build.initialRamdisk = initialRamdisk; system.build.initialRamdisk = initialRamdisk;
system.build.extraUtils = extraUtils; system.build.extraUtils = extraUtils;
system.requiredKernelConfig = with config.lib.kernelConfig; [
(isYes "TMPFS")
(isYes "BLK_DEV_INITRD")
];
} }

View File

@ -28,7 +28,7 @@ setPath "@path@"
# However, in some environments (such as Amazon EC2), stage 2 is # However, in some environments (such as Amazon EC2), stage 2 is
# executed directly, and the root is read-only. So make it writable # executed directly, and the root is read-only. So make it writable
# here. # here.
mount -n -o remount,rw none / mount -n -o remount,rw /
# Likewise, stage 1 mounts /proc, /dev and /sys, so if we don't have a # Likewise, stage 1 mounts /proc, /dev and /sys, so if we don't have a

View File

@ -40,12 +40,6 @@ in
boot.initrd.kernelModules = mkIf inInitrd [ "nfs" ]; boot.initrd.kernelModules = mkIf inInitrd [ "nfs" ];
boot.initrd.extraUtilsCommands = mkIf inInitrd
''
# !!! Uh, why don't we just install mount.nfs?
cp -v ${pkgs.klibc}/lib/klibc/bin.static/nfsmount $out/bin
'';
# Ensure that statd and idmapd are started before mountall. # Ensure that statd and idmapd are started before mountall.
jobs.mountall.preStart = jobs.mountall.preStart =
'' ''

View File

@ -0,0 +1,28 @@
{ config, pkgs, ... }:
let
configfile = builtins.storePath (builtins.toFile "config" (pkgs.lib.concatStringsSep "\n"
(map (builtins.getAttr "configLine") config.system.requiredKernelConfig))
);
origKernel = pkgs.linuxManualConfig {
inherit (pkgs.linux) src version;
inherit configfile;
allowImportFromDerivation = true;
kernelPatches = [ pkgs.kernelPatches.cifs_timeout_2_6_38 ];
};
kernel = origKernel // (derivation (origKernel.drvAttrs // {
configurePhase = ''
runHook preConfigure
mkdir ../build
make $makeFlags "''${makeFlagsArray[@]}" mrproper
make $makeFlags "''${makeFlagsArray[@]}" KCONFIG_ALLCONFIG=${configfile} allnoconfig
runHook postConfigure
'';
}));
kernelPackages = pkgs.linuxPackagesFor kernel kernelPackages;
in {
boot.kernelPackages = kernelPackages;
}

View File

@ -5,6 +5,8 @@
with pkgs.lib; with pkgs.lib;
let kernel = config.boot.kernelPackages.kernel; in
{ {
config = { config = {
@ -75,6 +77,12 @@ with pkgs.lib;
system.upstartEnvironment.GCOV_PREFIX = "/tmp/xchg/coverage-data"; system.upstartEnvironment.GCOV_PREFIX = "/tmp/xchg/coverage-data";
system.requiredKernelConfig = with config.lib.kernelConfig; [
(isYes "SERIAL_8250_CONSOLE")
(isYes "SERIAL_8250")
(isEnabled "VIRTIO_CONSOLE")
];
}; };
} }

View File

@ -155,6 +155,14 @@ let
cd $TMPDIR cd $TMPDIR
mkdir -p $TMPDIR/xchg mkdir -p $TMPDIR/xchg
EXTRA_SAMBA_CONF="
[shared]
force user = $WHO
path = ''${SHARED_DIR:-$TMPDIR/xchg}
read only = no
guest ok = yes
"
${pkgs.vmTools.startSamba} ${pkgs.vmTools.startSamba}
# Start QEMU. # Start QEMU.
@ -211,7 +219,7 @@ let
. /sys/class/block/vda1/uevent . /sys/class/block/vda1/uevent
mknod /dev/vda1 b $MAJOR $MINOR mknod /dev/vda1 b $MAJOR $MINOR
. /sys/class/block/vda/uevent . /sys/class/block/vda/uevent
${pkgs.e2fsprogs}/sbin/mkfs.ext3 -L boot /dev/vda1 ${pkgs.e2fsprogs}/sbin/mkfs.ext4 -L boot /dev/vda1
${pkgs.e2fsprogs}/sbin/tune2fs -c 0 -i 0 /dev/vda1 ${pkgs.e2fsprogs}/sbin/tune2fs -c 0 -i 0 /dev/vda1
# Mount /boot. # Mount /boot.
@ -264,7 +272,7 @@ in
# initialise. # initialise.
FSTYPE=$(blkid -o value -s TYPE /dev/vda || true) FSTYPE=$(blkid -o value -s TYPE /dev/vda || true)
if test -z "$FSTYPE"; then if test -z "$FSTYPE"; then
mke2fs -t ext3 /dev/vda mke2fs -t ext4 /dev/vda
fi fi
''; '';
@ -328,10 +336,16 @@ in
options = "guest,sec=none,noperm,noacl"; options = "guest,sec=none,noperm,noacl";
neededForBoot = true; neededForBoot = true;
} }
{ mountPoint = "/tmp/shared";
device = "//10.0.2.4/shared";
fsType = "cifs";
options = "guest,sec=none,noperm,noacl";
neededForBoot = true;
}
] ++ optional cfg.useBootLoader ] ++ optional cfg.useBootLoader
{ mountPoint = "/boot"; { mountPoint = "/boot";
device = "/dev/disk/by-label/boot"; device = "/dev/disk/by-label/boot";
fsType = "ext3"; fsType = "ext4";
options = "ro"; options = "ro";
noCheck = true; # fsck fails on a r/o filesystem noCheck = true; # fsck fails on a r/o filesystem
}); });
@ -385,4 +399,22 @@ in
# Wireless won't work in the VM. # Wireless won't work in the VM.
networking.wireless.enable = mkOverride 50 false; networking.wireless.enable = mkOverride 50 false;
system.requiredKernelConfig = with config.lib.kernelConfig;
[ (isEnabled "VIRTIO_BLK")
(isEnabled "VIRTIO_PCI")
(isEnabled "VIRTIO_NET")
(isEnabled "EXT4_FS")
(isEnabled "CIFS")
(isYes "BLK_DEV")
(isYes "PCI")
(isYes "EXPERIMENTAL")
(isYes "NETDEVICES")
(isYes "NET_CORE")
(isYes "INET")
(isYes "NETWORK_FILESYSTEMS")
] ++ optional (!cfg.graphics) [
(isYes "SERIAL_8250_CONSOLE")
(isYes "SERIAL_8250")
];
} }

View File

@ -1,5 +1,6 @@
{ nixosSrc ? {outPath = ./.; revCount = 1234; shortRev = "abcdef"; } { nixosSrc ? {outPath = ./.; revCount = 1234; shortRev = "abcdef"; }
, nixpkgs ? {outPath = <nixpkgs>; revCount = 5678; shortRev = "fedcba"; } , nixpkgs ? {outPath = <nixpkgs>; revCount = 5678; shortRev = "fedcba"; }
#, minimal ? false
}: }:
let let

View File

@ -1,6 +1,6 @@
{ system ? builtins.currentSystem }: { system ? builtins.currentSystem, minimal ? false }:
with import ../lib/testing.nix { inherit system; }; with import ../lib/testing.nix { inherit system minimal; };
{ {
avahi = makeTest (import ./avahi.nix); avahi = makeTest (import ./avahi.nix);