Author: sandervanderburg Date: Thu Apr 28 11:02:58 2011 New Revision: 27028 URL: https://svn.nixos.org/websvn/nix/?rev=27028&sc=1
Log: Adapted deploy-network to accept multiple network configurations which are zipped together. With this you can run the tool like this: $ nixos-deploy-network network1.nix network2.nix Modified: nixos/trunk/modules/installer/tools/nixos-deploy-network/deploy.nix nixos/trunk/modules/installer/tools/nixos-deploy-network/nixos-deploy-network.sh Modified: nixos/trunk/modules/installer/tools/nixos-deploy-network/deploy.nix ============================================================================== --- nixos/trunk/modules/installer/tools/nixos-deploy-network/deploy.nix Thu Apr 28 09:49:40 2011 (r27027) +++ nixos/trunk/modules/installer/tools/nixos-deploy-network/deploy.nix Thu Apr 28 11:02:58 2011 (r27028) @@ -1,6 +1,6 @@ { nixos ? /etc/nixos/nixos , nixpkgs ? /etc/nixos/nixpkgs -, networkExpr +, networkExprs , targetProperty ? "targetHost" }: @@ -8,9 +8,11 @@ pkgs = import nixpkgs {}; inherit (builtins) attrNames getAttr listToAttrs; - inherit (pkgs.lib) concatMapStrings; + inherit (pkgs.lib) concatMapStrings zipAttrs; - network = import networkExpr; + networks = map (networkExpr: import networkExpr) networkExprs; + + network = zipAttrs networks; generateRollbackSucceededPhase = network: configs: concatMapStrings (configurationName: @@ -65,14 +67,14 @@ evaluateMachines = network: listToAttrs (map (configurationName: let - configuration = getAttr configurationName network; + modules = getAttr configurationName network; in { name = configurationName; value = (import "${nixos}/lib/eval-config.nix" { inherit nixpkgs; modules = - [ configuration - # Provide a default hostname and deployment target equal + modules ++ + [ # Provide a default hostname and deployment target equal # to the attribute name of the machine in the model. { key = "set-default-hostname"; networking.hostName = pkgs.lib.mkOverride 900 configurationName; Modified: nixos/trunk/modules/installer/tools/nixos-deploy-network/nixos-deploy-network.sh ============================================================================== --- nixos/trunk/modules/installer/tools/nixos-deploy-network/nixos-deploy-network.sh Thu Apr 28 09:49:40 2011 (r27027) +++ nixos/trunk/modules/installer/tools/nixos-deploy-network/nixos-deploy-network.sh Thu Apr 28 11:02:58 2011 (r27028) @@ -4,7 +4,7 @@ showUsage() { - echo "Usage: $0 network_expr" + echo "Usage: $0 network_expr [network_expr2 ...]" echo "Options:" echo echo "--show-trace Shows an output trace" @@ -55,13 +55,16 @@ if [ "$@" = "" ] then - echo "ERROR: A network Nix expression must be specified!" >&2 + echo "ERROR: At least one network Nix expression must be specified!" >&2 exit 1 else - networkExpr=$(readlink -f $@) + for i in $@ + do + networkExprs="$networkExprs \"$(readlink -f $i)\"" + done fi # Deploy the network -vms=`nix-build $NIXOS/modules/installer/tools/nixos-deploy-network/deploy.nix --argstr networkExpr $networkExpr --argstr nixos $NIXOS $showTraceArg $noOutLinkArg` +vms=`nix-build $NIXOS/modules/installer/tools/nixos-deploy-network/deploy.nix --arg networkExprs "[ $networkExprs ]" --argstr nixos $NIXOS $showTraceArg $noOutLinkArg` $vms/bin/deploy-systems _______________________________________________ nix-commits mailing list nix-comm...@cs.uu.nl http://mail.cs.uu.nl/mailman/listinfo/nix-commits