NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.04k stars 13.38k forks source link

ejabberd: not compiled with sqlite support #161126

Open ghost opened 2 years ago

ghost commented 2 years ago

Describe the bug

I would like to use ejabberd with an sqlite database, but the package in NixOS is not compiled with such support.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Enable ejabberd
  2. Use sqlite database in configuration
  3. Apply changes

Expected behavior

The user should be able to use sqlite as database backend.

Screenshots

If applicable, add screenshots to help explain your problem.

2022-02-21 06:35:19.751176+08:00 [critical] <0.249.0>@ejabberd:exit_or_halt/2:145 Failed to start Erlang application 'sqlite3': no such file or directory: sqlite3.app. This usually means that ejabberd or Erlang was compiled/installed incorrectly.

Additional context

Add any other context about the problem here.

Notify maintainers

@genofire @svanderburg @abbradar

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.98-hardened1, NixOS, 21.11 (Porcupine)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.16`
 - channels(root): `"nixos-21.11.336020.2128d0aa28e"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
ghost commented 2 years ago

Turns out it does not support postgresql, either.

Feb 21 07:30:24 tl ejabberdctl[76671]: 2022-02-21 07:30:24.940289+08:00 [critical] Failed to start Erlang application 'p1_pgsql': no such file or directory: p1_pgsql.app. This usually means that ejabberd or Erlang was compiled/installed incorrectly.
lmeunier commented 1 year ago

Hi @ne9z

I've the exact same error with nixos 23.05 and ejabberd 23.01.

2023-06-08 14:00:13.978444+02:00 [critical] <0.401.0>@ejabberd:exit_or_halt/2:148 Failed to start Erlang application 'sqlite3': no such file or directory: sqlite3.app. This usually means that ejabberd or Erlang was compiled/installed incorrectly.

Did you find a way to solve this issue?

ghost commented 1 year ago

Unfortunately not. I've switched to Prosody instead, as it is better supported on NixOS.

Laurent Meunier @.***> writes:

Hi @ne9z

I've the exact same error with nixos 23.05 and ejabberd 23.01.

2023-06-08 14:00:13.978444+02:00 [critical] ***@***.***:exit_or_halt/2:148 Failed to start Erlang application 'sqlite3': no such file or directory: sqlite3.app. This usually means that ejabberd or Erlang was compiled/installed incorrectly.

Did you find a way to solve this issue?

-- Reply to this email directly or view it on GitHub: https://github.com/NixOS/nixpkgs/issues/161126#issuecomment-1582830943 You are receiving this because you were mentioned.

Message ID: @.***>

lmeunier commented 1 year ago

Thanks for your prompt reply. It's appreciated.

lmeunier commented 1 year ago

I managed to build ejabberd with sqlite support using the available ejabberd derivation on nixpkgs.

Create a new file /etc/nixos/ejabberd.nix:

{ pkgs, nixpkgs, ... }:

{
  environment.systemPackages = with pkgs; [
    ejabberd
  ];

  nixpkgs.config = {
    packageOverrides = pkgs: {
      ejabberd = pkgs.ejabberd.override { withSqlite = true; };
    };
  };

  services.ejabberd.enable = true;
  services.ejabberd.configFile = /path/to/ejabberd.yml;
  [...]
}

The important part is the line ejabberd = pkgs.ejabberd.override { withSqlite = true; };.

Then import this file in /etc/nixos/configuration.nix:

  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
      ./ejabberd.nix
    ];

And apply changes with this command:

nixos-rebuild switch

Sources:

The only downside is that the new ejabberd package with sqlite support must be build as there is no build cache available on https://cache.nixos.org for ejabberd with sqlite support. On my laptop it took a couple of minutes, now I'll test on my rpi3 (and I think it will took a bit more time 🙃 ).

Hope this help.