[Nix-dev] Proper way of adding custom nix expressions
Richard Wallace
rwallace at thewallacepack.net
Sun Nov 4 23:16:06 CET 2012
On Thu, Nov 1, 2012 at 12:14 AM, Andres Loeh <ksnix at andres-loeh.de> wrote:
> Hi Richard.
>
> What Peter says is true. And ultimately, you should be motivated to
> just submit your new packages as a pull request to nixpkgs.
>
> However, I'd like to point out that there's also a somewhat less
> invasive way to test your own Haskell packages.
>
> There's a nixpkgs configuration file at ~/.nixpkgs/config.nix (it
> might not exist yet). In this config file you can specify a
> configuration option called packageOverrides that modifies the package
> set from nixpkgs in any way you like. In particular, you can add
> packages. Now, adding something to the set of Haskell packages is a
> little bit tricky, because they're all defined in a sub-attribute
> depending on the compiler version, and you have to ensure that
> dependencies are picked up correctly from that set.
>
> So here's what you'd do to add the "boomerang" Haskell package.
>
> (1) Call cabal2nix to produce a Nix expression for boomerang and put
> it in a suitable location. I'm assuming
> ~/.nixpkgs/haskell/boomerang.nix.
>
> (2) Edit your ~/.nixpkgs/config.nix so that it has the following structure:
>
>> pkgs : {
>> packageOverrides = pkgs : rec {
>> myHaskellPackages =
>> let callPackage = pkgs.lib.callPackageWith myHaskellPackages; in
>> pkgs.recurseIntoAttrs (pkgs.haskellPackages.override {
>> extraPrefs = self : {
>> boomerang = callPackage ./haskell/boomerang.nix {};
>> };
>> });
>> };
>> }
>
> Instead of pkgs.haskellPackages.override, you can select another set
> of haskellPackages from all-packages.nix, one that's specific to your
> compiler version, if you prefer. The pkgs.recurseIntoAttrs call is
> optional, but it ensures that you can view your own new Haskell
> packages in nix-env -q calls.
>
Using this I'm getting the error
error: attribute `recurseIntoAttrs' missing
Not sure what's up. I tried taking out `recurseIntoAttrs` so I end up with
pkgs : {
packageOverrides = self : rec {
myHaskellPackages =
let callPackage = pkgs.lib.callPackageWith myHaskellPackages; in
pkgs.haskellPackages.override {
extraPrefs = self : {
boomerang = callPackage ./haskell/boomerang.nix {};
};
};
};
}
Then I get
error: attribute `haskellPackages.override' missing
Any ideas what I'm missing?
Thanks,
Rich
> (3) You can now install boomerang via path
> (nixos.pkgs.myHaskellPackages.boomerang) or you can use
> myHaskellPackages.ghcWithPackages to build a set of specific packages
> for this version of GHC.
>
> Cheers,
> Andres
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
More information about the nix-dev
mailing list