2021-08-05 21:33:18 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, ocamlPackages
|
|
|
|
, copyDesktopItems
|
|
|
|
, makeDesktopItem
|
2024-05-15 15:35:15 +00:00
|
|
|
, wrapGAppsHook3
|
2023-02-22 10:55:15 +00:00
|
|
|
, gsettings-desktop-schemas
|
2024-02-29 20:09:43 +00:00
|
|
|
, enableX11 ? !stdenv.isDarwin
|
2021-08-05 21:33:18 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "unison";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "2.53.5";
|
2021-08-05 21:33:18 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bcpierce00";
|
|
|
|
repo = "unison";
|
2023-07-15 17:15:38 +00:00
|
|
|
rev = "v${finalAttrs.version}";
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-XCdK38jG7tRI+/Zk72JVY8a/pPJF6KVaf8l2s3hgxLs=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
# uimac requires xcode
|
|
|
|
postPatch = ''
|
|
|
|
sed -i -e 's/ macuimaybe//' src/Makefile
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
nativeBuildInputs = [ ocamlPackages.ocaml ocamlPackages.findlib ]
|
2024-05-15 15:35:15 +00:00
|
|
|
++ lib.optionals enableX11 [ copyDesktopItems wrapGAppsHook3 ];
|
2024-02-29 20:09:43 +00:00
|
|
|
buildInputs = lib.optionals enableX11 [ gsettings-desktop-schemas ocamlPackages.lablgtk3 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
makeFlags = [ "PREFIX=$(out)" ]
|
|
|
|
++ lib.optionals (!ocamlPackages.ocaml.nativeCompilers) [ "NATIVE=false" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
postInstall = lib.optionalString enableX11 ''
|
|
|
|
install -D $src/icons/U.svg $out/share/icons/hicolor/scalable/apps/unison.svg
|
|
|
|
'';
|
|
|
|
|
|
|
|
dontStrip = !ocamlPackages.ocaml.nativeCompilers;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
desktopItems = lib.optional enableX11 (makeDesktopItem {
|
2023-07-15 17:15:38 +00:00
|
|
|
name = finalAttrs.pname;
|
2021-08-05 21:33:18 +00:00
|
|
|
desktopName = "Unison";
|
|
|
|
comment = "Bidirectional file synchronizer";
|
|
|
|
genericName = "File synchronization tool";
|
2024-02-29 20:09:43 +00:00
|
|
|
exec = "unison-gui";
|
2021-08-05 21:33:18 +00:00
|
|
|
icon = "unison";
|
2022-03-05 16:20:37 +00:00
|
|
|
categories = [ "Utility" "FileTools" "GTK" ];
|
|
|
|
startupNotify = true;
|
|
|
|
startupWMClass = "Unison";
|
2021-08-05 21:33:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://www.cis.upenn.edu/~bcpierce/unison/";
|
|
|
|
description = "Bidirectional file synchronizer";
|
2021-08-05 21:33:18 +00:00
|
|
|
license = licenses.gpl3Plus;
|
2024-02-29 20:09:43 +00:00
|
|
|
maintainers = with maintainers; [ viric nevivurn ];
|
2021-08-05 21:33:18 +00:00
|
|
|
platforms = platforms.unix;
|
2024-02-29 20:09:43 +00:00
|
|
|
broken = stdenv.isDarwin && enableX11; # unison-gui and uimac are broken on darwin
|
|
|
|
mainProgram = if enableX11 then "unison-gui" else "unison";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
})
|