@ -33,29 +33,29 @@ in
useWebServiceInterface = mkOption {
default = false ;
description = " W h e t h e r t o e n a b l e t h e D i s n i x W e b S e r v i c e i n t e r f a c e r u n n i n g o n A p a c h e T o m c a t " ;
description = " W h e t h e r t o e n a b l e t h e D i s n i x W e b S e r v i c e i n t e r f a c e r u n n i n g o n A p a c h e T o m c a t " ;
} ;
publishInfrastructure = {
enable = mkOption {
default = false ;
description = " W h e t h e r t o p u b l i s h c a p a b i l i t i e s / p r o p e r t i e s o f t h i s m a c h i n e i n a s a t t r i b u t e s i n t h e i n f r a s t r u c t u r e o p t i o n " ;
} ;
description = " W h e t h e r t o p u b l i s h c a p a b i l i t i e s / p r o p e r t i e s o f t h i s m a c h i n e i n a s a t t r i b u t e s i n t h e i n f r a s t r u c t u r e o p t i o n " ;
} ;
enableAuthentication = mkOption {
default = false ;
description = " W h e t h e r t o p u b l i s h a u t h e n t i c a t i o n c r e d e n t i a l s t h r o u g h t h e i n f r a s t r u c t u r e a t t r i b u t e ( n o t r e c o m m e n d e d i n c o m b i n a t i o n w i t h A v a h i ) " ;
} ;
enableAuthentication = mkOption {
default = false ;
description = " W h e t h e r t o p u b l i s h a u t h e n t i c a t i o n c r e d e n t i a l s t h r o u g h t h e i n f r a s t r u c t u r e a t t r i b u t e ( n o t r e c o m m e n d e d i n c o m b i n a t i o n w i t h A v a h i ) " ;
} ;
} ;
infrastructure = mkOption {
default = { } ;
description = " L i s t o f n a m e v a l u e p a i r s c o n t a i n i n g p r o p e r t i e s f o r t h e i n f r a s t r u c t u r e m o d e l " ;
description = " L i s t o f n a m e v a l u e p a i r s c o n t a i n i n g p r o p e r t i e s f o r t h e i n f r a s t r u c t u r e m o d e l " ;
} ;
publishAvahi = mkOption {
default = false ;
description = " W h e t h e r t o p u b l i s h c a p a b i l i t i e s / p r o p e r t i e s a s a D i s n i x s e r v i c e t h r o u g h A v a h i " ;
description = " W h e t h e r t o p u b l i s h c a p a b i l i t i e s / p r o p e r t i e s a s a D i s n i x s e r v i c e t h r o u g h A v a h i " ;
} ;
} ;
@ -77,7 +77,7 @@ in
services . tomcat . extraGroups = [ " d i s n i x " ] ;
services . tomcat . javaOpts = " ${ optionalString cfg . useWebServiceInterface " - D j a v a . l i b r a r y . p a t h = ${ pkgs . libmatthew_java } / l i b / j n i " } " ;
services . tomcat . sharedLibs = optional cfg . useWebServiceInterface " ${ pkgs . DisnixWebService } / s h a r e / j a v a / D i s n i x C o n n e c t i o n . j a r "
++ optional cfg . useWebServiceInterface " ${ pkgs . dbus_java } / s h a r e / j a v a / d b u s . j a r " ;
++ optional cfg . useWebServiceInterface " ${ pkgs . dbus_java } / s h a r e / j a v a / d b u s . j a r " ;
services . tomcat . webapps = optional cfg . useWebServiceInterface pkgs . DisnixWebService ;
users . extraGroups = singleton
@ -89,16 +89,29 @@ in
optionalAttrs ( cfg . publishInfrastructure . enable )
( { hostname = config . networking . hostName ;
targetHost = config . deployment . targetHost ;
system = if config . nixpkgs . system == " " then builtins . currentSystem else config . nixpkgs . system ;
system = if config . nixpkgs . system == " " then builtins . currentSystem else config . nixpkgs . system ;
supportedTypes = ( import " ${ pkgs . stdenv . mkDerivation {
name = " s u p p o r t e d t y p e s " ;
buildCommand = ''
( echo - n " [ "
cd $ { disnix_activation_scripts } /libexec/disnix/activation-scripts
for i in *
do
echo - n " \" $ i \" "
done
echo - n " ] " ) > $ out
'' ;
} } " ) ;
}
// optionalAttrs ( cfg . useWebServiceInterface ) { targetEPR = " h t t p : / / ${ config . deployment . targetHost } : 8 0 8 0 / D i s n i x W e b S e r v i c e / s e r v i c e s / D i s n i x W e b S e r v i c e " ; }
// 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 . svnserve . enable ) { svnBaseDir = config . services . svnserve . svnBaseDir ; }
// optionalAttrs ( cfg . publishInfrastructure . enableAuthentication ) (
optionalAttrs ( config . services . mysql . enable ) { mysqlUsername = " r o o t " ; mysqlPassword = builtins . readFile config . services . mysql . rootPassword ; } )
)
)
;
services . disnix . publishInfrastructure . enable = cfg . publishAvahi ;
@ -108,14 +121,14 @@ in
{ description = " D i s n i x s e r v e r " ;
startOn = " s t a r t e d d b u s "
+ optionalString config . services . httpd . enable " a n d s t a r t e d h t t p d "
+ optionalString config . services . mysql . enable " a n d s t a r t e d m y s q l "
+ optionalString config . services . tomcat . enable " a n d s t a r t e d t o m c a t "
+ optionalString config . services . svnserve . enable " a n d s t a r t e d s v n s e r v e " ;
+ optionalString config . services . httpd . enable " a n d s t a r t e d h t t p d "
+ optionalString config . services . mysql . enable " a n d s t a r t e d m y s q l "
+ optionalString config . services . tomcat . enable " a n d s t a r t e d t o m c a t "
+ optionalString config . services . svnserve . enable " a n d s t a r t e d s v n s e r v e " ;
script =
''
export PATH = /var/run/current-system/sw/bin : /var/run/current-system/sw/sbin
export PATH = /var/run/current-system/sw/bin : /var/run/current-system/sw/sbin
export HOME = /root
$ { pkgs . disnix } /bin/disnix-service - - activation-modules-dir = $ { disnix_activation_scripts } /libexec/disnix/activation-scripts
@ -127,21 +140,20 @@ in
startOn = " s t a r t e d a v a h i - d a e m o n " ;
exec =
exec =
''
$ { pkgs . avahi } /bin/avahi-publish-service disnix- $ { config . networking . hostName } _disnix . _tcp 22 \
" m e m = $ ( g r e p ' M e m T o t a l : ' / p r o c / m e m i n f o | s e d - e ' s / k B / / ' - e ' s / M e m T o t a l : / / ' - e ' s / / / g ' ) " \
" s u p p o r t e d T y p e s = [ $ ( f o r i i n ${ disnix_activation_scripts } / l i b e x e c / d i s n i x / a c t i v a t i o n - s c r i p t s / * ; d o e c h o - n " \ " $ ( b a s e n a m e $ i ) \" " ; done ) ] " \
$ { concatMapStrings ( infrastructureAttrName :
let infrastructureAttrValue = getAttr infrastructureAttrName ( cfg . infrastructure ) ;
in
if builtins . isInt infrastructureAttrValue then
'' ${ infrastructureAttrName } = ${ toString infrastructureAttrValue } \
''
else
" m e m = $ ( g r e p ' M e m T o t a l : ' / p r o c / m e m i n f o | s e d - e ' s / k B / / ' - e ' s / M e m T o t a l : / / ' - e ' s / / / g ' ) " \
$ { concatMapStrings ( infrastructureAttrName :
let infrastructureAttrValue = getAttr infrastructureAttrName ( cfg . infrastructure ) ;
in
if builtins . isInt infrastructureAttrValue then
'' ${ infrastructureAttrName } = ${ toString infrastructureAttrValue } \
''
else
'' ${ infrastructureAttrName } = \ " ${ infrastructureAttrValue } \ " \
''
) ( attrNames ( cfg . infrastructure ) ) }
) ( attrNames ( cfg . infrastructure ) ) }
'' ;
} ;
} ;