diff options
author | hqurve <hqurve@outlook.com> | 2022-04-28 15:13:13 -0400 |
---|---|---|
committer | hqurve <hqurve@outlook.com> | 2022-05-03 08:11:26 -0400 |
commit | 010e2e5b12e2464faa27554a6445cebe79c27466 (patch) | |
tree | 5a8a72769d96458f5bfdd801c69a3b489d81f45b /pkgs/applications | |
parent | e10da1c7f542515b609f8dfbcf788f3d85b14936 (diff) | |
download | nixpkgs-010e2e5b12e2464faa27554a6445cebe79c27466.tar nixpkgs-010e2e5b12e2464faa27554a6445cebe79c27466.tar.gz nixpkgs-010e2e5b12e2464faa27554a6445cebe79c27466.tar.bz2 nixpkgs-010e2e5b12e2464faa27554a6445cebe79c27466.tar.lz nixpkgs-010e2e5b12e2464faa27554a6445cebe79c27466.tar.xz nixpkgs-010e2e5b12e2464faa27554a6445cebe79c27466.tar.zst nixpkgs-010e2e5b12e2464faa27554a6445cebe79c27466.zip |
libreoffice: add templates to dolphin "create new" menu
The libreoffice derivation does not copy the necessary files to the output. Hence, we need to unpack the source again
Diffstat (limited to 'pkgs/applications')
-rw-r--r-- | pkgs/applications/office/libreoffice/soffice-template.desktop | 6 | ||||
-rw-r--r-- | pkgs/applications/office/libreoffice/wrapper.nix | 37 |
2 files changed, 31 insertions, 12 deletions
diff --git a/pkgs/applications/office/libreoffice/soffice-template.desktop b/pkgs/applications/office/libreoffice/soffice-template.desktop new file mode 100644 index 00000000000..4adb91284a9 --- /dev/null +++ b/pkgs/applications/office/libreoffice/soffice-template.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=LibreOffice @app@... +Comment=Enter LibreOffice @app@ filename: +Type=Link +URL=.source/soffice.@ext@ +Icon=libreoffice-oasis-@type@ diff --git a/pkgs/applications/office/libreoffice/wrapper.nix b/pkgs/applications/office/libreoffice/wrapper.nix index 08b01a4a051..fd9ef63dc73 100644 --- a/pkgs/applications/office/libreoffice/wrapper.nix +++ b/pkgs/applications/office/libreoffice/wrapper.nix @@ -1,19 +1,32 @@ -{ libreoffice, runCommand, dbus, bash }: -let - jdk = libreoffice.jdk; -in -(runCommand libreoffice.name { - inherit dbus libreoffice jdk bash; -} '' +{ lib, runCommand +, libreoffice, dbus, bash, substituteAll +, dolphinTemplates ? true +}: +runCommand libreoffice.name { + inherit (libreoffice) jdk meta; + inherit dbus libreoffice 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; - meta = libreoffice.meta; -} + + mkdir -p "$out/share" + ln -s "${libreoffice}/share"/* $out/share +'' + lib.optionalString dolphinTemplates '' + # Add templates to dolphin "Create new" menu - taken from debian + + # We need to unpack the core source since the necessary files aren't available in the libreoffice output + unpackFile "${libreoffice.src}" + + install -D "${libreoffice.name}"/extras/source/shellnew/soffice.* --target-directory="$out/share/templates/.source" + + cp ${substituteAll {src = ./soffice-template.desktop; app="Writer"; ext="odt"; type="text"; }} $out/share/templates/soffice.odt.desktop + cp ${substituteAll {src = ./soffice-template.desktop; app="Calc"; ext="ods"; type="spreadsheet"; }} $out/share/templates/soffice.ods.desktop + cp ${substituteAll {src = ./soffice-template.desktop; app="Impress"; ext="odp"; type="presentation";}} $out/share/templates/soffice.odp.desktop + cp ${substituteAll {src = ./soffice-template.desktop; app="Draw"; ext="odg"; type="drawing"; }} $out/share/templates/soffice.odg.desktop +'') + |