[Nix-dev] installing cabal-install from git
Ganesh Sittampalam
ganesh at earth.li
Thu Dec 29 23:28:32 CET 2016
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;
});
More information about the nix-dev
mailing list