1{ lib
2, autoPatchelfHook
3, fetchurl
4, gmp
5, less
6, makeWrapper
7, libb2
8, ncurses6
9, openssl
10, stdenv
11, zlib
12}:
13
14stdenv.mkDerivation (finalAttrs: {
15 pname = "unison-code-manager";
16 version = "0.5.24";
17
18 src = if stdenv.isDarwin then
19 fetchurl {
20 url = "https://github.com/unisonweb/unison/releases/download/release/${finalAttrs.version}/ucm-macos.tar.gz";
21 hash = "sha256-5LVcN7ly0n68DFqIjA8EJabZa3WwJf1ueqgJ+gPHNbA=";
22 }
23 else
24 fetchurl {
25 url = "https://github.com/unisonweb/unison/releases/download/release/${finalAttrs.version}/ucm-linux.tar.gz";
26 hash = "sha256-nCNmUYkBWhXL2eN+uQblf7oPkiVwfAKi6v+Cb9Co19g=";
27 };
28
29 # The tarball is just the prebuilt binary, in the archive root.
30 sourceRoot = ".";
31 dontBuild = true;
32 dontConfigure = true;
33
34 nativeBuildInputs = [ makeWrapper ]
35 ++ lib.optional (!stdenv.isDarwin) autoPatchelfHook;
36 buildInputs = lib.optionals (!stdenv.isDarwin) [ gmp ncurses6 zlib ];
37
38 installPhase = ''
39 mkdir -p $out/{bin,lib}
40 mv runtime $out/lib/runtime
41 mv ui $out/ui
42 mv unison $out/unison
43 makeWrapper $out/unison/unison $out/bin/ucm \
44 --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libb2 openssl ]} \
45 --prefix PATH ":" "${lib.makeBinPath [ less ]}" \
46 --add-flags "--runtime-path $out/lib/runtime/bin/unison-runtime" \
47 --set UCM_WEB_UI "$out/ui"
48 '';
49
50 meta = with lib; {
51 description = "Modern, statically-typed purely functional language";
52 homepage = "https://unisonweb.org/";
53 license = with licenses; [ mit bsd3 ];
54 mainProgram = "ucm";
55 maintainers = with maintainers; [ ceedubs sellout virusdave ];
56 platforms = [ "x86_64-darwin" "x86_64-linux" "aarch64-darwin" ];
57 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
58 };
59})