[Nix-dev] [Haskell NG] Equivalent of the old eval "$configurePhase" && eval "$buildPhase" && eval "$checkPhase" ?
Richard Wallace
rwallace at thewallacepack.net
Fri Jan 23 04:20:16 CET 2015
Hi Mateusz,
You don't have to use cabal2nix to generate the default.nix and shell.nix
files. It would be enough to generate the default.nix file and then in
shell.nix you can have
with (import <nixpkgs> {}).pkgs;
(haskellngPackages.callPackage ./. {}).env
To add overrides, you would do something similar to
with (import <nixpkgs> {}).pkgs;
with (import <nixpkgs/pkgs/development/haskell-modules/lib.nix> {
inherit pkgs; });
let modifiedHaskellPackages = haskellngPackages.override {
overrides = self: super: {
http-media = dontCheck super.http-media;
Cabal = super.Cabal_1_20_0_3;
webcrank = self.callPackage ./. {};
};
};
in modifiedHaskellPackages.webcrank.env
For my own development I've gone a step further, I generate the default.nix
file with cabal2nix. Then I create a <project-name>.nix (in this case
webcrank.nix) much like the above
with (import <nixpkgs> {}).pkgs;
with (import <nixpkgs/pkgs/development/haskell-modules/lib.nix> {
inherit pkgs; });
let modifiedHaskellPackages = haskellngPackages.override {
overrides = self: super: {
http-media = dontCheck super.http-media;
Cabal = super.Cabal_1_20_0_3;
webcrank = self.callPackage ./. {};
};
};
in modifiedHaskellPackages.webcrank
Notice that ".env" was removed from the end. This file I use with
nix-build and then nix-copy-closure to do deployments. In my shell.nix I
add some addition things, like dev tools
with (import <nixpkgs> {}).pkgs;
with (import <nixpkgs/pkgs/development/haskell-modules/lib.nix> {
inherit pkgs; });
(overrideCabal (import ./webcrank.nix) (drv: {
buildTools = [
haskellngPackages.ghc-mod
];
})).env
This setup has been working well for me so far, hopefully it will help you
too.
Rich
On Thu, Jan 22, 2015 at 5:24 PM, Mateusz Kowalczyk <fuuzetsu at fuuzetsu.co.uk>
wrote:
> On 01/22/2015 09:54 PM, Peter Simons wrote:
> > Hi Mateusz,
> >
> > > What's the new in-shell workflow?
> >
> > Does http://permalink.gmane.org/gmane.linux.distributions.nixos/15524
> help?
> >
> > Best regards,
> > Peter
> >
> > _______________________________________________
> > nix-dev mailing list
> > nix-dev at lists.science.uu.nl
> > http://lists.science.uu.nl/mailman/listinfo/nix-dev
> >
>
> Yes though it seems that we now need to update two files when making any
> changes: default.nix so that we can callPackage it in overrides and such
> (for example if it's a private package) and shell.nix so that we can
> enter sane environment.
>
> Previously we could simply cabal2nix into default.nix and from shell.nix
> callPackage ./. in simple case or add any extra shell-only settings in
> there. Now it seems that if I add a dependency I need to regenerate both
> files which is not fun if we have written any customisation. Am I wrong?
>
> Nevetheless, I got on fine once I figured out I need a fancier shell.nix
> such as one cabal2nix gave me. Another downside is that manual use of
> Setup won't inherit flags specified in the expression: we manually have
> to --enable-testsuite whereas eval "$configurePhase" would do that for
> use when doCheck = true;. So overall it seems to me that there is a bit
> more manual work involved though things seem nicer in general so far.
>
> --
> Mateusz K.
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20150122/01fa4dc0/attachment.html
More information about the nix-dev
mailing list