fork
Configure Feed
Select the types of activity you want to include in your feed.
nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
fork
Configure Feed
Select the types of activity you want to include in your feed.
1{ lib, stdenv, autoPatchelfHook, makeDesktopItem, makeWrapper, copyDesktopItems
2
3 # Dynamic Libraries
4, curl, libGL, libX11, libXext, libXmu, libXrandr, libXrender
5
6 # For fixing up execution of /bin/ls, which is necessary for
7 # product unlocking.
8, coreutils, libredirect
9
10 # Extra utilities used by the SoftMaker applications.
11, gnugrep, util-linux, which
12
13, pname, version, edition, suiteName, src, archive
14
15, ...
16}:
17
18let
19 desktopItems = import ./desktop_items.nix {
20 inherit makeDesktopItem pname suiteName;
21 };
22 shortEdition = builtins.substring 2 2 edition;
23in stdenv.mkDerivation {
24 inherit pname src;
25
26 version = "${edition}.${version}";
27
28 nativeBuildInputs = [
29 autoPatchelfHook
30 copyDesktopItems
31 makeWrapper
32 ];
33
34 buildInputs = [
35 curl
36 libGL
37 libX11
38 libXext
39 libXmu
40 libXrandr
41 libXrender
42 stdenv.cc.cc.lib
43 ];
44
45 dontBuild = true;
46 dontConfigure = true;
47
48 unpackPhase = ''
49 runHook preUnpack
50
51 mkdir installer
52 tar -C installer -xf ${src}
53 mkdir ${pname}
54 tar -C ${pname} -xf installer/${archive}
55
56 runHook postUnpack
57 '';
58
59 installPhase = let
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
64 # to the proper path.
65 #
66 # In addition, it expects some common utilities (which, whereis)
67 # to be in the path.
68 #
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
72 # with an error.
73 extraWrapperArgs = ''
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 ]}"
77 '';
78 in ''
79 runHook preInstall
80
81 mkdir -p $out/share
82 cp -r ${pname} $out/share/${pname}${edition}
83
84 # Wrap rather than symlinking, so that the programs can determine
85 # their resource path.
86 mkdir -p $out/bin
87 makeWrapper $out/share/${pname}${edition}/planmaker $out/bin/${pname}-planmaker \
88 ${extraWrapperArgs}
89 makeWrapper $out/share/${pname}${edition}/presentations $out/bin/${pname}-presentations \
90 ${extraWrapperArgs}
91 makeWrapper $out/share/${pname}${edition}/textmaker $out/bin/${pname}-textmaker \
92 ${extraWrapperArgs}
93
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
96
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
100 done
101
102 mkdir -p $out/share/icons/hicolor/''${size}x''${size}/mimetypes
103
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
107 done
108 done
109
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 {} \;
113
114 # Add mime types
115 install -D -t $out/share/mime/packages ${pname}/mime/softmaker-*office*${shortEdition}.xml
116
117 runHook postInstall
118 '';
119
120 desktopItems = builtins.attrValues desktopItems;
121
122 meta = with lib; {
123 description = "An 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;
127 maintainers = with maintainers; [ ];
128 platforms = [ "x86_64-linux" ];
129 };
130}