[Nix-dev] nix-shell for a custom haskell library
Dmitry Malikov
malikov.d.y at gmail.com
Sun May 31 22:26:00 CEST 2015
> I'm not sure what you mean. Pre-Haskell-NG packages had no support for
> nix-shell at all, and the behavior in Haskell NG has never been different
> from what it is now. mkDerivation builds and installs the library, of
> course, but the while point of nix-shell is that the code which does this
> is not executed automatically so that you can run your own commands
> instead.
The way I've used nix-shell for some haskell packages before was something
like that:
nix-shell -p '(haskellPackages.callPackage ./default.nix { })' --command
'builtExecutable'
And here is an example of one of that old-way-haskell-packages expressions:
{ pkgs ? (import <nixpkgs> {}) }:
let biegunka = import ./biegunka.nix {}; in
pkgs.haskellPackages.cabal.mkDerivation (self: {
pname = "dotfiles";
version = "9999";
src = builtins.filterSource (_: type: type != "unknown") ./biegunka/.;
isLibrary = false;
isExecutable = true;
buildDepends = with pkgs.haskellPackages; [
biegunka dataDefault lens optparseApplicative regexPcreBuiltin
];
meta = {
license = self.stdenv.lib.licenses.mit;
platforms = self.ghc.meta.platforms;
};
})
Nowadays, there is no more `haskellPackages.cabal.mkDerivation`/
> > How to configure `shell.nix` to get `cabal configure && cabal build`
> > done after entering the nix-shell?
> nix-shell --command "cabal configure && cabal build".
Yeah, but the problem with this approach is some kind of lack of an
isolation, since the path where the packages are being installed into
is shared:
/Users/m/.ghc/x86_64-darwin-7.10.1/package.conf.d
engine-io-1.2.6
Thus, for now I see now way how can I migrate the flow that I've used
in old-way-haskell-packages to the new infrastructure.
I hope I just didn't get something right and there is such way.
On 31 May 2015 at 12:48, Peter Simons <simons at cryp.to> wrote:
> Hi Dmitry,
>
> >> The "env" attribute of engine-io (which is what nix-shell enters
> >> here) gives you an environment in which engine-io can be compiled.
> >
> > If I remember correctly, old `haskellPackages.mkDerivation` was
> > producing an environment with compiled sources and installed
> > libraries.
>
> I'm not sure what you mean. Pre-Haskell-NG packages had no support for
> nix-shell at all, and the behavior in Haskell NG has never been different
> from what it is now. mkDerivation builds and installs the library, of
> course, but the while point of nix-shell is that the code which does this
> is not executed automatically so that you can run your own commands
> instead.
>
>
> > How to configure `shell.nix` to get `cabal configure && cabal build`
> > done after entering the nix-shell?
>
> nix-shell --command "cabal configure && cabal build".
>
>
> > What was the reason to move this step out of nix-shell routine?
>
> No such code ever existed in the nix-shell environment for Haskell
> packages.
>
> Best regards,
> Peter
>
> _______________________________________________
> 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/20150531/35be2643/attachment.html
More information about the nix-dev
mailing list