diff options
author | Michael Raskin <7c6f434c@mail.ru> | 2018-03-27 19:18:49 +0200 |
---|---|---|
committer | Michael Raskin <7c6f434c@mail.ru> | 2018-03-27 19:30:09 +0200 |
commit | 95a819c0026a7a3c0dd2099e1c53fea95430c505 (patch) | |
tree | 823e77228812c6400616c48aa5140310cfbeafff /pkgs/applications/office | |
parent | 7f2305c431f04178d9935ffad41956e7e542ac5c (diff) | |
download | nixpkgs-95a819c0026a7a3c0dd2099e1c53fea95430c505.tar nixpkgs-95a819c0026a7a3c0dd2099e1c53fea95430c505.tar.gz nixpkgs-95a819c0026a7a3c0dd2099e1c53fea95430c505.tar.bz2 nixpkgs-95a819c0026a7a3c0dd2099e1c53fea95430c505.tar.lz nixpkgs-95a819c0026a7a3c0dd2099e1c53fea95430c505.tar.xz nixpkgs-95a819c0026a7a3c0dd2099e1c53fea95430c505.tar.zst nixpkgs-95a819c0026a7a3c0dd2099e1c53fea95430c505.zip |
libreoffice: wrap to set JAVA_HOME, SAL_USE_VCLPLUGIN and DBus session if not set
Diffstat (limited to 'pkgs/applications/office')
-rw-r--r-- | pkgs/applications/office/libreoffice/default.nix | 2 | ||||
-rw-r--r-- | pkgs/applications/office/libreoffice/still.nix | 2 | ||||
-rw-r--r-- | pkgs/applications/office/libreoffice/wrapper.nix | 16 | ||||
-rw-r--r-- | pkgs/applications/office/libreoffice/wrapper.sh | 27 |
4 files changed, 45 insertions, 2 deletions
diff --git a/pkgs/applications/office/libreoffice/default.nix b/pkgs/applications/office/libreoffice/default.nix index 7da7a6bf734..89af45814bf 100644 --- a/pkgs/applications/office/libreoffice/default.nix +++ b/pkgs/applications/office/libreoffice/default.nix @@ -269,7 +269,7 @@ in stdenv.mkDerivation rec { nativeBuildInputs = [ wrapGAppsHook ]; passthru = { - inherit srcs; + inherit srcs jdk; }; requiredSystemFeatures = [ "big-parallel" ]; diff --git a/pkgs/applications/office/libreoffice/still.nix b/pkgs/applications/office/libreoffice/still.nix index 866b8e92337..d1e80724aaf 100644 --- a/pkgs/applications/office/libreoffice/still.nix +++ b/pkgs/applications/office/libreoffice/still.nix @@ -261,7 +261,7 @@ in stdenv.mkDerivation rec { nativeBuildInputs = [ wrapGAppsHook ]; passthru = { - inherit srcs; + inherit srcs jdk; }; requiredSystemFeatures = [ "big-parallel" ]; diff --git a/pkgs/applications/office/libreoffice/wrapper.nix b/pkgs/applications/office/libreoffice/wrapper.nix new file mode 100644 index 00000000000..8566bd76e1e --- /dev/null +++ b/pkgs/applications/office/libreoffice/wrapper.nix @@ -0,0 +1,16 @@ +{ libreoffice, runCommand, dbus, bash }: +let + jdk = libreoffice.jdk; +in +(runCommand "${libreoffice.name}" { + inherit dbus libreoffice jdk bash; +} '' + mkdir -p "$out/bin" + ln -s "${libreoffice}/share" "$out/share" + substituteAll "${./wrapper.sh}" "$out/bin/soffice" + chmod a+x "$out/bin/soffice" + + for i in $(ls "${libreoffice}/bin/"); do + test "$i" = "soffice" || ln -s soffice "$out/bin/$(basename "$i")" + done +'') // { inherit libreoffice dbus; } diff --git a/pkgs/applications/office/libreoffice/wrapper.sh b/pkgs/applications/office/libreoffice/wrapper.sh new file mode 100644 index 00000000000..591b4251506 --- /dev/null +++ b/pkgs/applications/office/libreoffice/wrapper.sh @@ -0,0 +1,27 @@ +#!@bash@/bin/bash +export JAVA_HOME="${JAVA_HOME:-@jdk@}" +export SAL_USE_VCLPLUGIN="${SAL_USE_VCLPLUGIN:-gen}" + +if uname | grep Linux > /dev/null && + ! ( test -n "$DBUS_SESSION_BUS_ADDRESS" && + test -n "$DBUS_SYSTEM_BUS_ADDRESS" ); then + dbus_tmp_dir="/run/user/$(id -u)/libreoffice-dbus" + mkdir "$dbus_tmp_dir" + dbus_socket_dir="$(mktemp -d -p "$dbus_tmp_dir")" + cat "@dbus@/share/dbus-1/system.conf" | + grep -v '[<]user[>]messagebus' > "$dbus_socket_dir/system.conf" + if test -z "$DBUS_SESSION_BUS_ADDRESS"; then + "@dbus@"/bin/dbus-daemon --nopidfile --nofork --config-file "@dbus@"/share/dbus-1/session.conf --address "unix:path=$dbus_socket_dir/session" >&2 & + export DBUS_SESSION_BUS_ADDRESS="unix:path=$dbus_socket_dir/session" + fi + if test -z "$DBUS_SYSTEM_BUS_ADDRESS"; then + "@dbus@"/bin/dbus-daemon --nopidfile --nofork --config-file "$dbus_socket_dir/system.conf" --address "unix:path=$dbus_socket_dir/system" >&2 & + export DBUS_SYSTEM_BUS_ADDRESS="unix:path=$dbus_socket_dir/system" + fi +fi + +"@libreoffice@/bin/$(basename "$0")" "$@" +code="$?" + +test -n "$dbus_socket_dir" && rm -rf "$dbus_socket_dir" +exit "$code" |