diff --git a/lib/testing.nix b/lib/testing.nix index 6c7a9edac69..3cf0bc5bf40 100644 --- a/lib/testing.nix +++ b/lib/testing.nix @@ -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 ''; # */ diff --git a/modules/installer/tools/nixos-deploy-network/nixos-deploy-network.sh b/modules/installer/tools/nixos-deploy-network/nixos-deploy-network.sh index dc2b2198cfc..f1668ce780d 100644 --- a/modules/installer/tools/nixos-deploy-network/nixos-deploy-network.sh +++ b/modules/installer/tools/nixos-deploy-network/nixos-deploy-network.sh @@ -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 diff --git a/modules/installer/tools/nixos-hardware-scan.pl b/modules/installer/tools/nixos-hardware-scan.pl index b26358e1078..38220c4fb78 100644 --- a/modules/installer/tools/nixos-hardware-scan.pl +++ b/modules/installer/tools/nixos-hardware-scan.pl @@ -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 <> ${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} ''; diff --git a/modules/services/misc/disnix.nix b/modules/services/misc/disnix.nix index ef4d7922e98..f3dd55b64d9 100644 --- a/modules/services/misc/disnix.nix +++ b/modules/services/misc/disnix.nix @@ -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}\" \ diff --git a/modules/services/misc/svnserve.nix b/modules/services/misc/svnserve.nix new file mode 100644 index 00000000000..c1acf5723d8 --- /dev/null +++ b/modules/services/misc/svnserve.nix @@ -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"; + }; + }; +} diff --git a/modules/services/networking/dhclient.nix b/modules/services/networking/dhclient.nix index 7d45350fe6b..52612ee403b 100644 --- a/modules/services/networking/dhclient.nix +++ b/modules/services/networking/dhclient.nix @@ -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 ''; }; diff --git a/tests/installer.nix b/tests/installer.nix index eead83053ed..994d1173c2d 100644 --- a/tests/installer.nix +++ b/tests/installer.nix @@ -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.