[Nix-dev] Ejabberd Options

Luca Bruno lethalman88 at gmail.com
Tue Dec 16 10:00:00 CET 2014


On 16/12/2014 05:31, stewart mackenzie wrote:
> Luca, here is my config, I've stripped everything that isn't pertinent
> to the testing setup (which will use NixOS).
>
> I've pointed my hydra nixpkgs jobset input to my github nixpkgs fork
> on the ejabberd branch which contains this commit:
> https://github.com/sjmackenzie/nixpkgs/commit/ad694e4ece4201d64d524d94e8284c8ee9affdff
>
> I have verified that hydra cloned it correctly and the change exists
> in /data/scm/git/48ac**** directory.
>
> So I take it the overriding of the services.ejabberd.package would be
> something similar to this?
>
> let
>   pkgs = import <nixpkgs> {};
>   services.ejabberd.package = chaatz-ejabberd;
>   jobs = rec {
>     chaatz-ejabberd = pkgs.stdenv.mkDerivation rec {
>       name = "chaatz-ejabberd";
>       src = <chaatz-ejabberd>;
>       buildInputs = ( with pkgs; [
>         expat erlang zlib openssl pam automake
>         autoconf git libyaml openssh libcouchbase ]);
>       preConfigure = "./autogen.sh";
>     };
>   };
> in
>   jobs
No that services.ejabberd.package there doesn't make sense. The culprit
here is that you are doing copy/paste, trial and error, guessing how
things work instead of sitting and understanding how they really work.
Perhaps the most common mistake is thinking there's some magic. You'll
never make any progress without learning the language.

"let" is used to define temporary variables, so doing
"services.ejabberd.package" doesn't really do anything besides creating
a temporary variable services = { ejabberd = { package =
chaatz-ejabberd; }; };. So this line is useless.
Then chaatz-ejabberd there is not defined anywhere, hence the error.

Nix is not easy to grasp, but since you are going to make custom things
that goes beyond simple packaging, I really suggest you to take your
time and read the documentation around nix, and read more code,
especially nixos/tests.

My main hint: don't make assumptions about magic or anything like that,
Nix is a language and as such it has *rules* and must be learned if you
want to use it decently.



More information about the nix-dev mailing list