|
| 1 | +{ stdenv, requireFile, writeScript, patchelf, libredirect, coreutils, pcsclite |
| 2 | +, zlib, glib, gdk_pixbuf, gtk2, cairo, pango, libX11, atk, openssl }: |
| 3 | + |
| 4 | +let |
| 5 | + libPath = stdenv.lib.makeLibraryPath [ |
| 6 | + stdenv.cc.cc zlib glib gdk_pixbuf gtk2 cairo pango libX11 atk openssl |
| 7 | + ]; |
| 8 | +in |
| 9 | + |
| 10 | +stdenv.mkDerivation rec { |
| 11 | + name = "moneyplex-${version}"; |
| 12 | + version = "1.0"; |
| 13 | + |
| 14 | + src = requireFile { |
| 15 | + message = '' |
| 16 | + Unfortunately, Matrica does not provide an installable version of moneyplex. |
| 17 | + To work around, install moneyplex on another system, und delete the following files |
| 18 | + from the moneyplex installation directory: backups, mdaten, rup, Lnx\ Global.ali, Lnx\ Local ...ali |
| 19 | + and settings.ini, and then pack the folder into moneyplex-${version}.tar.gz. |
| 20 | + ''; |
| 21 | + name = "moneyplex-${version}.tar.gz"; |
| 22 | + sha256 = "0wpzwvhybjbqvqi8bpvkvcs3mikvl68gk1hzawihi0xnm28lcxw0"; |
| 23 | + }; |
| 24 | + |
| 25 | + phases = [ "unpackPhase" "installPhase" "postInstall" ]; |
| 26 | + |
| 27 | + buildInputs = [ ]; |
| 28 | + |
| 29 | + installPhase = |
| 30 | + '' |
| 31 | + mkdir -p "$out/opt/moneyplex" |
| 32 | + cp -r . $out/opt/moneyplex |
| 33 | +
|
| 34 | + mkdir "$out/bin" |
| 35 | +
|
| 36 | + cat > $out/bin/moneyplex <<EOF |
| 37 | + #!${stdenv.shell} |
| 38 | +
|
| 39 | + if [ -z "\$XDG_DATA_HOME" ]; then |
| 40 | + MDIR=\$HOME/.local/share/moneyplex |
| 41 | + else |
| 42 | + MDIR=\$XDG_DATA_HOME/moneyplex |
| 43 | + fi |
| 44 | +
|
| 45 | + if [ ! -d "\$MDIR" ]; then |
| 46 | + ${coreutils}/bin/mkdir -p \$MDIR |
| 47 | + ${coreutils}/bin/cp -r $out/opt/moneyplex/* \$MDIR |
| 48 | + ${coreutils}/bin/chmod 0644 \$MDIR/* |
| 49 | + ${coreutils}/bin/chmod 0755 \$MDIR/system |
| 50 | + ${coreutils}/bin/chmod 0644 \$MDIR/system/* |
| 51 | + ${coreutils}/bin/chmod 0755 \$MDIR/reports |
| 52 | + ${coreutils}/bin/chmod 0644 \$MDIR/reports/* |
| 53 | + ${coreutils}/bin/chmod 0755 \$MDIR/moneyplex |
| 54 | + ${coreutils}/bin/chmod 0755 \$MDIR/prestart |
| 55 | + ${coreutils}/bin/chmod 0755 \$MDIR/mpxalarm |
| 56 | + fi |
| 57 | +
|
| 58 | + if [ ! -d "\$MDIR/pcsc" ]; then |
| 59 | + ${coreutils}/bin/mkdir -p \$MDIR/pcsc |
| 60 | + fi |
| 61 | + if [ ! -e "\$MDIR/pcsc/libpcsclite.so.1" ] || [ ! \`${coreutils}/bin/readlink -f "\$MDIR/pcsc/libpcsclite.so.1"\` -ef "${pcsclite}/lib/libpcsclite.so.1" ]; then |
| 62 | + ${coreutils}/bin/ln -sf "${pcsclite}/lib/libpcsclite.so.1" "\$MDIR/pcsc/libpcsclite.so.1" |
| 63 | + fi |
| 64 | +
|
| 65 | +
|
| 66 | + if [ -e "\$MDIR/rup/rupremote.lst" ]; then |
| 67 | + for i in \`${coreutils}/bin/cat "\$MDIR/rup/rupremote.lst"\`; do |
| 68 | + ${coreutils}/bin/mv "\$MDIR/rup/"\`${coreutils}/bin/basename \$i\` "\$MDIR/\$i" |
| 69 | + done |
| 70 | + rm -r "\$MDIR/rup/rupremote.lst" |
| 71 | + fi |
| 72 | +
|
| 73 | + if [ ! -e "\$MDIR/moneyplex.patched" ] || [ "\$MDIR/moneyplex" -nt "\$MDIR/moneyplex.patched" ]; then |
| 74 | + ${coreutils}/bin/cp "\$MDIR/moneyplex" "\$MDIR/moneyplex.patched" |
| 75 | + ${coreutils}/bin/chmod 0755 "\$MDIR/moneyplex.patched" |
| 76 | + fi |
| 77 | + if [ ! \`${patchelf}/bin/patchelf --print-interpreter \$MDIR/moneyplex.patched\` = $(cat $NIX_CC/nix-support/dynamic-linker) ] || |
| 78 | + [ ! \`${patchelf}/bin/patchelf --print-rpath \$MDIR/moneyplex.patched\` = "${libPath}" ]; then |
| 79 | + ${patchelf}/bin/patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) --set-rpath "${libPath}" "\$MDIR/moneyplex.patched" |
| 80 | + fi |
| 81 | +
|
| 82 | + exec \$MDIR/moneyplex.patched |
| 83 | + EOF |
| 84 | +
|
| 85 | + chmod +x $out/bin/moneyplex |
| 86 | + ''; |
| 87 | + |
| 88 | + postInstall = '' |
| 89 | + mkdir -p $out/share/icons |
| 90 | + cp -r $out/opt/moneyplex/system/mpx256.png $out/share/icons/moneyplex.png |
| 91 | +
|
| 92 | + mkdir -p $out/share/applications |
| 93 | + cat > $out/share/applications/moneyplex.desktop <<EOF |
| 94 | + [Desktop Entry] |
| 95 | + Type=Application |
| 96 | + Encoding=UTF-8 |
| 97 | + Name=Moneyplex |
| 98 | + GenericName=Moneyplex online banking software |
| 99 | + Comment=Online banking software |
| 100 | + Icon=$out/share/icons/moneyplex.png |
| 101 | + Exec=$out/bin/moneyplex |
| 102 | + Terminal=false |
| 103 | + Categories=Application; |
| 104 | + StartupNotify=true |
| 105 | + EOF |
| 106 | + ''; |
| 107 | + |
| 108 | + |
| 109 | + meta = with stdenv.lib; { |
| 110 | + description = "Moneyplex online banking software"; |
| 111 | + maintainers = with maintainers; [ tstrobel ]; |
| 112 | + platforms = platforms.linux; |
| 113 | + license = licenses.unfree; |
| 114 | + downloadPage = http://matrica.de/download/download.html; |
| 115 | + }; |
| 116 | + |
| 117 | +} |
0 commit comments