Fixed the avahi service and do some better formatting of the key=value pairs
svn path=/nixos/trunk/; revision=25060
This commit is contained in:
parent
b3c4444c26
commit
281f3b0776
@ -87,8 +87,8 @@ in
|
|||||||
optionalAttrs (cfg.publishInfrastructure.enable)
|
optionalAttrs (cfg.publishInfrastructure.enable)
|
||||||
( { hostname = config.networking.hostName;
|
( { hostname = config.networking.hostName;
|
||||||
targetHost = config.deployment.targetHost;
|
targetHost = config.deployment.targetHost;
|
||||||
|
system = if config.nixpkgs.system == "" then builtins.currentSystem else config.nixpkgs.system;
|
||||||
}
|
}
|
||||||
// optionalAttrs (config.nixpkgs.system != "") { system = config.nixpkgs.system; }
|
|
||||||
// optionalAttrs (cfg.useWebServiceInterface) { targetEPR = "http://${config.deployment.targetHost}:8080/DisnixWebService/services/DisnixWebService"; }
|
// optionalAttrs (cfg.useWebServiceInterface) { targetEPR = "http://${config.deployment.targetHost}:8080/DisnixWebService/services/DisnixWebService"; }
|
||||||
// optionalAttrs (config.services.httpd.enable) { documentRoot = config.services.httpd.documentRoot; }
|
// optionalAttrs (config.services.httpd.enable) { documentRoot = config.services.httpd.documentRoot; }
|
||||||
// optionalAttrs (config.services.mysql.enable) { mysqlPort = config.services.mysql.port; }
|
// optionalAttrs (config.services.mysql.enable) { mysqlPort = config.services.mysql.port; }
|
||||||
@ -98,6 +98,8 @@ in
|
|||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
services.disnix.publishInfrastructure.enable = cfg.publishAvahi;
|
||||||
|
|
||||||
jobs = {
|
jobs = {
|
||||||
disnix =
|
disnix =
|
||||||
{ description = "Disnix server";
|
{ description = "Disnix server";
|
||||||
@ -120,16 +122,19 @@ in
|
|||||||
|
|
||||||
exec =
|
exec =
|
||||||
''
|
''
|
||||||
${pkgs.avahi}/bin/avahi-publish-service disnix-$(${pkgs.nettools}/bin/hostname) _disnix._tcp 22 \
|
${pkgs.avahi}/bin/avahi-publish-service disnix-${config.networking.hostName} _disnix._tcp 22 \
|
||||||
"hostname=\"$(${pkgs.nettools}/bin/hostname)\"" \
|
|
||||||
"system=\"$(uname -m)-linux\"" \
|
|
||||||
"mem=$(grep 'MemTotal:' /proc/meminfo | sed -e 's/kB//' -e 's/MemTotal://' -e 's/ //g')" \
|
"mem=$(grep 'MemTotal:' /proc/meminfo | sed -e 's/kB//' -e 's/MemTotal://' -e 's/ //g')" \
|
||||||
${optionalString (cfg.useWebServiceInterface) ''"targetEPR=\"http://(${pkgs.nettools}/bin/hostname):8080/DisnixWebService/services/DisnixWebService\""''} \
|
|
||||||
${optionalString (config.services.httpd.enable) ''"documentRoot=\"${config.services.httpd.documentRoot}\""''} \
|
|
||||||
${optionalString (config.services.mysql.enable) ''"mysqlPort=3306"''} \
|
|
||||||
${optionalString (config.services.tomcat.enable) ''"tomcatPort=8080"''} \
|
|
||||||
"supportedTypes=[$(for i in ${disnix_activation_scripts}/libexec/disnix/activation-scripts/*; do echo -n " \"$(basename $i)\""; done) ]" \
|
"supportedTypes=[$(for i in ${disnix_activation_scripts}/libexec/disnix/activation-scripts/*; do echo -n " \"$(basename $i)\""; done) ]" \
|
||||||
${concatMapStrings (deploymentAttrName: let deploymentAttrValue = getAttr deploymentAttrName (config.deployment); in ''${deploymentAttrName}=\"${deploymentAttrValue}\" '' ) (attrNames (config.deployment))}
|
${concatMapStrings (infrastructureAttrName:
|
||||||
|
let infrastructureAttrValue = getAttr infrastructureAttrName (cfg.infrastructure);
|
||||||
|
in
|
||||||
|
if builtins.isInt infrastructureAttrValue then
|
||||||
|
''${infrastructureAttrName}=${infrastructureAttrValue} \
|
||||||
|
''
|
||||||
|
else
|
||||||
|
''${infrastructureAttrName}=\"${infrastructureAttrValue}\" \
|
||||||
|
''
|
||||||
|
) (attrNames (cfg.infrastructure))}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user