aboutsummaryrefslogtreecommitdiff
path: root/overlays/databases/mysql/default.nix
blob: f9e5791fd156798808c466a84dfee32a3abbedbd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
self: super: rec {
  mariadb_pam = super.mariadb.overrideAttrs(old: {
    cmakeFlags = old.cmakeFlags ++ [ "-DWITH_AUTHENTICATION_PAM=ON" ];
    buildInputs = old.buildInputs ++ [ self.pam ];
    outputs = old.outputs ++ [ "dev" ];
    postInstall = ''
      mkdir -p $dev $dev/lib $dev/share
      cp -a $out/include $dev
      cp -a $out/lib/{libmariadbclient.a,libmysqlclient.a,libmysqlclient_r.a,libmysqlservices.a} $dev/lib
      cp -a $out/lib/pkgconfig $dev/lib
      cp -a $out/share/aclocal $dev/share
    '' + old.postInstall;
  });
  # This patched version includes C headers from the server part (see
  # above). It seems to be required to build pam support in clients.
  libmysqlclient_pam = super.libmysqlclient.overrideAttrs(old: {
    prePatch = old.prePatch or "" + ''
      sed -i -e '/define INCLUDE/s|"$| -I@CMAKE_SYSROOT@@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDEDIR@/mysql/server -I@CMAKE_SYSROOT@@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDEDIR@/mysql/server/private"|' mariadb_config/mariadb_config.c.in
    '';
    postInstall = old.postInstall or "" + ''
      cp -a ${mariadb_pam.dev}/include/* $out/include/mariadb
    '';
  });
}