Author: sandervanderburg
Date: Tue Jan 18 17:41:55 2011
New Revision: 25611
URL: https://svn.nixos.org/websvn/nix/?rev=25611&sc=1

Log:
- Fixed disnix-genservices to generate a correct services model
- Added disnixos-deploy-network

Added:
   disnix/disnixos/trunk/scripts/disnixos-deploy-network.in
Modified:
   disnix/disnixos/trunk/configure.ac
   disnix/disnixos/trunk/data/generate-services.nix.in
   disnix/disnixos/trunk/data/services.nix.in
   disnix/disnixos/trunk/scripts/Makefile.am
   disnix/disnixos/trunk/scripts/disnixos-vm-env.in

Modified: disnix/disnixos/trunk/configure.ac
==============================================================================
--- disnix/disnixos/trunk/configure.ac  Tue Jan 18 17:36:25 2011        (r25610)
+++ disnix/disnixos/trunk/configure.ac  Tue Jan 18 17:41:55 2011        (r25611)
@@ -33,6 +33,7 @@
 data/generate-tests.nix
 data/testing.nix
 scripts/disnix-backdoor-client
+scripts/disnixos-deploy-network
 scripts/disnixos-geninfra
 scripts/disnixos-genservices
 scripts/disnixos-gentests

Modified: disnix/disnixos/trunk/data/generate-services.nix.in
==============================================================================
--- disnix/disnixos/trunk/data/generate-services.nix.in Tue Jan 18 17:36:25 
2011        (r25610)
+++ disnix/disnixos/trunk/data/generate-services.nix.in Tue Jan 18 17:41:55 
2011        (r25611)
@@ -11,7 +11,6 @@
   name = "services.nix";
   buildCommand = ''
     sed -e "s|@networkFile@|${networkFile}|" \
-        -e "s|@nixpkgs@|${nixpkgs}|" \
        -e "s|@nixos@|${nixos}|" ${servicesNix} > $out
   '';
 }

Modified: disnix/disnixos/trunk/data/services.nix.in
==============================================================================
--- disnix/disnixos/trunk/data/services.nix.in  Tue Jan 18 17:36:25 2011        
(r25610)
+++ disnix/disnixos/trunk/data/services.nix.in  Tue Jan 18 17:41:55 2011        
(r25611)
@@ -1,13 +1,13 @@
 let
   networkFile = @networkFile@;
-  nixpkgs = "@nixpkgs@";
   nixos = "@nixos@";
 
-  pkgs = import nixpkgs {};
   evalConfig = import "${nixos}/lib/eval-config.nix";
   network = import networkFile;
 in
-pkgs.lib.mapAttr (targetName: config: 
+{distribution, pkgs, system}:
+
+pkgs.lib.mapAttrs (targetName: config: 
   {
     name = targetName;
     pkg = (evalConfig {

Modified: disnix/disnixos/trunk/scripts/Makefile.am
==============================================================================
--- disnix/disnixos/trunk/scripts/Makefile.am   Tue Jan 18 17:36:25 2011        
(r25610)
+++ disnix/disnixos/trunk/scripts/Makefile.am   Tue Jan 18 17:41:55 2011        
(r25611)
@@ -1,3 +1,3 @@
-bin_SCRIPTS = disnix-backdoor-client disnixos-geninfra disnixos-genservices 
disnixos-gentests disnixos-vm-env
+bin_SCRIPTS = disnix-backdoor-client disnixos-geninfra disnixos-genservices 
disnixos-gentests disnixos-vm-env disnixos-deploy-network
 
-EXTRA_DIST = disnix-backdoor-client.in disnixos-geninfra.in 
disnixos-genservices.in disnixos-gentests.in disnixos-vm-env.in
+EXTRA_DIST = disnix-backdoor-client.in disnixos-geninfra.in 
disnixos-genservices.in disnixos-gentests.in disnixos-vm-env.in 
disnixos-deploy-network.in

Added: disnix/disnixos/trunk/scripts/disnixos-deploy-network.in
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ disnix/disnixos/trunk/scripts/disnixos-deploy-network.in    Tue Jan 18 
17:41:55 2011        (r25611)
@@ -0,0 +1,107 @@
+#!/bin/bash -e
+# Disnix - A distributed application layer for Nix
+# Copyright (C) 2008-2010  Sander van der Burg
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
+
+# Shows the usage of this command to the user
+
+showUsage()
+{
+    echo "Usage: $0 [options] network_expr"
+    echo "Options:"
+    echo
+    echo "--target-property   The target property of an infrastructure model, 
that specifies how to "
+    echo "                    connect to the remote Disnix interface. 
(Defaults to hostname)"
+    echo "--interface         Process that communicates with the remote disnix 
service. Defaults to disnix-ssh-client"
+    echo "-p,--profile        Name of the profile that is used for this 
system. Defaults to: default"
+    echo "--show-trace        Shows a trace of the output"
+    echo "-h,--help           Shows the usage of this command"
+}
+
+# Import checks
+source @DISNIX_PREFIX@/share/disnix/checks
+
+# Parse valid argument options
+
+PARAMS=`getopt -n $0 -o p:h -l 
profile:,target-property:,interface:,show-trace,help -- "$@"`
+
+if [ $? != 0 ]
+then
+    showUsage
+    exit 1
+fi
+
+eval set -- "$PARAMS"
+
+# Evaluate valid options
+
+while [ "$1" != "--" ]
+do
+    case "$1" in
+       -p|--profile)
+           profileArg="--profile $2"
+           ;;
+        --target-property)
+           targetProperty=$2
+           ;;
+       --interface)
+           interface=$2
+           ;;
+       --show-trace)
+           showTrace=1
+           ;;
+       -h|--help)
+           showUsage
+           exit 0
+           ;;
+    esac
+    
+    shift
+done
+
+shift
+
+# Validate the given options
+
+checkClientInterface
+checkTargetProperty
+checkShowTrace
+
+if [ "$@" = "" ]
+then
+    echo "ERROR: A network expression must be specified!" >&2
+    exit 1
+else
+    networkFile=$(readlink -f $@)
+fi
+
+# Generate services model from network model
+servicesFile=`disnixos-genservices $networkFile --no-out-link $showTraceArg`
+
+# Generate infrastructure model from network model
+infrastructureFile=`disnixos-geninfra $networkFile --no-out-link $showTraceArg`
+
+# Map NixOS configurations (services) to machines in the infrastructure model
+distributionFile=`disnix-gendist-roundrobin -s $servicesFile -i 
$infrastructureFile --no-out-link $showTraceArg`
+
+# Create a manifest file
+manifest=`disnix-manifest -s $servicesFile -i $infrastructureFile -d 
$distributionFile --target-property $targetProperty --no-out-link`
+
+# Distribute system derivations
+disnix-distribute --interface $interface $manifest
+
+# Activate system derivations
+disnix-activate $profileArg --interface $interface --no-coordinator-profile 
--no-target-profile $manifest

Modified: disnix/disnixos/trunk/scripts/disnixos-vm-env.in
==============================================================================
--- disnix/disnixos/trunk/scripts/disnixos-vm-env.in    Tue Jan 18 17:36:25 
2011        (r25610)
+++ disnix/disnixos/trunk/scripts/disnixos-vm-env.in    Tue Jan 18 17:41:55 
2011        (r25611)
@@ -95,10 +95,10 @@
 infrastructureFile=`disnixos-geninfra --use-backdoor --no-out-link 
$showTraceArg $networkFile`
 
 # Build the manifest
-manifest=`disnix-manifest -s $servicesFile -i $infrastructureFile -d 
$distributionFile --target-property backdoor --no-out-link`
+manifest=`disnix-manifest -s $servicesFile -i $infrastructureFile -d 
$distributionFile --target-property backdoor --no-out-link $showTraceArg`
 
 # Set a test script which automatically deploys the system
-export tests=`cat $(disnixos-gentests --no-out-link -n $networkFile $manifest)`
+export tests=`cat $(disnixos-gentests --no-out-link -n $networkFile 
$showTraceArg $manifest)`
 
 # Start the virtual machines
 export TMPDIR=`mktemp -d`
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to