24 lines
753 B
Nix
24 lines
753 B
Nix
{
|
|
pkgs,
|
|
xmlstarlet ? pkgs.xmlstarlet,
|
|
|
|
# Usually forwarded through ssh
|
|
ip ? "localhost",
|
|
https-port ? 8000,
|
|
kmport ? 5900,
|
|
vport ? 5900,
|
|
|
|
original-viewer-path ? ./viewer.jnlp
|
|
}:
|
|
pkgs.runCommand "viewer.jnlp" {} ''
|
|
cp ${original-viewer-path} viewer.jnlp
|
|
|
|
sed -i 's|https://localhost:443|https://${ip}:${toString https-port}|g' viewer.jnlp
|
|
|
|
${xmlstarlet}/bin/xmlstarlet ed --inplace -u "/information/application-desc/ip" -v ${ip} viewer.jnlp
|
|
${xmlstarlet}/bin/xmlstarlet ed --inplace -u "/information/application-desc/kmport" -v ${toString kmport} viewer.jnlp
|
|
${xmlstarlet}/bin/xmlstarlet ed --inplace -u "/information/application-desc/vport" -v ${toString vport} viewer.jnlp
|
|
|
|
install -Dm644 -t $out viewer.jnlp
|
|
''
|