Re: [Nix-dev] installing cabal-install from git

2016-12-30 Thread Ganesh Sittampalam
On 30/12/2016 08:46, Peter Simons wrote:

>   postUnpack = "sourceRoot+=/cabal-install";

Thanks, that's much cleaner.

Cheers,

Ganesh

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


Re: [Nix-dev] installing cabal-install from git

2016-12-30 Thread Peter Simons
Hi Ganesh,

you can use the attributes

  postUnpack = "sourceRoot+=/Cabal";

and

  postUnpack = "sourceRoot+=/cabal-install";

to change into the appropriate sub-directory before the build starts.

Best regards,
Peter

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


[Nix-dev] installing cabal-install from git

2016-12-29 Thread Ganesh Sittampalam
Hi,

I wanted to install the git version of the Haskell tool cabal-install.
Normally installing a git version would be simple - just override the
derivation to use a source area defined with fetchgit or fetchFromGitHub.

However, the cabal-install source tree lives within a subdirectory of a
git repo, which also includes the Cabal library. So the build fails as
the standard Haskell derivation doesn't know to change into the
subdirectory.

With some help from IRC, I managed to figure out a 'preUnpack' setting
that would set the 'sourceRoot' variable:

  preUnpack = ''export
sourceRoot=cabal-${self.cabalGitSnapshot.rev}-src/cabal-install'';

(full details below - I needed to repeat the same trick for the Cabal
library as the cabal-install executable depends on it)

However, it feels a bit awkward, especially as I think the source tree
folder name is based on the internal implementation choice of
fetchFromGitHub.

Is there a better way, and does my current approach have any other pitfalls?

Cheers,

Ganesh

in pkgs/development/haskell-modules/configuration-common.nix:

  cabalGitSnapshot = pkgs.fetchFromGitHub {
  owner = "haskell";
  repo = "cabal";
  sha256 =
"65bbf596ee1a546f41df6a62b31f1c74b122c30ea2eb9daaa0c877ebcdc4cf80";
  rev = "28af355b0fadb27b3fac2292d305806de30ee781";
};

  Cabal_git = (overrideCabal super.Cabal_1_24_2_0 (drv: {
preUnpack = ''export
sourceRoot=cabal-${self.cabalGitSnapshot.rev}-src/Cabal'';
version = "git";
src = self.cabalGitSnapshot;
  }));

  hackage-security = (overrideCabal super.hackage-security (drv: {
doCheck = false; }));

  cabal-install = (overrideCabal super.cabal-install (drv: {
preUnpack = ''export
sourceRoot=cabal-${self.cabalGitSnapshot.rev}-src/cabal-install'';
version = "git";
executableHaskellDepends = drv.executableHaskellDepends
 ++ [ pkgs.haskellPackages.echo
pkgs.haskellPackages.edit-distance ];
src = self.cabalGitSnapshot;
  })).overrideScope (self: super: {
Cabal = self.Cabal_git;
hackage-security = dontCheck super.hackage-security;
  });
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev