maxx: use libredirect

This commit is contained in:
gnidorah 2017-08-24 19:34:08 +03:00
parent b73ae0a695
commit 15ae2cbeea
2 changed files with 41 additions and 23 deletions

View File

@ -13,12 +13,6 @@ in {
config = mkIf (xcfg.enable && cfg.enable) { config = mkIf (xcfg.enable && cfg.enable) {
environment.systemPackages = [ pkgs.maxx ]; environment.systemPackages = [ pkgs.maxx ];
# there is hardcoded path in binaries
system.activationScripts.setup-maxx = ''
mkdir -p /opt
ln -sfn ${pkgs.maxx}/opt/MaXX /opt
'';
services.xserver.desktopManager.session = [ services.xserver.desktopManager.session = [
{ name = "MaXX"; { name = "MaXX";
start = '' start = ''

View File

@ -1,16 +1,21 @@
{ stdenv, fetchurl, makeWrapper { stdenv, fetchurl, makeWrapper, libredirect, gcc-unwrapped, bash, gtk-engine-murrine, gtk_engines, librsvg
, libX11, libXext, libXi, libXau, libXrender, libXft, libXmu, libSM, libXcomposite, libXfixes, libXpm , libX11, libXext, libXi, libXau, libXrender, libXft, libXmu, libSM, libXcomposite, libXfixes, libXpm
, libXinerama, libXdamage, libICE, libXtst, libXaw , libXinerama, libXdamage, libICE, libXtst, libXaw, fontconfig, pango, cairo, glib, libxml2, atk, gtk2
, fontconfig, pango, cairo, glib, libxml2, atk, gtk2, gdk_pixbuf, mesa_noglu, ncurses , gdk_pixbuf, mesa_noglu, ncurses
, gcc, xclock, xsettingsd, bash, gtk-engine-murrine, gtk_engines, librsvg }:
, xclock, xsettingsd }:
let let
version = "Indy-1.1.0"; version = "Indy-1.1.0";
deps = [ deps = [
libX11 libXext libXi libXau libXrender libXft libXmu libSM libXcomposite libXfixes libXpm stdenv.cc.cc libX11 libXext libXi libXau libXrender libXft libXmu libSM libXcomposite libXfixes libXpm
libXinerama libXdamage libICE libXtst libXaw libXinerama libXdamage libICE libXtst libXaw fontconfig pango cairo glib libxml2 atk gtk2
stdenv.cc.cc fontconfig pango cairo glib libxml2 atk gtk2 gdk_pixbuf mesa_noglu ncurses gdk_pixbuf mesa_noglu ncurses
];
runtime_deps = [
xclock xsettingsd
]; ];
in stdenv.mkDerivation { in stdenv.mkDerivation {
name = "MaXX-${version}"; name = "MaXX-${version}";
@ -26,15 +31,12 @@ in stdenv.mkDerivation {
}) })
]; ];
buildInputs = [ makeWrapper ]; nativeBuildInputs = [ makeWrapper ];
buildPhase = '' buildPhase = ''
while IFS= read -r -d $'\0' i; do while IFS= read -r -d $'\0' i; do
if isELF "$i"; then substituteInPlace "$i" --replace /opt/MaXX $out/opt/MaXX
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$i" || true done < <(find "." -type f -exec grep -Iq /opt/MaXX {} \; -and -print0)
patchelf --set-rpath "${stdenv.lib.makeLibraryPath deps}" "$i"
fi
done < <(find "." -type f -print0)
substituteInPlace bin/adminterm \ substituteInPlace bin/adminterm \
--replace /bin/bash ${bash}/bin/bash --replace /bin/bash ${bash}/bin/bash
@ -52,15 +54,37 @@ in stdenv.mkDerivation {
wrapProgram $maxx/etc/skel/Xsession.dt \ wrapProgram $maxx/etc/skel/Xsession.dt \
--prefix GTK_PATH : "${gtk-engine-murrine}/lib/gtk-2.0:${gtk_engines}/lib/gtk-2.0" \ --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 GDK_PIXBUF_MODULE_FILE : "$(echo ${librsvg.out}/lib/gdk-pixbuf-2.0/*/loaders.cache)" \
''; --prefix PATH : ${stdenv.lib.makeBinPath runtime_deps}
propagatedUserEnvPkgs = [ gcc xclock xsettingsd ]; 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; { meta = with stdenv.lib; {
description = "A replica of IRIX Interactive Desktop"; description = "A replica of IRIX Interactive Desktop";
homepage = http://www.maxxinteractive.com; homepage = http://www.maxxinteractive.com;
license = licenses.free; license = {
url = http://www.maxxinteractive.com/site/?page_id=97;
free = true;
};
maintainers = [ maintainers.gnidorah ]; maintainers = [ maintainers.gnidorah ];
platforms = ["x86_64-linux"]; platforms = ["x86_64-linux"];
hydraPlatforms = []; hydraPlatforms = [];