Overriding dependent package buildInput for prosody/luadbi?

So I have a prosody service which I’d to build with support for postgresql, which seems to require that I add another luarocks package, and I can’t for the life of me figure out how to do it.

On master (I’m running 19.03) I can see that there’s luarocks packages for luadbi which support postgresql, and I’ve tried various ways of stealing that:

{ config, pkgs, lua, luaPackages, ... }:
self: super:
  luadbi-postgresql = buildLuarocksPackage {
    pname = "luadbi-postgresql";
    version = "0.7.2-1";

    src = fetchurl {
      url    = https://luarocks.org/luadbi-postgresql-0.7.2-1.src.rock;
      sha256 = "0nmm1hdzl77wk8p6r6al6mpkh2n332a8r3iqsdi6v4nxamykdh28";
    disabled = (luaOlder "5.1") || (luaAtLeast "5.4");
    propagatedBuildInputs = [ lua luadbi ];

    meta = with stdenv.lib; {
      homepage = "https://github.com/mwild1/luadbi";
      description = "Database abstraction layer";
      license = {
        fullName = "MIT/X11";

and then simply importing it in my system wide configuration. But this failed as buildLuarocksPackage can’t be resolved, and I didn’t go far enough into building lua packages to figure out how to fix it.

What’s a better way of building prosody with a luadbi that supports postgresql?

the doc for overlay is a WIP but it contains a section on overlays doc: update lua documentation by teto · Pull Request #55302 · NixOS/nixpkgs · GitHub .
Alternatively you can lookup home/lua.nix at af268c23b2ab4ac1c2d8a0e40daeca81cb320268 · teto/home · GitHub

If the nixpkgs you’re using is old enough that it doesn’t have luadbi-postgresql (which should be the case if you’re on 19.03), then you shouldn’t need it.

Originally the luadbi frontend and all of the backends (mysql, postgresql, sqlite3) were in one package, and as prosody has withDBI = true by default, it should Just Work™. Are you getting some DBI-related error currently…?


Well, turns out you were right! I feel like a fool now. :smiley:

I hadn’t configured my prosody to actually use postgres. When I did it worked fine!