1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/pkgs/applications/networking/sync/unison/default.nix

50 lines
1.5 KiB
Nix
Raw Normal View History

2021-01-15 13:21:58 +00:00
{lib, stdenv, fetchFromGitHub, ocamlPackages, fontschumachermisc, xset, makeWrapper, ncurses, gnugrep
, enableX11 ? true}:
2020-03-08 15:58:51 +00:00
let inherit (ocamlPackages) ocaml lablgtk; in
stdenv.mkDerivation (rec {
pname = "unison";
2020-11-11 11:02:43 +00:00
version = "2.51.3";
2019-02-13 11:25:01 +00:00
src = fetchFromGitHub {
owner = "bcpierce00";
repo = "unison";
rev = "v${version}";
2020-11-11 11:02:43 +00:00
sha256 = "sha256-42hmdMwOYSWGiDCmhuqtpCWtvtyD2l+kA/bhHD/Qh5Y=";
};
buildInputs = [ ocaml makeWrapper ncurses ];
preBuild = (if enableX11 then ''
2019-02-13 11:25:01 +00:00
sed -i "s|\(OCAMLOPT=.*\)$|\1 -I $(echo "${lablgtk}"/lib/ocaml/*/site-lib/lablgtk2)|" src/Makefile.OCaml
'' else "") + ''
2019-02-13 11:25:01 +00:00
echo -e '\ninstall:\n\tcp $(FSMONITOR)$(EXEC_EXT) $(INSTALLDIR)' >> src/fsmonitor/linux/Makefile
'';
makeFlags = [
"INSTALLDIR=$(out)/bin/"
"UISTYLE=${if enableX11 then "gtk2" else "text"}"
2021-01-15 13:21:58 +00:00
] ++ lib.optional (!ocaml.nativeCompilers) "NATIVE=false";
preInstall = "mkdir -p $out/bin";
postInstall = if enableX11 then ''
for i in $(cd $out/bin && ls); do
wrapProgram $out/bin/$i \
--run "[ -n \"\$DISPLAY\" ] && (${xset}/bin/xset q | ${gnugrep}/bin/grep -q \"${fontschumachermisc}\" || ${xset}/bin/xset +fp \"${fontschumachermisc}/lib/X11/fonts/misc\")"
done
'' else "";
dontStrip = !ocaml.nativeCompilers;
meta = {
homepage = "https://www.cis.upenn.edu/~bcpierce/unison/";
description = "Bidirectional file synchronizer";
2021-01-15 13:21:58 +00:00
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [viric];
platforms = with lib.platforms; unix;
};
})