diff --git a/pkgs/applications/networking/sync/unison/default.nix b/pkgs/applications/networking/sync/unison/default.nix index 6b00500b6623..ba62c36980d5 100644 --- a/pkgs/applications/networking/sync/unison/default.nix +++ b/pkgs/applications/networking/sync/unison/default.nix @@ -1,4 +1,5 @@ -{stdenv, fetchurl, ocaml, lablgtk, fontschumachermisc, xset, makeWrapper}: +{stdenv, fetchurl, ocaml, lablgtk, fontschumachermisc, xset, makeWrapper +, enableX11 ? true}: stdenv.mkDerivation (rec { @@ -10,17 +11,20 @@ stdenv.mkDerivation (rec { buildInputs = [ocaml makeWrapper]; - preBuild = '' + preBuild = if enableX11 then '' sed -i "s|\(OCAMLOPT=.*\)$|\1 -I $(echo "${lablgtk}"/lib/ocaml/*/site-lib/lablgtk2)|" Makefile.OCaml - ''; - makeFlags = "UISTYLE=gtk2 INSTALLDIR=$(out)/bin/"; + '' else ""; + + makeFlags = "INSTALLDIR=$(out)/bin/" + (if enableX11 then "UISTYLE=gtk2" else ""); + preInstall = "ensureDir $out/bin"; - postInstall = '' + + postInstall = if enableX11 then '' for i in $(cd $out/bin && ls); do wrapProgram $out/bin/$i \ --run "[ -n \"\$DISPLAY\" ] && (${xset}/bin/xset q | grep -q \"${fontschumachermisc}\" || ${xset}/bin/xset +fp \"${fontschumachermisc}/lib/X11/fonts/misc\")" done - ''; + '' else ""; meta = { homepage = http://www.cis.upenn.edu/~bcpierce/unison/; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 203e4b4d940e..60c667ba38b0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6576,6 +6576,7 @@ let unison = callPackage ../applications/networking/sync/unison { inherit (ocamlPackages) lablgtk; + enableX11 = getConfig [ "unison" "enableX11" ] true; }; uucp = callPackage ../tools/misc/uucp { };