Author: eelco
Date: Fri Apr 29 14:53:31 2011
New Revision: 27052
URL: https://svn.nixos.org/websvn/nix/?rev=27052&sc=1
Log:
* Handle multiple network configurations to support separation of the
logical and physical aspects of a specification (e.g. apache.nix
vs. apache-cloud.nix).
Added:
cloud/trunk/examples/apache-cloud.nix
Modified:
cloud/trunk/examples/apache.nix
cloud/trunk/src/nixos-deploy-network.pl
Added: cloud/trunk/examples/apache-cloud.nix
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cloud/trunk/examples/apache-cloud.nix Fri Apr 29 14:53:31 2011
(r27052)
@@ -0,0 +1,14 @@
+let
+
+ config =
+ { deployment.targetEnv = "adhoc";
+ deployment.adhoc.controller = "[email protected]";
+ };
+
+in
+
+{
+ proxy = config;
+ backend1 = config;
+ backend2 = config;
+}
Modified: cloud/trunk/examples/apache.nix
==============================================================================
--- cloud/trunk/examples/apache.nix Fri Apr 29 14:37:21 2011 (r27051)
+++ cloud/trunk/examples/apache.nix Fri Apr 29 14:53:31 2011 (r27052)
@@ -7,9 +7,6 @@
services.httpd.enable = true;
services.httpd.adminAddr = "[email protected]";
services.httpd.documentRoot = "${pkgs.valgrind}/share/doc/valgrind/html";
-
- deployment.targetEnv = "adhoc";
- deployment.adhoc.controller = "[email protected]";
};
in
@@ -48,9 +45,6 @@
# For testing; don't want to wait forever for dead backend servers.
ProxyTimeout 5
'';
-
- deployment.targetEnv = "adhoc";
- deployment.adhoc.controller = "[email protected]";
};
backend1 = backend;
Modified: cloud/trunk/src/nixos-deploy-network.pl
==============================================================================
--- cloud/trunk/src/nixos-deploy-network.pl Fri Apr 29 14:37:21 2011
(r27051)
+++ cloud/trunk/src/nixos-deploy-network.pl Fri Apr 29 14:53:31 2011
(r27052)
@@ -5,7 +5,7 @@
binmode(STDERR, ":utf8");
-my $networkExpr;
+my @networkExprs;
my @machines = ();
my $outPath;
@@ -38,15 +38,15 @@
sub processArgs {
- $networkExpr = $ARGV[0];
- die unless defined $networkExpr;
+ @networkExprs = @ARGV;
+ die unless scalar @networkExprs > 0;
}
sub evalMachineInfo {
my $machineInfoXML =
- `nix-instantiate --eval-only --xml --strict ./eval-machine-info.nix
--arg networkExprs '[ $networkExpr ]' -A machineInfo`;
- die "evaluation of $networkExpr failed" unless $? == 0;
+ `nix-instantiate --eval-only --xml --strict ./eval-machine-info.nix
--arg networkExprs '[ @networkExprs ]' -A machineInfo`;
+ die "evaluation of @networkExprs failed" unless $? == 0;
#print $machineInfoXML, "\n";
@@ -146,7 +146,7 @@
sub buildConfigs {
print STDERR "building all machine configurations...\n";
- $outPath = `nix-build ./eval-machine-info.nix --arg networkExprs '[
$networkExpr ./state.nix ]' -A machines`;
+ $outPath = `nix-build ./eval-machine-info.nix --arg networkExprs '[
@networkExprs ./state.nix ]' -A machines`;
die "unable to build all machine configurations" unless $? == 0;
chomp $outPath;
}
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits