[Nix-dev] Proper way of adding custom nix expressions

Peter Simons simons at cryp.to
Wed Oct 31 22:01:07 CET 2012


Hi Richard,

 > It seems like ~/.nix-defexpr is the place I should add anything custom.

yes, that is true. Personally, I have a checked-out copy of the Git
repository from http://github.com/nixos/nixpkgs at that location. Adding
'boomerang' is then just a matter of running the commands:

  $ cd .nix-defexpr/pkgs/development/libraries/haskell/
  $ mkdir boomerang
  $ cabal2nix cabal://boomerang >boomerang/default.nix

Now, add the line

   boomerang = callPackage ../development/libraries/haskell/boomerang {};

to ~/.nix-defexpr/pkgs/top-level/haskell-packages.nix, and test the
build with the compiler of your choice:

  $ nix-env -p /tmp/test -iA haskellPackages_ghc742.boomerang
  installing `haskell-boomerang-ghc7.4.2-1.3.3'
  these derivations will be built:
    /nix/store/dv8a9bvnsqkv3b6kykfk16dmqjshh32s-haskell-boomerang-ghc7.4.2-1.3.3.drv
  [...]
  [...]
  patching ELF executables and libraries
  patching script interpreter paths
  building path(s) `/nix/store/kybjzfbk54q8qn7jwv7v82ah7nz7nird-user-environment'
  created 22 symlinks in user environment

Finally, commit the result and open a pull request. :-)

Take care,
Peter



More information about the nix-dev mailing list