The freeswitch package is incomplete. It is missing dependencies. I don’t have the confidence or skillset yet to submit a change for fear it might negatively affect others using the package. Additionally, I’m not entirely sure about the requirements for doing so.
In this package there is a modules.nix file. It is used to declare the dependencies for each source freeswitch module for freeswitch compilation. From the comment, you can see that it is missing required inputs.
As an example, the erlang_event source module requires erlang, but that is not provided in the source. So adding anything that requires the erlang input will cause compilation to fail.
Here is what I’m using right now:
{
description = "Telex flake";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
erlangVersion = "erlangR25";
elixirVersion = "elixir_1_15";
erlang = pkgs.beam.interpreters.${erlangVersion};
beamPackages = pkgs.beam.packages.${erlangVersion};
elixir = beamPackages.${elixirVersion};
freeswitch = pkgs.freeswitch.override({
modules = mods: with mods; [
# other modules
event_handlers.kazoo
] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [ endpoints.gsmopen ];
});
in
with pkgs; {
packages.start-switch = pkgs.writeScriptBin "start-switch" ''
${freeswitch}/bin/freeswitch -base .freeswitch -mod ${freeswitch}/lib/freeswitch/mod
'';
devShells.default = pkgs.mkShell {
buildInputs = [
erlang
elixir
freeswitch
]
++ lib.optionals stdenv.isLinux [
libnotify
inotify-tools
]
++ lib.optionals stdenv.isDarwin [
terminal-notifier
darwin.apple_sdk.frameworks.CoreFoundation
darwin.apple_sdk.frameworks.CoreServices
];
shellHook = ''
# allows mix to work on the local directory
mkdir -p .nix-mix
mkdir -p .nix-hex
export MIX_HOME=$PWD/.nix-mix
export HEX_HOME=$PWD/.nix-hex
export ERL_LIBS=$HEX_HOME/lib/erlang/lib
# concats PATH
export PATH=$MIX_HOME/bin:$PATH
export PATH=$MIX_HOME/escripts:$PATH
export PATH=$HEX_HOME/bin:$PATH
# enables history for IEx
export ERL_AFLAGS="-kernel shell_history enabled -kernel shell_history_path '\"$PWD/.erlang-history\"'"
'';
};
}
);
}
The problem here is that an override isn’t enough. modules.nix
needs to take additional inputs as arguments. How do I go about providing the correct inputs to modules.nix
so that the source file can build?
I worked with someone elsewhere where we used overrideAttrs
, but it defeats the purpose of the modules.nix
file entirely. And it will get potentially unwieldy if additional items need more build inputs.