Author: eelco
Date: Thu Apr 28 16:04:07 2011
New Revision: 27036
URL: https://svn.nixos.org/websvn/nix/?rev=27036&sc=1
Log:
* Generate /etc/hosts entries so that the generated machines can find
each other.
Modified:
cloud/trunk/src/nixos-deploy-network.pl
Modified: cloud/trunk/src/nixos-deploy-network.pl
==============================================================================
--- cloud/trunk/src/nixos-deploy-network.pl Thu Apr 28 15:44:41 2011
(r27035)
+++ cloud/trunk/src/nixos-deploy-network.pl Thu Apr 28 16:04:07 2011
(r27036)
@@ -87,12 +87,33 @@
$machine->{ipv6} = $ipv6;
}
+
+ # So now that we know the hostnames / IP addresses of all
+ # machines, generate a Nix expression containing the physical
+ # network configuration that can be stacked on top of the
+ # user-supplied network configuration.
+ my $hosts = "";
+ foreach my $machine (@machines) {
+ $hosts .= "$machine->{ipv6} $machine->{name}\\n";
+ }
+
+ open STATE, ">state.nix" or die;
+ print STATE "{\n";
+ foreach my $machine (@machines) {
+ print STATE " $machine->{name} = { config, pkgs, ... }:\n";
+ print STATE " {\n";
+ print STATE " key = \"physical-$machine->{name}\";\n"; # !!!
shouldn't be needed
+ print STATE " networking.extraHosts = \"$hosts\";\n";
+ print STATE " };\n";
+ }
+ print STATE "}\n";
+ close STATE;
}
sub buildConfigs {
print STDERR "building all machine configurations...\n";
- $outPath = `nix-build ./eval-machine-info.nix --arg networkExprs '[
$networkExpr ]' -A machines`;
+ $outPath = `nix-build ./eval-machine-info.nix --arg networkExprs '[
$networkExpr ./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