diff --git a/pkgs/servers/sql/mariadb/default.nix b/pkgs/servers/sql/mariadb/default.nix index fea5583ea591..7b7aaa5597f1 100644 --- a/pkgs/servers/sql/mariadb/default.nix +++ b/pkgs/servers/sql/mariadb/default.nix @@ -2,6 +2,7 @@ , libiconv, openssl, pcre, boost, judy, bison, libxml2 , libaio, libevent, groff, jemalloc, cracklib, systemd, numactl, perl , fixDarwinDylibNames, cctools, CoreServices +, asio, buildEnv, check, qt4, scons }: with stdenv.lib; @@ -12,6 +13,12 @@ mariadb = everything // { inherit client; # libmysqlclient.so in .out, necessary headers in .dev and utils in .bin server = everything; # a full single-output build, including everything in `client` again inherit connector-c; # libmysqlclient.so + inherit galera; +}; + +galeraLibs = buildEnv { + name = "galera-lib-inputs-united"; + paths = [ openssl.out boost check ]; }; common = rec { # attributes common to both builds @@ -150,6 +157,7 @@ everything = stdenv.mkDerivation (common // { "-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1" "-DWITHOUT_FEDERATED_STORAGE_ENGINE=1" "-DWITH_WSREP=ON" + "-DWITH_INNODB_DISALLOW_WRITES=ON" ] ++ stdenv.lib.optionals stdenv.isDarwin [ "-DWITHOUT_OQGRAPH_STORAGE_ENGINE=1" "-DWITHOUT_TOKUDB=1" @@ -159,6 +167,7 @@ everything = stdenv.mkDerivation (common // { rm -r "$out"/data # Don't need testing data rm "$out"/share/man/man1/mysql-test-run.pl.1 rm "$out"/bin/rcmysql + sed -i 's/-mariadb/-mysql/' "$out"/bin/galera_new_cluster ''; CXXFLAGS = optionalString stdenv.isi686 "-fpermissive" @@ -206,4 +215,52 @@ connector-c = stdenv.mkDerivation rec { }; }; +galera = stdenv.mkDerivation rec { + name = "mariadb-galera-${version}"; + version = "25.3.23"; + + src = fetchurl { + url = "https://mirrors.nxthost.com/mariadb/mariadb-10.2.14/galera-${version}/src/galera-${version}.tar.gz"; + sha256 = "11pfc85z29jk0h6g6bmi3hdv4in4yb00xsr2r0qm1b0y7m2wq3ra"; + }; + + buildInputs = [ asio boost check openssl qt4 scons ]; + + patchPhase = '' + substituteInPlace SConstruct \ + --replace "boost_library_path = '''" "boost_library_path = '${boost}/lib'" + ''; + + preConfigure = '' + export CPPFLAGS="-I${asio}/include -I${boost.dev}/include -I${check}/include -I${openssl.dev}/include" + export LIBPATH="${galeraLibs}/lib" + ''; + + buildPhase = '' + scons -j$NIX_BUILD_CORES ssl=1 system_asio=1 strict_build_flags=0 + ''; + + installPhase = '' + # copied with modifications from scripts/packages/freebsd.sh + GALERA_LICENSE_DIR="$share/licenses/${name}" + install -d $out/{bin,lib/galera,share/doc/galera,$GALERA_LICENSE_DIR} + install -m 555 "garb/garbd" "$out/bin/garbd" + install -m 444 "libgalera_smm.so" "$out/lib/galera/libgalera_smm.so" + install -m 444 "scripts/packages/README" "$out/share/doc/galera/" + install -m 444 "scripts/packages/README-MySQL" "$out/share/doc/galera/" + install -m 444 "scripts/packages/freebsd/LICENSE" "$out/$GALERA_LICENSE_DIR" + install -m 444 "LICENSE" "$out/$GALERA_LICENSE_DIR/GPLv2" + install -m 444 "asio/LICENSE_1_0.txt" "$out/$GALERA_LICENSE_DIR/LICENSE.asio" + install -m 444 "www.evanjones.ca/LICENSE" "$out/$GALERA_LICENSE_DIR/LICENSE.crc32c" + install -m 444 "chromium/LICENSE" "$out/$GALERA_LICENSE_DIR/LICENSE.chromium" + ''; + + meta = { + description = "Galera 3 wsrep provider library"; + homepage = http://galeracluster.com/; + license = licenses.lgpl2; + maintainers = with maintainers; [ izorkin ]; + platforms = platforms.all; + }; +}; in mariadb