summary refs log tree commit diff
path: root/pkgs/desktops/maxx/default.nix
blob: 891d644071c1c30941a10c72bac9e3f6b31de840 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{ stdenv, fetchurl, makeWrapper, libredirect, gcc-unwrapped, bash, gtk-engine-murrine, gtk_engines, librsvg

, libX11, libXext, libXi, libXau, libXrender, libXft, libXmu, libSM, libXcomposite, libXfixes, libXpm
, libXinerama, libXdamage, libICE, libXtst, libXaw, fontconfig, pango, cairo, glib, libxml2, atk, gtk2
, gdk_pixbuf, mesa_noglu, ncurses

, xclock, xsettingsd }:

let
  version = "Indy-1.1.0";

  deps = [
    stdenv.cc.cc libX11 libXext libXi libXau libXrender libXft libXmu libSM libXcomposite libXfixes libXpm
    libXinerama libXdamage libICE libXtst libXaw fontconfig pango cairo glib libxml2 atk gtk2
    gdk_pixbuf mesa_noglu ncurses
  ];
  runtime_deps = [
    xclock xsettingsd
  ];
in stdenv.mkDerivation {
  name = "MaXX-${version}";

  srcs = [
    (fetchurl {
      url = "http://maxxinteractive.com/downloads/${version}/FEDORA/MaXX-${version}-NO-ARCH.tar.gz";
      sha256 = "1d23j08wwrrn5cp7csv70pcz9jppcn0xb1894wkp0caaliy7g31y";
    })
    (fetchurl {
      url = "http://maxxinteractive.com/downloads/${version}/FEDORA/MaXX-${version}-x86_64.tar.gz";
      sha256 = "156p2lra184wyvibrihisd7cr1ivqaygsf0zfm26a12gx23b7708";
    })
  ];

  nativeBuildInputs = [ makeWrapper ];

  buildPhase = ''
    while IFS= read -r -d ''$'\0' i; do
      substituteInPlace "$i" --replace /opt/MaXX $out/opt/MaXX
    done < <(find "." -type f -exec grep -Iq /opt/MaXX {} \; -and -print0)

    substituteInPlace bin/adminterm \
      --replace /bin/bash ${bash}/bin/bash

    substituteInPlace share/misc/HOME/initMaXX-Desktop-Home.sh \
      --replace "cp " "cp --no-preserve=mode "
  '';

  installPhase = ''
    maxx=$out/opt/MaXX
    mkdir -p "$maxx" $out/share

    mv -- ./* "$maxx"
    ln -s $maxx/share/icons $out/share

    wrapProgram $maxx/etc/skel/Xsession.dt \
      --prefix GTK_PATH : "${gtk-engine-murrine}/lib/gtk-2.0:${gtk_engines}/lib/gtk-2.0" \
      --prefix GDK_PIXBUF_MODULE_FILE : "$(echo ${librsvg.out}/lib/gdk-pixbuf-2.0/*/loaders.cache)" \
      --prefix PATH : ${stdenv.lib.makeBinPath runtime_deps}

    while IFS= read -r -d ''$'\0' i; do
      if isELF "$i"; then
        bin=`patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$i"; echo $?`
        patchelf --set-rpath "${stdenv.lib.makeLibraryPath deps}" "$i"
        if [ "$bin" -eq 0 ]; then
          wrapProgram "$i" \
            --set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
            --set NIX_REDIRECTS /opt/MaXX=$maxx
        fi
      fi
    done < <(find "$maxx" -type f -print0)

    cp ${gcc-unwrapped}/bin/cpp ${gcc-unwrapped}/libexec/gcc/*/*/cc1 $maxx/bin
    for i in $maxx/bin/cpp $maxx/bin/cc1
    do
      wrapProgram "$i" \
        --set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
        --set NIX_REDIRECTS /opt/MaXX=$maxx
    done
  '';

  meta = with stdenv.lib; {
    description = "A replica of IRIX Interactive Desktop";
    homepage = http://www.maxxinteractive.com;
    license = {
      fullName = "The MaXX Interactive Desktop for Linux License Agreement";
      url = http://www.maxxinteractive.com/site/?page_id=97;
      free = false; # redistribution is only allowed to *some* hardware, etc.
    };
    maintainers = [ maintainers.gnidorah ];
    platforms = ["x86_64-linux"];
    hydraPlatforms = [];
    longDescription = ''
      A clone of IRIX Interactive Desktop made in agreement with SGI. 
      Provides simple and fast retro desktop environment.
    '';
  };
}