[Nix-dev] [haskell NG] Override package

YCH dontdieych at gmail.com
Tue Feb 24 11:42:11 CET 2015


Hello,

I've done successfully using method 1) .

Thanks.

~~~
~/hdevtools $ cabal2nix . > default.nix

~/ $ cat ~/.nixpkgs/config.nix
{
  allowUnfree = true;
  haskellPackageOverrides = self: super: {
      hdevtools = self.callPackage ../hdevtools {};
  };
}

~/cis194 $ cat shell.nix
with (import <nixpkgs> {}).pkgs;
let pkg = haskellngPackages.callPackage
            ({ mkDerivation, base, MissingH, QuickCheck, stdenv, tasty
             , tasty-hunit, tasty-quickcheck, tasty-rerun, tasty-th
             }:
             mkDerivation {
               pname = "cis194";
               version = "0.1.0.0";
               src = ./.;
               isLibrary = false;
               isExecutable = true;
               buildDepends = [
                 base MissingH QuickCheck tasty tasty-hunit tasty-quickcheck
                 tasty-rerun tasty-th
               ];
               buildTools = [
                 haskellngPackages.hdevtools
                 haskellngPackages.cabal-install
               ];
               license = stdenv.lib.licenses.unfree;
             }) {};
in
  pkg.env
~~~

On Wed, Feb 18, 2015 at 8:18 AM, Daniel Bergey <bergey at teallabs.org> wrote:
> On 2015-02-16 at 08:42, YCH <dontdieych at gmail.com> wrote:
>> I've read quite many document. Wiki, nix pills, ... . But I'm confused about
>> so many different ways doing similar things. And I'm worried about haskell-ng
>> specific things. There is already 'haskellngPackages.hdevtools'. So I should
>> override using ~/hdevtools. I'll attach my current setup information.
>
> Nix certainly has an overwhelming number of options for similar things.
> Here are two options for your situation:
>
> 1. Override hdevtools for all your builds, editing
> ~/.nixpkgs/config.nix, following the explanation in [1].  This is
> probably the right thing; I expect you always want the patched
> hdevtools.  A complete config.nix:
>
> 2. Override hdevtools in your shell.nix, just for this build.  This is
> useful when you need a patched version of some Haskell library, rather
> than a build tool.  In this case, add to the let definitions (before
> pkg)
>
> hdevtools = haskellngPackages.callPackage ~/hdevtools {};
>
> I think you'll need to replace the ~ with your homedir; ISTR Nix doesn't
> interpret ~.  Then change your buildTools line to refer to hdevtools,
> not haskellngPackages.hdevtools.
>
> cheers,
> bergey
>
> Footnotes:
> [1]  http://lists.science.uu.nl/pipermail/nix-dev/2015-January/015601.html
>


More information about the nix-dev mailing list