1 { lib, stdenv, autoPatchelfHook, makeDesktopItem, makeWrapper, copyDesktopItems
4 , curl, libGL, libX11, libXext, libXmu, libXrandr, libXrender
6 # For fixing up execution of /bin/ls, which is necessary for
8 , coreutils, libredirect
10 # Extra utilities used by the SoftMaker applications.
11 , gnugrep, util-linux, which
13 , pname, version, edition, suiteName, src, archive
19 desktopItems = import ./desktop_items.nix {
20 inherit makeDesktopItem pname suiteName;
22 shortEdition = builtins.substring 2 2 edition;
23 in stdenv.mkDerivation {
26 version = "${edition}.${version}";
52 tar -C installer -xf ${src}
54 tar -C ${pname} -xf installer/${archive}
60 # SoftMaker/FreeOffice collects some system information upon
61 # unlocking the product. But in doing so, it attempts to execute
62 # /bin/ls. If the execve syscall fails, the whole unlock
63 # procedure fails. This works around that by rewriting /bin/ls
66 # In addition, it expects some common utilities (which, whereis)
69 # SoftMaker Office restarts itself upon some operations, such
70 # changing the theme and unlocking. Unfortunately, we do not
71 # have control over its environment then and it will fail
74 --set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
75 --set NIX_REDIRECTS "/bin/ls=${coreutils}/bin/ls" \
76 --prefix PATH : "${lib.makeBinPath [ coreutils gnugrep util-linux which ]}"
82 cp -r ${pname} $out/share/${pname}${edition}
84 # Wrap rather than symlinking, so that the programs can determine
85 # their resource path.
87 makeWrapper $out/share/${pname}${edition}/planmaker $out/bin/${pname}-planmaker \
89 makeWrapper $out/share/${pname}${edition}/presentations $out/bin/${pname}-presentations \
91 makeWrapper $out/share/${pname}${edition}/textmaker $out/bin/${pname}-textmaker \
94 for size in 16 32 48 64 96 128 256 512 1024; do
95 mkdir -p $out/share/icons/hicolor/''${size}x''${size}/apps
97 for app in pml prl tml; do
98 ln -s $out/share/${pname}${edition}/icons/''${app}_''${size}.png \
99 $out/share/icons/hicolor/''${size}x''${size}/apps/${pname}-''${app}.png
102 mkdir -p $out/share/icons/hicolor/''${size}x''${size}/mimetypes
104 for mimetype in pmd prd tmd; do
105 ln -s $out/share/${pname}${edition}/icons/''${mimetype}_''${size}.png \
106 $out/share/icons/hicolor/''${size}x''${size}/mimetypes/application-x-''${mimetype}.png
110 # freeoffice 973 misses the 96x96 application icons, giving broken symbolic links
111 # remove broken symbolic links
112 find $out -xtype l -ls -exec rm {} \;
115 install -D -t $out/share/mime/packages ${pname}/mime/softmaker-*office*${shortEdition}.xml
120 desktopItems = builtins.attrValues desktopItems;
123 description = "Office suite with a word processor, spreadsheet and presentation program";
124 homepage = "https://www.softmaker.com/";
125 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
126 license = licenses.unfree;
128 platforms = [ "x86_64-linux" ];