diff --git a/pkgs/applications/networking/instant-messengers/psi/0.11.nix b/pkgs/applications/networking/instant-messengers/psi/0.11.nix index 5cd1ef1c43fa..2f9d9e3b3b72 100644 --- a/pkgs/applications/networking/instant-messengers/psi/0.11.nix +++ b/pkgs/applications/networking/instant-messengers/psi/0.11.nix @@ -1,30 +1,20 @@ +args : with args; +rec { + src = fetchurl { + url = ftp://ftp.ru.debian.org/debian/pool/main/p/psi/psi_0.11.orig.tar.gz; + sha256 = "1rgjahngari4pwhi0zz9mricaaqxkk8ry8w6s1vgsq3zwa2l5x57"; + }; -args : with args; with builderDefs {src="";} null; - let localDefs = builderDefs (rec { - src = /* put a fetchurl here */ - fetchurl { - url = ftp://ftp.ru.debian.org/debian/pool/main/p/psi/psi_0.11.orig.tar.gz; - sha256 = "1rgjahngari4pwhi0zz9mricaaqxkk8ry8w6s1vgsq3zwa2l5x57"; - }; + buildInputs = [aspell qt zlib sox openssl libX11 xproto + libSM libICE]; + configureFlags = [" --with-zlib-inc=${zlib}/include " + " --with-openssl-inc=${openssl}/include " + ]; - buildInputs = [aspell qt zlib sox openssl libX11 xproto - libSM libICE]; - configureFlags = [" --with-zlib-inc=${zlib}/include " - " --with-openssl-inc=${openssl}/include " - ]; - }) args null; /* null is a terminator for sumArgs */ - in with localDefs; -stdenv.mkDerivation rec { - name = "psi-"+version; - MAKE="make"; - builder = writeScript (name + "-builder") - (textClosure localDefs - ["doConfigure" "doMakeInstall" doForceShare doPropagate]); - meta = { - description = " - Psi, an XMPP (Jabber) client. -"; - inherit src; - }; + phaseNames = ["doConfigure" "doMakeInstall"]; + + name = "psi-" + version; + meta = { + description = "Psi, an XMPP (Jabber) client"; + }; } - diff --git a/pkgs/misc/tex/texlive/default.nix b/pkgs/misc/tex/texlive/default.nix index 9d984d09eec1..bc2443acbee3 100644 --- a/pkgs/misc/tex/texlive/default.nix +++ b/pkgs/misc/tex/texlive/default.nix @@ -1,73 +1,79 @@ -args : with args; with builderDefs {src="";} null; - let localDefs = builderDefs (rec { - src = /* put a fetchurl here */ - fetchurl { - url = debian://pool/main/t/texlive-bin/texlive-bin_2007.orig.tar.gz; - sha256 = "1fz5lqbigdrdg0pmaynissd7wn59p2yj9f203nl93dcpffrapxjv"; - }; - texmfSrc = - fetchurl { - url = debian://pool/main/t/texlive-base/texlive-base_2007.orig.tar.gz; - sha256 = "16a4dyliidk43qj0m4gpsl9ln7nqsdcdx1lkbk4wrm03xpx87zvh"; - }; +args : with args; +rec { + src = fetchurl { + url = mirror://debian/pool/main/t/texlive-bin/texlive-bin_2007.orig.tar.gz; + sha256 = "1fz5lqbigdrdg0pmaynissd7wn59p2yj9f203nl93dcpffrapxjv"; + }; + + texmfSrc = fetchurl { + url = mirror://debian/pool/main/t/texlive-base/texlive-base_2007.orig.tar.gz; + sha256 = "16a4dyliidk43qj0m4gpsl9ln7nqsdcdx1lkbk4wrm03xpx87zvh"; + }; - setupHook = ./setup-hook.sh; + langTexmfSrc = fetchurl { + url = mirror://debian/pool/main/t/texlive-lang/texlive-lang_2007.orig.tar.gz; + sha256 = "0cmd9ryd57rzzg7g2gm3qn4ijakkacy810h5zncqd39p3i1yn6nx"; + }; + + setupHook = ./setup-hook.sh; - doInstall = FullDepEntry ('' - ensureDir $out - ensureDir $out/nix-support - cp ${setupHook} $out/nix-support/setup-hook.sh - ensureDir $out/share - tar xf ${texmfSrc} -C $out/share --strip-components=1 - cd build/source - sed -e s@/usr/bin/@@g -i $(grep /usr/bin/ -rl . ) - sed -e '/ubidi_open/i#include ' -i $(find . -name configure) - sed -e s@ncurses/curses.h@curses.h@g -i $(grep ncurses/curses.h -rl . ) - NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${freetype}/include/freetype2" - echo NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${icu}/include/unicode" - NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${icu}/include/layout"; - ./configure --prefix=$out \ - --with-x11 \ - --with-system-zlib \ - --with-system-freetype2 \ - --with-system-t1lib \ - --with-system-pnglib \ - --with-system-gd \ - --with-system-icu \ - --with-system-ncurses \ - --enable-ipc \ - --with-mktexfmt - make - make install - mv $out/bin $out/libexec - ensureDir $out/bin - for i in $out/libexec/*/*; do - echo -ne "#! /bin/sh\\n$i \"\$@\"" >$out/bin/$(basename $i) - chmod a+x $out/bin/$(basename $i) - done - texmf_var=$(mktemp -d /var/tmp/texmf-varXXXXXXXX) - mv $out/share/texmf-var/* $texmf_var/ - chmod -R a+rwX $texmf_var - ln -s $texmf_var $out/share/texmf-var - ln -s $out/share/texmf $out/share/texmf-config - '') ["minInit" "defEnsureDir" "doUnpack" "addInputs"]; - buildInputs = [zlib bzip2 ncurses libpng ed flex bison libX11 xproto - freetype t1lib gd libXaw icu ghostscript - libXt libXpm libXmu libXext xextproto perl libSM - libICE]; - configureFlags = []; - }) args null; /* null is a terminator for sumArgs */ - in with localDefs; -stdenv.mkDerivation rec { - name = "TeXLive-core-2007"; - builder = writeScript (name + "-builder") - (textClosure localDefs - [doInstall doForceShare doPropagate]); - meta = { - description = " - TeX distribution. -"; - inherit src; - srcs = [texmfSrc]; - }; + doPreConfigure = FullDepEntry ('' + ensureDir $out + ensureDir $out/nix-support + cp ${setupHook} $out/nix-support/setup-hook.sh + ensureDir $out/share + tar xf ${texmfSrc} -C $out/share --strip-components=1 + tar xf ${langTexmfSrc} -C $out/share --strip-components=1 + cp -r texmf* $out/share + cd build/source + sed -e s@/usr/bin/@@g -i $(grep /usr/bin/ -rl . ) + sed -e '/ubidi_open/i#include ' -i $(find . -name configure) + sed -e s@ncurses/curses.h@curses.h@g -i $(grep ncurses/curses.h -rl . ) + sed -e 's/.*pyhyph.*/=&/' -i $out/share/texmf-config/tex/generic/config/language.dat + + updmap --syncwithtrees + + NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${freetype}/include/freetype2" + NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${icu}/include/layout"; + '') ["minInit" "doUnpack" "addInputs" "defEnsureDir"]; + + doPostInstall = FullDepEntry('' + mv $out/bin $out/libexec + ensureDir $out/bin + for i in $out/libexec/*/*; do + echo -ne "#! /bin/sh\\n$i \"\$@\"" >$out/bin/$(basename $i) + chmod a+x $out/bin/$(basename $i) + done + texmf_var=$(mktemp -d /var/tmp/texmf-varXXXXXXXX) + mv $out/share/texmf-var/* $texmf_var/ + chmod -R a+rwX $texmf_var + rm -r $out/share/texmf-var + rm -r /var/tmp/texmf-var + ln -sfT $texmf_var $out/share/texmf-var + ln -sfT $texmf_var /var/tmp/texmf-var + ln -s $out/share/texmf $out/share/texmf-config + PATH=$PATH:$out/bin mktexlsr $out/share/texmf* + '') ["minInit" "defEnsureDir" "doUnpack" "doMakeInstall"]; + + buildInputs = [ + zlib bzip2 ncurses libpng flex bison libX11 libICE + xproto freetype t1lib gd libXaw icu ghostscript ed + libXt libXpm libXmu libXext xextproto perl libSM + ]; + + configureFlags = [ "--with-x11" "--with-system-zlib" + "--with-system-freetype2" "--with-system-t1lib" + "--with-system-pnglib" "--with-system-gd" + "--with-system-icu" "--with-system-ncurses" + "--enable-ipc" "--with-mktexfmt" + ]; + + phaseNames = ["doPreConfigure" "doConfigure" + "doMakeInstall" "doPostInstall"]; + + name = "texlive-core-2007"; + meta = { + description = "A TeX distribution"; + srcs = [texmfSrc langTexmfSrc]; + }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1798a03de1b2..d98cb46490d5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -270,6 +270,9 @@ let pkgs = rec { inherit stringsWithDeps lib stdenv writeScript fetchurl; }; + builderDefsPackage = expr: lib.sumArgs + (((builderDefs null).builderDefsPackage builderDefs) expr); + stringsWithDeps = import ../lib/strings-with-deps.nix { inherit stdenv lib; }; @@ -6076,11 +6079,13 @@ let pkgs = rec { inherit fetchurl stdenv tetex lazylist; }; - psiFun = lib.sumArgs (selectVersion ../applications/networking/instant-messengers/psi "0.11") { - inherit builderDefs zlib aspell sox openssl; - inherit (xlibs) xproto libX11 libSM libICE; - qt = qt4; - }; + psiFun = builderDefsPackage + (selectVersion ../applications/networking/instant-messengers/psi "0.11") + { + inherit builderDefs zlib aspell sox openssl; + inherit (xlibs) xproto libX11 libSM libICE; + qt = qt4; + }; psi = psiFun null; @@ -6146,7 +6151,7 @@ let pkgs = rec { inherit stdenv perl tetex graphviz ghostscript; }; - texLiveFun = lib.sumArgs (import ../misc/tex/texlive) { + texLiveFun = builderDefsPackage (import ../misc/tex/texlive) { inherit builderDefs zlib bzip2 ncurses libpng ed gd t1lib freetype icu perl; inherit (xlibs) libXaw libX11 xproto libXt libXpm diff --git a/pkgs/top-level/builder-defs.nix b/pkgs/top-level/builder-defs.nix index d06ebb941032..cd86ba67f384 100644 --- a/pkgs/top-level/builder-defs.nix +++ b/pkgs/top-level/builder-defs.nix @@ -3,6 +3,8 @@ args: with args; with stringsWithDeps; with lib; { inherit writeScript; + src = getAttr ["src"] "" args; + addSbinPath = getAttr ["addSbinPath"] false args; forceShare = if args ? forceShare then args.forceShare else ["man" "doc" "info"]; @@ -385,4 +387,18 @@ args: with args; with stringsWithDeps; with lib; GHC_PACKAGE_PATH=\$PACKAGE_DB ./register.sh " ["defCreateEmptyPackageDatabaseAndSetupHook" "defCabalSetupCmd"]; + phaseNames = args.phaseNames ++ + ["doForceShare" "doPropagate"]; + + builderDefsPackage = bd: func: args: ( + let localDefs = bd (func ((bd null) // args)) args null; in + + stdenv.mkDerivation (rec { + inherit (localDefs) name; + builder = writeScript (name + "-builder") + (textClosure localDefs localDefs.phaseNames); + meta = localDefs.meta // {inherit src;}; + }) + ); + }) // args diff --git a/pkgs/top-level/template-composing+config.nix b/pkgs/top-level/template-composing+config.nix index 56d5e1fa4837..7f7e55302dda 100644 --- a/pkgs/top-level/template-composing+config.nix +++ b/pkgs/top-level/template-composing+config.nix @@ -16,9 +16,7 @@ stdenv.mkDerivation rec { builder = writeScript (name + "-builder") (textClosure localDefs [(abort "Check phases") doMakeInstall doForceShare doPropagate]); meta = { - description = " - ${(abort "Specify description")} -"; + description = "${(abort "Specify description")}"; inherit src; }; } diff --git a/pkgs/top-level/template-composing-builder.nix b/pkgs/top-level/template-composing-builder.nix index 965bc082aba9..7725d7986fd1 100644 --- a/pkgs/top-level/template-composing-builder.nix +++ b/pkgs/top-level/template-composing-builder.nix @@ -1,4 +1,4 @@ -args : with args; with builderDefs {src="";} null; +args : with args; with builderDefs null; let localDefs = builderDefs (rec { src = /* put a fetchurl here */ @@ -12,9 +12,7 @@ stdenv.mkDerivation rec { (textClosure localDefs [(abort "Specify phases - defined here or in builderDefs") doForceShare doPropagate]); meta = { - description = " - ${abort "Write a description"} -"; + description = "${abort "Write a description"}"; inherit src; }; }