Re: [Nix-dev] Ejabberd Options

2014-12-16 Thread Luca Bruno
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.

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Ejabberd Options

2014-12-16 Thread stewart mackenzie
Absolutely Luca, you're absolutely right.

I suspect a book needs to be written on NixOS + Hydra + Nixops, this
will be a good way to formalize knowledge and share it.

Do you know of any books in progress?

/sjm

 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.
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Ejabberd Options

2014-12-16 Thread Luca Bruno
On 16/12/2014 10:56, stewart mackenzie wrote:
 Absolutely Luca, you're absolutely right.

 I suspect a book needs to be written on NixOS + Hydra + Nixops, this
 will be a good way to formalize knowledge and share it.

 Do you know of any books in progress?
The best you can do is reading the nix manual, and reading code and
playing with nix in general, not through hydra where it takes time to
test things.

For example, don't use hydra, but use nix-build directly so that it's
faster to trial  error.

Also hang around the irc channel of nixos, and hear people and how they
solve their problems.
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Ejabberd Options

2014-12-16 Thread stewart mackenzie
On Tue, Dec 16, 2014 at 6:04 PM, Luca Bruno lethalma...@gmail.com wrote:
 The best you can do is reading the nix manual, and reading code and
 playing with nix in general, not through hydra where it takes time to
 test things.

github.com/nixos/nixpkgs is the first frequency ranked tile on my
firefox landing screen

 For example, don't use hydra, but use nix-build directly so that it's
 faster to trial  error.

Yes I use this almost exclusively.

 Also hang around the irc channel of nixos, and hear people and how they
 solve their problems.

auto login :)
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Ejabberd Options

2014-12-16 Thread Thomas Hunger
I also found this introduction useful:
https://medium.com/@MrJamesFisher/nix-by-example-a0063a1a4c55

On 16 December 2014 at 10:25, stewart mackenzie setor...@gmail.com wrote:

 On Tue, Dec 16, 2014 at 6:04 PM, Luca Bruno lethalma...@gmail.com wrote:
  The best you can do is reading the nix manual, and reading code and
  playing with nix in general, not through hydra where it takes time to
  test things.

 github.com/nixos/nixpkgs is the first frequency ranked tile on my
 firefox landing screen

  For example, don't use hydra, but use nix-build directly so that it's
  faster to trial  error.

 Yes I use this almost exclusively.

  Also hang around the irc channel of nixos, and hear people and how they
  solve their problems.

 auto login :)
 ___
 nix-dev mailing list
 nix-dev@lists.science.uu.nl
 http://lists.science.uu.nl/mailman/listinfo/nix-dev

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Ejabberd Options

2014-12-16 Thread stewart mackenzie
Thomas, that's a very nice article thank you!

On Tue, Dec 16, 2014 at 6:41 PM, Thomas Hunger tehun...@gmail.com wrote:
 I also found this introduction useful:
 https://medium.com/@MrJamesFisher/nix-by-example-a0063a1a4c55
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Ejabberd Options

2014-12-15 Thread Luca Bruno
On 15/12/2014 12:28, stewart mackenzie wrote:
 So with the kind help of this list and on IRC, a private instance of
 ejabberd can compile over our hydra. Now I need to get these options
 into the same build as per
 https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/networking/ejabberd.nix

 Questions:
 * Would it be better to override ejabberd?
 * Or just add the below package with options to nixpkgs via function
 arguments available in nixpkgs?
Is the configuration of the ejabberd.nix nixos module compatible with
your chaatz-ejabberd?

   jobs = rec {

 config = pkgs.lib.mkIf cfg.enable {
This jobs.config doesn't make sense for hydra. If you want to run a vm
test on hydra look in nixos/release.nix for examples.
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Ejabberd Options

2014-12-15 Thread stewart mackenzie
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

Except an error is thrown:

error: undefined variable ‘chaatz-ejabberd’ at
/home/stewart/chaatz/chaatzpkgs/release.nix:3:31

After this I take it when I create my container I would point nix to
our hydra channel, then fill out the configuration.nix file using
chaatz-ejabberd instead of ejabberd?

Kind regards
Stewart

On Mon, Dec 15, 2014 at 8:14 PM, Luca Bruno lethalma...@gmail.com wrote:
 On 15/12/2014 12:55, stewart mackenzie wrote:
 Is the configuration of the ejabberd.nix nixos module compatible with
 your chaatz-ejabberd?
 Yes one-for-one compatible
 Add a package option in ejabberd.nix to specify which package to use
 for the ejabberd service. So that you can do services.ejabberd.package =
 chaaz-ejabberd;
 This is an acceptable change in nixpkgs itself if you issue a PR.
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev