Re: [Nix-dev] Haskell-env (via nix-shell) - am I doing this right?

2015-05-25 Thread Matthias Beyer
Re-Send to ML:


On 24-05-2015 21:41:47, Matthias Beyer wrote:
 Hi Peter,
 
 On 24-05-2015 17:09:21, Peter Simons wrote:
  The following message is a courtesy copy of an article
  that has been posted to gmane.linux.distributions.nixos as well.
  
  Hi Matthias,
  
$ cabal build
Building ratehs-0.1...
Preprocessing executable 'ratehs' for ratehs-0.1...
command line: cannot satisfy -package-id
snap-0.14.0.2-ef658c66823be8387d049aa89445f690:
snap-0.14.0.2-ef658c66823be8387d049aa89445f690 is unusable due
to missing or recursive dependencies:
clientsession-0.9.1.1-f379c9ed2e350715ba6cdc20d73894b3
(use -v for more information)
   
Do you have an idea how I can fix this?
  
  this issue is described in https://github.com/NixOS/nixpkgs/issues/7792.
  Instructions how to recover from this problem are in this thread. The
  short version is: garbage collect haskell-clientsession and all its
  dependents, then download those packages from scratch (or build them
  locally with --option build-use-substitutes false. Anyway, the ticket
  has more information on this subject.
 
 Thanks for posting this. Unfortunately I don't understand how to
 
 garbage collect haskell-clientsession and all its dependents
 
 How to do that? I've read the linked issue but I don't get any smarter
 by reading it!
 
 I just tried to nix-collect-garbage and after that re-building
 everything by simply doing nix-shell and entering the environment, but
 the error still happens, so I guess that's not the way how to do it,
 right?

I did 

nix-store --delete on the store path of haskell-clientsession.

as Peter suggested in a private mail then.

But my problem is still:

I ran

for n in $(find /nix/store -name *haskell-clientsession* -maxdepth 1); do 
nix-store --delete $n; done

but it still tells me:

finding garbage collector roots...  error: cannot delete path

‘/nix/store/pqj35vwax89ljdhcca02a330ii4zzhiw-haskell-clientsession-0.9.1.1.drv’
since it is still alive
0 store paths deleted, 0.00 MiB freed

Can you tell how to fix this?

-- 
Mit freundlichen Grüßen,
Kind regards,
Matthias Beyer

Proudly sent with mutt.
Happily signed with gnupg.


pgpSTLVVVrndf.pgp
Description: PGP signature
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Haskell-env (via nix-shell) - am I doing this right?

2015-05-25 Thread Peter Simons
Hi Matthias,

  error: cannot delete path
  ‘/nix/store/pqj35vwax89ljdhcca02a330ii4zzhiw-haskell-clientsession-0.9.1.1.drv’
  since it is still alive

https://github.com/NixOS/nixpkgs/issues/7792#issuecomment-100882553
discusses this problem. You have packages in one of your profiles that
depend on haskell-clientsession, so it can't be removed.

I hope this helps,
Peter

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Haskell-env (via nix-shell) - am I doing this right?

2015-05-25 Thread Matthias Beyer
Hi,

thanks.

Surprisingly I got it working. Now I can start developing my Haskell
App! Thank you a lot!

Now Haskell itself is the remaining problem! *smile*

On 25-05-2015 15:48:12, Peter Simons wrote:
 Hi Matthias,
 
   error: cannot delete path
   
 ‘/nix/store/pqj35vwax89ljdhcca02a330ii4zzhiw-haskell-clientsession-0.9.1.1.drv’
   since it is still alive
 
 https://github.com/NixOS/nixpkgs/issues/7792#issuecomment-100882553
 discusses this problem. You have packages in one of your profiles that
 depend on haskell-clientsession, so it can't be removed.
 
 I hope this helps,
 Peter
 
 ___
 nix-dev mailing list
 nix-dev@lists.science.uu.nl
 http://lists.science.uu.nl/mailman/listinfo/nix-dev

-- 
Mit freundlichen Grüßen,
Kind regards,
Matthias Beyer

Proudly sent with mutt.
Happily signed with gnupg.


pgphjv5qQzJ2n.pgp
Description: PGP signature
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Haskell-env (via nix-shell) - am I doing this right?

2015-05-24 Thread Peter Simons
Hi Matthias,

  $ cabal build
  Building ratehs-0.1...
  Preprocessing executable 'ratehs' for ratehs-0.1...
  command line: cannot satisfy -package-id
  snap-0.14.0.2-ef658c66823be8387d049aa89445f690:
  snap-0.14.0.2-ef658c66823be8387d049aa89445f690 is unusable due
  to missing or recursive dependencies:
  clientsession-0.9.1.1-f379c9ed2e350715ba6cdc20d73894b3
  (use -v for more information)
 
  Do you have an idea how I can fix this?

this issue is described in https://github.com/NixOS/nixpkgs/issues/7792.
Instructions how to recover from this problem are in this thread. The
short version is: garbage collect haskell-clientsession and all its
dependents, then download those packages from scratch (or build them
locally with --option build-use-substitutes false. Anyway, the ticket
has more information on this subject.

Best regards,
Peter

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Haskell-env (via nix-shell) - am I doing this right?

2015-05-23 Thread Matthias Beyer
Hi Peter,

thanks, thanks for your suggestion, now I got it working.

Unfortunately, I cannot `cabal build` because of one recursive
dependency is missing:

$ cabal build
Building ratehs-0.1...
Preprocessing executable 'ratehs' for ratehs-0.1...
command line: cannot satisfy -package-id
snap-0.14.0.2-ef658c66823be8387d049aa89445f690: 
snap-0.14.0.2-ef658c66823be8387d049aa89445f690 is unusable due
to missing or recursive dependencies:
clientsession-0.9.1.1-f379c9ed2e350715ba6cdc20d73894b3
(use -v for more information)

Do you have an idea how I can fix this?

I'll send you my default.nix / shell.nix and cabal file, if you need
them, but basically they say (pseudo-code):

env = haskellngPackages.ghcWithPackages ...
pkgs.stdenv
cabal-install
hlint

snap
snap-core
snap-server
snap-loader-static

snaplet-persistent
persistent
persistent-postgresql
persistent-sqlite

heist

and

Build-depends:
heist
persistent
persistent-postgresql
persistent-sqlite
snap
snap-core
snap-server
snap-loader-static

(and everything else which is generated by `snap init`, of course.

On 22-05-2015 21:44:30, Peter Simons wrote:
 Hi Peter,
 
   3) The ghc argument in shell.nix allows me to specify different
  versions of GHC so I can test with multiple versions.  (I'd love
  some feedback on how to make this more flexible.)
 
 I use the following shell.nix to switch between compiler versions:
 
 { compiler ? ghc7101 }:
 
 with (import nixpkgs {}).pkgs;
 let
   ghc = haskell.packages.${compiler}.ghcWithPackages
   (pkgs: with pkgs; [ aeson lens monad-par ]);
 in
 stdenv.mkDerivation {
   name = my-haskell-env-0;
   buildInputs = [ ghc ];
   shellHook = eval $(grep export ${ghc}/bin/ghc);
 }
 
 Now run nix-shell --argstr compiler ghc784 to select a compiler other
 than the default.
 
 I hope this helps,
 Peter
 
 ___
 nix-dev mailing list
 nix-dev@lists.science.uu.nl
 http://lists.science.uu.nl/mailman/listinfo/nix-dev

-- 
Mit freundlichen Grüßen,
Kind regards,
Matthias Beyer

Proudly sent with mutt.
Happily signed with gnupg.


pgpKj6qBf3Wnv.pgp
Description: PGP signature
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Haskell-env (via nix-shell) - am I doing this right?

2015-05-22 Thread Peter Simons
Hi Ricardo,

  Out of curiosity, why is that shellHook stuff needed on every
  package?
 
  Couldn't ghcWithPackages export those variables instead (as a
  setupHook)?

yes, I suppose it's possible to extend ghcWithPackages in such a way
that it exports those settings automatically (or at provides a really
simple way to set them, at lest). It's just that nobody has implemented
this feature yet.

Best reards,
Peter

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Haskell-env (via nix-shell) - am I doing this right?

2015-05-22 Thread Peter Simons
Hi Peter,

  3) The ghc argument in shell.nix allows me to specify different
 versions of GHC so I can test with multiple versions.  (I'd love
 some feedback on how to make this more flexible.)

I use the following shell.nix to switch between compiler versions:

{ compiler ? ghc7101 }:

with (import nixpkgs {}).pkgs;
let
  ghc = haskell.packages.${compiler}.ghcWithPackages
  (pkgs: with pkgs; [ aeson lens monad-par ]);
in
stdenv.mkDerivation {
  name = my-haskell-env-0;
  buildInputs = [ ghc ];
  shellHook = eval $(grep export ${ghc}/bin/ghc);
}

Now run nix-shell --argstr compiler ghc784 to select a compiler other
than the default.

I hope this helps,
Peter

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Haskell-env (via nix-shell) - am I doing this right?

2015-05-22 Thread Peter Jones
Peter Simons sim...@cryp.to writes:
 I use the following shell.nix to switch between compiler versions:

 { compiler ? ghc7101 }:

 with (import nixpkgs {}).pkgs;
 let
   ghc = haskell.packages.${compiler}.ghcWithPackages
   (pkgs: with pkgs; [ aeson lens monad-par ]);
 in
 stdenv.mkDerivation {
   name = my-haskell-env-0;
   buildInputs = [ ghc ];
   shellHook = eval $(grep export ${ghc}/bin/ghc);
 }

 Now run nix-shell --argstr compiler ghc784 to select a compiler other
 than the default.

Neat trick!  Thanks for sharing.

-- 
Peter Jones, Founder, Devalot.com
Defending the honor of good code

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Haskell-env (via nix-shell) - am I doing this right?

2015-05-22 Thread Ricardo M. Correia
On Fri, May 22, 2015 at 8:16 PM, Peter Jones mli...@pmade.com wrote:

 To start out, I'm using HaskellNG and a recent version of nixpkgs where
 HaskellNG is the default.  Here are the components I use with some
 examples:

   1) I write a default.nix that describes my dependencies:

 https://github.com/pjones/byline/blob/master/default.nix


Thanks for the example!

Out of curiosity, why is that shellHook stuff needed on every package?

Couldn't ghcWithPackages export those variables instead (as a setupHook
)?
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Haskell-env (via nix-shell) - am I doing this right?

2015-05-22 Thread Peter Jones
Ricardo M. Correia rcorr...@wizy.org writes:
 On Fri, May 22, 2015 at 8:16 PM, Peter Jones mli...@pmade.com wrote:

 To start out, I'm using HaskellNG and a recent version of nixpkgs where
 HaskellNG is the default.  Here are the components I use with some
 examples:

   1) I write a default.nix that describes my dependencies:

 https://github.com/pjones/byline/blob/master/default.nix


 Thanks for the example!

 Out of curiosity, why is that shellHook stuff needed on every package?

 Couldn't ghcWithPackages export those variables instead (as a setupHook
 )?

I stole those lines from someone else and haven't taken the time to
verify that they are actually needed.  Maybe someone with more knowledge
than me can speak to this point.

-- 
Peter Jones, Founder, Devalot.com
Defending the honor of good code

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Haskell-env (via nix-shell) - am I doing this right?

2015-05-22 Thread Peter Jones
Matthias Beyer m...@beyermatthias.de writes:
 I want to develop a haskell package, but I need haskell packages from
 haskellngPackages (what's the matter with haskellPackages vs.
 haskellngPackages?).

 So, I'm a bit insecure about my environment definition here, because I
 had to mix the non-ng-packages with the ng-packages to get the
 cabalInstall and everything (I'm rather new to Haskell, so maybe I
 completely messed up here.

I thought I'd chime in with how I'm developing Haskell package on NixOS.
I wouldn't say this is the correct way to do things, and I'm completely
open to feedback.

To start out, I'm using HaskellNG and a recent version of nixpkgs where
HaskellNG is the default.  Here are the components I use with some
examples:

  1) I write a default.nix that describes my dependencies:

https://github.com/pjones/byline/blob/master/default.nix

  2) I write a shell.nix that pulls in default.nix using import:
  
https://github.com/pjones/byline/blob/master/shell.nix

  3) The ghc argument in shell.nix allows me to specify different
 versions of GHC so I can test with multiple versions.  (I'd love
 some feedback on how to make this more flexible.)  This can be used
 from the command line like so:

nix-shell --argstr ghc 7.10.1

# or

nix-shell --argstr ghc 7.8.4

  4) Once I'm inside nix-shell I use the buildPhase variable to build my
 package:

eval $buildPhase

Again, any suggestions on how to improve this workflow are appreciated.

-- 
Peter Jones, Founder, Devalot.com
Defending the honor of good code

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


[Nix-dev] Haskell-env (via nix-shell) - am I doing this right?

2015-05-21 Thread Matthias Beyer
Hi,

I want to develop a haskell package, but I need haskell packages from
haskellngPackages (what's the matter with haskellPackages vs.
haskellngPackages?).

So, I'm a bit insecure about my environment definition here, because I
had to mix the non-ng-packages with the ng-packages to get the
cabalInstall and everything (I'm rather new to Haskell, so maybe I
completely messed up here.

Here goes my default.nix:


{ pkgs ? (import nixpkgs {})
, haskellPackages ? pkgs.haskellPackages_ghc784 }:

haskellPackages.cabal.mkDerivation (self: {
pname = foobar;
version = 0.0.0.0;

src = ./.;

isLibrary = false;
isExecutable = true;

buildDepends = with pkgs.haskellngPackages; [
  pkgs.stdenv
  haskellPackages.cabalInstall
  hlint

  snap
  snap-core
  snap-server

  snaplet-persistent

  persistent
  persistent-postgresql
  persistent-sqlite

  # maybe later:

  # rest-snap
  # aeson

  # snap-extras
  # snaplet-hslogger
];

testDepends = with haskellPackages; [ ];

meta = {
# not relevant I guess
};
})

-- 
Mit freundlichen Grüßen,
Kind regards,
Matthias Beyer

Proudly sent with mutt.
Happily signed with gnupg.


pgpDS1FT0Og07.pgp
Description: PGP signature
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev