2009-09-04 13:37:07 +02:00
|
|
|
{ nixos ? ./..
|
|
|
|
, nixpkgs ? /etc/nixos/nixpkgs
|
|
|
|
, services ? /etc/nixos/services
|
|
|
|
, system ? builtins.currentSystem
|
|
|
|
}:
|
|
|
|
|
|
|
|
with import ../lib/build-vms.nix { inherit nixos nixpkgs services system; };
|
|
|
|
|
|
|
|
rec {
|
|
|
|
nodes = {
|
|
|
|
storage =
|
|
|
|
{pkgs, config, ...}:
|
|
|
|
{
|
|
|
|
services = {
|
|
|
|
portmap = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
nfsKernel = {
|
|
|
|
enable = true;
|
|
|
|
exports = ''
|
2009-09-05 00:06:54 +02:00
|
|
|
/repos 192.168.1.0/255.255.255.0(rw,no_root_squash)
|
2009-09-04 13:37:07 +02:00
|
|
|
'';
|
2009-09-05 00:06:54 +02:00
|
|
|
createMountPoints = true;
|
2009-09-04 13:37:07 +02:00
|
|
|
};
|
2009-09-05 00:06:54 +02:00
|
|
|
};
|
2009-09-04 13:37:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
postgresql =
|
|
|
|
{config, pkgs, ...}:
|
|
|
|
{
|
|
|
|
services = {
|
|
|
|
sshd = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
postgresql = {
|
|
|
|
enable = true;
|
2009-09-04 16:45:30 +02:00
|
|
|
enableTCPIP = true;
|
|
|
|
|
2009-09-04 13:37:07 +02:00
|
|
|
authentication = ''
|
|
|
|
# Generated file; do not edit!
|
2009-09-04 16:45:30 +02:00
|
|
|
local all all trust
|
|
|
|
host all all 127.0.0.1/32 trust
|
|
|
|
host all all ::1/128 trust
|
|
|
|
host all all 192.168.1.0/24 trust
|
2009-09-04 13:37:07 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
webserver =
|
|
|
|
{config, pkgs, ...}:
|
|
|
|
{
|
2009-09-05 00:06:54 +02:00
|
|
|
fileSystems = pkgs.lib.mkOverride 50 {}
|
|
|
|
[
|
|
|
|
{ mountPoint = "/repos";
|
|
|
|
device = "storage:/repos"; }
|
|
|
|
];
|
|
|
|
|
2009-09-04 13:37:07 +02:00
|
|
|
services = {
|
2009-09-04 16:45:30 +02:00
|
|
|
portmap = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
|
2009-09-04 13:37:07 +02:00
|
|
|
nfsKernel = {
|
|
|
|
enable = true;
|
2009-09-05 00:06:54 +02:00
|
|
|
};
|
2009-09-04 13:37:07 +02:00
|
|
|
|
|
|
|
httpd = {
|
|
|
|
enable = true;
|
|
|
|
adminAddr = "root@localhost";
|
|
|
|
extraSubservices = [
|
|
|
|
{ serviceType = "trac"; }
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
environment = {
|
2009-09-05 00:06:54 +02:00
|
|
|
extraPackages = [ pkgs.pythonPackages.trac pkgs.subversion ];
|
2009-09-04 13:37:07 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
client =
|
|
|
|
{config, pkgs, ...}:
|
|
|
|
{
|
|
|
|
services = {
|
|
|
|
xserver = {
|
|
|
|
enable = true;
|
2009-09-04 16:45:30 +02:00
|
|
|
|
|
|
|
displayManager = {
|
|
|
|
slim = {
|
|
|
|
enable = false;
|
|
|
|
};
|
|
|
|
kdm = {
|
|
|
|
enable = true;
|
|
|
|
extraConfig =
|
|
|
|
''
|
|
|
|
[X-:0-Core]
|
|
|
|
AutoLoginEnable=true
|
|
|
|
AutoLoginUser=alice
|
|
|
|
AutoLoginPass=foobar
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
desktopManager = {
|
|
|
|
default = "kde4";
|
|
|
|
kde4 = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
};
|
2009-09-04 13:37:07 +02:00
|
|
|
};
|
|
|
|
};
|
2009-09-04 16:45:30 +02:00
|
|
|
|
|
|
|
users = {
|
|
|
|
extraUsers = pkgs.lib.singleton {
|
|
|
|
name = "alice";
|
|
|
|
description = "Alice Foobar";
|
|
|
|
home = "/home/alice";
|
|
|
|
createHome = true;
|
|
|
|
useDefaultShell = true;
|
|
|
|
password = "foobar";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2009-09-04 13:37:07 +02:00
|
|
|
environment = {
|
|
|
|
extraPackages = [
|
|
|
|
pkgs.scrot
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
vms = buildVirtualNetwork { inherit nodes; };
|
|
|
|
|
|
|
|
test = runTests vms
|
|
|
|
''
|
|
|
|
startAll;
|
|
|
|
|
2009-09-04 16:45:30 +02:00
|
|
|
$postgresql->waitForFile("/tmp/.s.PGSQL.5432");
|
|
|
|
$postgresql->mustSucceed("createdb trac");
|
2009-09-05 00:06:54 +02:00
|
|
|
|
2009-09-04 16:45:30 +02:00
|
|
|
$webserver->mustSucceed("mkdir -p /repos/trac");
|
2009-09-05 00:06:54 +02:00
|
|
|
$webserver->mustSucceed("svnadmin create /repos/trac");
|
2009-09-04 13:37:07 +02:00
|
|
|
|
2009-09-05 00:06:54 +02:00
|
|
|
$webserver->waitForFile("/var/trac");
|
2009-09-04 16:45:30 +02:00
|
|
|
$webserver->mustSucceed("mkdir -p /var/trac/projects/test");
|
|
|
|
$webserver->mustSucceed("PYTHONPATH=${pkgs.pythonPackages.psycopg2}/lib/python2.5/site-packages trac-admin /var/trac/projects/test initenv Test postgres://root\@postgresql/trac svn /repos/trac");
|
2009-09-04 13:37:07 +02:00
|
|
|
|
|
|
|
$client->waitForFile("/tmp/.X11-unix/X0");
|
2009-09-04 16:45:30 +02:00
|
|
|
sleep 60;
|
2009-09-04 13:37:07 +02:00
|
|
|
|
2009-09-05 00:06:54 +02:00
|
|
|
print STDERR $client->execute("su - alice -c 'DISPLAY=:0.0 konqueror http://webserver/projects/test &'");
|
|
|
|
sleep 120;
|
2009-09-04 13:37:07 +02:00
|
|
|
|
|
|
|
print STDERR $client->execute("DISPLAY=:0.0 scrot /hostfs/$ENV{out}/screen1.png");
|
|
|
|
'';
|
|
|
|
}
|