1{ lib, stdenv, fetchurl, autoPatchelfHook
2, ncurses5, zlib, gmp
3, makeWrapper
4, less
5}:
6
7stdenv.mkDerivation rec {
8 pname = "unison-code-manager";
9 milestone_id = "M4c";
10 version = "1.0.${milestone_id}-alpha";
11
12 src = if (stdenv.isDarwin) then
13 fetchurl {
14 url = "https://github.com/unisonweb/unison/releases/download/release/${milestone_id}/ucm-macos.tar.gz";
15 sha256 = "sha256-mkzIC/cPkpH0obEBqkvvKVh74LaV6jkfyEMLHmJn/nE=";
16 }
17 else
18 fetchurl {
19 url = "https://github.com/unisonweb/unison/releases/download/release/${milestone_id}/ucm-linux.tar.gz";
20 sha256 = "sha256-LfT/pMOvfBAwew6NW0VNvuB5c1AC7b+qKraP25+kytg=";
21 };
22
23 # The tarball is just the prebuilt binary, in the archive root.
24 sourceRoot = ".";
25 dontBuild = true;
26 dontConfigure = true;
27
28 nativeBuildInputs = [ makeWrapper ] ++ (lib.optional (!stdenv.isDarwin) autoPatchelfHook);
29 buildInputs = lib.optionals (!stdenv.isDarwin) [ ncurses5 zlib gmp ];
30
31 installPhase = ''
32 mkdir -p $out/bin
33 mv ucm $out/bin
34 mv ui $out/ui
35 wrapProgram $out/bin/ucm \
36 --prefix PATH ":" "${lib.makeBinPath [ less ]}" \
37 --set UCM_WEB_UI "$out/ui"
38 '';
39
40 meta = with lib; {
41 description = "Modern, statically-typed purely functional language";
42 homepage = "https://unisonweb.org/";
43 license = with licenses; [ mit bsd3 ];
44 maintainers = [ maintainers.virusdave ];
45 platforms = [ "x86_64-darwin" "x86_64-linux" "aarch64-darwin" ];
46 };
47}