1{
2 lib,
3 stdenv,
4 fetchurl,
5 file,
6 openssl,
7 mlton,
8 libmysqlclient,
9 libpq,
10 sqlite,
11 gcc,
12 icu,
13}:
14
15stdenv.mkDerivation rec {
16 pname = "urweb";
17 version = "20200209";
18
19 src = fetchurl {
20 url = "https://github.com/urweb/urweb/releases/download/${version}/${pname}-${version}.tar.gz";
21 sha256 = "0qh6wcxfk5kf735i5gqwnkdirnnmqhnnpkfz96gz144dgz2i0c5c";
22 };
23
24 buildInputs = [
25 openssl
26 mlton
27 libmysqlclient
28 libpq
29 sqlite
30 icu
31 ];
32
33 prePatch = ''
34 sed -e 's@/usr/bin/file@${file}/bin/file@g' -i configure
35 '';
36
37 configureFlags = [ "--with-openssl=${openssl.dev}" ];
38
39 preConfigure = ''
40 export MSHEADER="${libmysqlclient}/include/mysql/mysql.h";
41 export SQHEADER="${sqlite.dev}/include/sqlite3.h";
42 export ICU_INCLUDES="-I${icu.dev}/include";
43
44 export CC="${gcc}/bin/gcc";
45 export CCARGS="-I$out/include \
46 -L${lib.getLib openssl}/lib \
47 -L${libmysqlclient}/lib \
48 -L${libpq}/lib \
49 -L${sqlite.out}/lib";
50 '';
51
52 env.NIX_CFLAGS_COMPILE = toString [
53 # Needed with GCC 12
54 "-Wno-error=use-after-free"
55 ];
56
57 # Be sure to keep the statically linked libraries
58 dontDisableStatic = true;
59
60 meta = {
61 description = "Advanced purely-functional web programming language";
62 mainProgram = "urweb";
63 homepage = "http://www.impredicative.com/ur/";
64 license = lib.licenses.bsd3;
65 platforms = lib.platforms.linux ++ lib.platforms.darwin;
66 maintainers = [
67 lib.maintainers.thoughtpolice
68 lib.maintainers.sheganinans
69 ];
70 };
71}