* Sync with the trunk.

svn path=/nixos/branches/stdenv-updates/; revision=25307
This commit is contained in:
Eelco Dolstra 2010-12-28 15:56:22 +00:00
commit ace958f669
9 changed files with 111 additions and 37 deletions

View File

@ -179,10 +179,9 @@ rec {
'';
vmRunCommand = writeText "vm-run" ''
${coreutils}/bin/mkdir -p client
export > client/saved-env
${coreutils}/bin/mkdir -p vm-state-client
export > vm-state-client/saved-env
export PATH=${qemu_kvm}/bin:${coreutils}/bin
cp ${./test-driver/Machine.pm} Machine.pm
export tests='${testscript}'
${testDriver}/bin/nixos-test-driver ${vms}/vms/*/bin/run-*-vm
''; # */

View File

@ -63,5 +63,5 @@ fi
# Deploy the network
vms=`nix-build $NIXOS/modules/installer/tools/nixos-deploy-network/deploy.nix --argstr networkExpr $networkExpr $showTraceArg $noOutLinkArg`
vms=`nix-build $NIXOS/modules/installer/tools/nixos-deploy-network/deploy.nix --argstr networkExpr $networkExpr --argstr nixos $NIXOS $showTraceArg $noOutLinkArg`
$vms/bin/deploy-systems

View File

@ -103,7 +103,7 @@ sub pciCheck {
$device eq "0x432c" || $device eq "0x432d" || $device eq "0x4353" ||
$device eq "0x4357") )
{
push @modulePackages, "kernelPackages.broadcom_sta";
push @modulePackages, "config.boot.kernelPackages.broadcom_sta";
push @kernelModules, "wl";
}
@ -242,7 +242,7 @@ my $attrs = multiLineList(" ", removeDups @attrs);
print <<EOF ;
# This is a generated file. Do not modify!
# Make changes to /etc/nixos/configuration.nix instead.
{modulesPath, ...}:
{ config, pkgs, modulesPath, ... }:
{
require = [
@ -250,12 +250,9 @@ print <<EOF ;
"\${modulesPath}/installer/scan/not-detected.nix"
];
boot = rec {
initrd.kernelModules = [ $initrdKernelModules ];
kernelModules = [ $kernelModules ];
kernelPackages = pkgs.linuxPackages;
extraModulePackages = [ $modulePackages ];
};
boot.initrd.kernelModules = [ $initrdKernelModules ];
boot.kernelModules = [ $kernelModules ];
boot.extraModulePackages = [ $modulePackages ];
nix.maxJobs = $cpus;

View File

@ -73,6 +73,7 @@
./services/misc/nix-gc.nix
./services/misc/nixos-manual.nix
./services/misc/rogue.nix
./services/misc/svnserve.nix
./services/misc/synergy.nix
./services/misc/virtualbox.nix
./services/monitoring/monit.nix

View File

@ -3,16 +3,30 @@
with pkgs.lib;
let
cfg = config.services.hydraChannelMirror ;
cfg = config.services.hydraChannelMirror;
mirrorChannel = pkgs.fetchsvn {
url = https://svn.nixos.org/repos/nix/release/trunk/channels/mirror-channel.pl;
rev = 24132;
sha256 = "02xvswbbr2sj9k1wfraa0j9053vf6w88nhk15qwzs8nkm180n820";
rev = 25210;
sha256 = "0gspqid1rpsj1z1mr29nakh7di278nlv6v2knafvmm3g8ah3yxgz";
};
cronjob = jobset : ''
${cfg.period} root ENABLE_PATCHES=1 PATH=${config.environment.nix}/libexec/nix:$PATH perl -I${config.environment.nix}/libexec/nix ${mirrorChannel} ${cfg.hydraURL}/jobset/${jobset.project}/${jobset.jobset}/channel/latest ${cfg.dataDir}/channels/${jobset.relURL} ${cfg.dataDir}/nars ${cfg.mirrorURL}/nars ${cfg.dataDir}/patches ${cfg.mirrorURL}/patches ${if jobset.nixexprs == "" then "" else "${cfg.hydraURL}/job/${jobset.project}/${jobset.jobset}/${jobset.nixexprs}/latest/download-by-type/file/source-dist"} >> ${cfg.dataDir}/logs/${jobset.name}.log
'';
cronjob = jobset:
"${cfg.period} ${cfg.user}"
+ optionalString cfg.enableBinaryPatches " ENABLE_PATCHES=1"
+ " perl -I${config.environment.nix}/libexec/nix ${mirrorChannel}"
+ " ${cfg.hydraURL}/jobset/${jobset.project}/${jobset.jobset}/channel/latest"
+ " ${cfg.dataDir}/${jobset.project}/channels/${jobset.name}"
+ " ${cfg.dataDir}/nars"
+ " ${cfg.mirrorURL}/nars"
+ " ${cfg.dataDir}/patches"
+ " ${cfg.mirrorURL}/patches"
+ " ${if jobset.nixexprs == "" then "" else "${cfg.hydraURL}/job/${jobset.project}/${jobset.jobset}/${jobset.nixexprs}/latest/download-by-type/file/source-dist"}"
+ " >> ${cfg.dataDir}/logs/${jobset.name}.log 2>&1\n";
in
{
options = {
@ -33,8 +47,15 @@ in
'';
};
user = mkOption {
default = "hydra-mirror";
description = ''
User running the Hydra mirror script.
'';
};
jobsets = mkOption {
default = [ rec { name = "nixpkgs-unstable"; project = "nixpkgs"; jobset = "trunk"; nixexprs = "tarball"; relURL = "nixpkgs/channels/${name}"; } ];
default = [ { name = "nixpkgs-unstable"; project = "nixpkgs"; jobset = "trunk"; nixexprs = "tarball"; } ];
description = ''
List of jobsets to mirror.
'';
@ -60,25 +81,41 @@ in
Location of Hydra mirror data
'';
};
enableBinaryPatches = mkOption {
default = false;
description = ''
Whether to enable generating binary patches for the mirrored channels.
'';
};
};
};
config = mkIf cfg.enable {
services.cron.systemCronJobs = map cronjob cfg.jobsets ;
users.extraUsers = singleton
{ name = cfg.user; description = "Hydra mirror"; };
services.cron.systemCronJobs = map cronjob cfg.jobsets;
system.activationScripts.hydraChannelMirror = stringAfter [ "stdio" "users" ]
''
mkdir -m 0755 -p ${cfg.dataDir}
chown ${cfg.user} ${cfg.dataDir}
mkdir -m 0755 -p ${cfg.dataDir}/nars
chown ${cfg.user} ${cfg.dataDir}/nars
mkdir -m 0755 -p ${cfg.dataDir}/patches
mkdir -m 0755 -p ${cfg.dataDir}/channels
ln -fs ${cfg.dataDir}/nars ${cfg.dataDir}/channels/nars
ln -fs ${cfg.dataDir}/patches ${cfg.dataDir}/channels/patches
chown ${cfg.user} ${cfg.dataDir}/patches
mkdir -m 0755 -p ${cfg.dataDir}/logs
chown ${cfg.user} ${cfg.dataDir}/logs
${concatMapStrings (j : ''
mkdir -m 0755 -p ${cfg.dataDir}/channels/${j.relURL}
mkdir -m 0755 -p ${cfg.dataDir}/{j.project}/channels/${j.name}
chown ${cfg.user} ${cfg.dataDir}/{j.project}/channels/${j.name}
'') cfg.jobsets}
'';

View File

@ -12,6 +12,8 @@ let
enableAxis2WebService = config.services.tomcat.axis2.enable;
enableEjabberdDump = config.services.ejabberd.enable;
enableMySQLDatabase = config.services.mysql.enable;
enablePostgreSQLDatabase = config.services.postgresql.enable;
enableSubversionRepository = config.services.svnserve.enable;
enableTomcatWebApplication = config.services.tomcat.enable;
});
in
@ -93,6 +95,7 @@ in
// optionalAttrs (config.services.httpd.enable) { documentRoot = config.services.httpd.documentRoot; }
// optionalAttrs (config.services.mysql.enable) { mysqlPort = config.services.mysql.port; }
// optionalAttrs (config.services.tomcat.enable) { tomcatPort = 8080; }
// optionalAttrs (config.services.svnserve.enable) { svnBaseDir = config.services.svnserve.svnBaseDir; }
// optionalAttrs (cfg.publishInfrastructure.enableAuthentication) (
optionalAttrs (config.services.mysql.enable) { mysqlUsername = "root"; mysqlPassword = builtins.readFile config.services.mysql.rootPassword; })
)
@ -129,7 +132,7 @@ in
let infrastructureAttrValue = getAttr infrastructureAttrName (cfg.infrastructure);
in
if builtins.isInt infrastructureAttrValue then
''${infrastructureAttrName}=${infrastructureAttrValue} \
''${infrastructureAttrName}=${toString infrastructureAttrValue} \
''
else
''${infrastructureAttrName}=\"${infrastructureAttrValue}\" \

View File

@ -0,0 +1,46 @@
# SVN server
{ config, pkgs, ... }:
with pkgs.lib;
let
cfg = config.services.svnserve;
in
{
###### interface
options = {
services.svnserve = {
enable = mkOption {
default = false;
description = "Whether to enable svnserve to serve Subversion repositories through the SVN protocol.";
};
svnBaseDir = mkOption {
default = "/repos";
description = "Base directory from which Subversion repositories are accessed.";
};
};
};
###### implementation
config = mkIf cfg.enable {
jobs.svnserve = {
startOn = "started network-interfaces";
stopOn = "stopping network-interfaces";
preStart = "mkdir -p ${cfg.svnBaseDir}";
exec = "${pkgs.subversion}/bin/svnserve -r ${cfg.svnBaseDir} -d --foreground --pid-file=/var/run/svnserve.pid";
};
};
}

View File

@ -114,17 +114,8 @@ in
powerManagement.resumeCommands =
''
export PATH=${config.system.build.upstart}/sbin:$PATH
restart() {
local job="$1"
if initctl status "$job" 2> /dev/null | grep -q 'running'; then
initctl stop "$job"
initctl start "$job"
fi
}
restart wpa_supplicant
restart dhclient
initctl restart wpa_supplicant
initctl restart dhclient
'';
};

View File

@ -304,7 +304,7 @@ in {
testScript =
''
# damn, it's costly to evaluate nixos-rebuild (1G of ram)
my $machine = Machine->new({ cdrom => glob("${iso}/iso/*.iso"), qemuFlags => '${qemuNICFlags 1 1} -m 1024' });
my $machine = Machine->new({ cdrom => glob("${iso}/iso/*.iso"), qemuFlags => '${qemuNICFlags 1 1 1} -m 1024' });
$machine->start;
# Make sure that we don't try to download anything.