mirror of
https://github.com/ilyakooo0/haskell.nix.git
synced 2024-09-11 06:55:40 +03:00
Fix callCabalProjectToNix plans with source repos (#149)
* Fix callCabalProjectToNix plans with source repos * nix-tools: wrap executables to provide dependencies * cabalProjectToNix needs git for cabal source repos When resolving source repos the `cabal` executable uses `git` from the `PATH` (not using nix store reference).
This commit is contained in:
parent
d67fc2db76
commit
bc01ebc05a
@ -117,7 +117,11 @@ let
|
||||
# Programs for generating Nix expressions from Cabal and Stack
|
||||
# files. We need to make sure we build this from the buildPackages,
|
||||
# we never want to actually cross compile nix-tools on it's own.
|
||||
nix-tools = pkgs.buildPackages.callPackage ./nix-tools { inherit fetchExternal cleanSourceHaskell; inherit (self) mkCabalProjectPkgSet; };
|
||||
nix-tools = pkgs.buildPackages.callPackage ./nix-tools {
|
||||
inherit fetchExternal cleanSourceHaskell;
|
||||
inherit (pkgs.buildPackages.haskellPackages) hpack;
|
||||
inherit (self) mkCabalProjectPkgSet;
|
||||
};
|
||||
|
||||
# Function to call stackToNix
|
||||
callStackToNix = self.callPackage ./call-stack-to-nix.nix {};
|
||||
@ -188,10 +192,9 @@ let
|
||||
callCabalProjectToNix = import ./lib/cabalProjectToNix.nix {
|
||||
inherit (self) dotCabal;
|
||||
inherit pkgs;
|
||||
inherit (pkgs) runCommand cabal-install ghc;
|
||||
inherit (pkgs) runCommand cabal-install ghc symlinkJoin cacert;
|
||||
inherit (pkgs.haskellPackages) hpack;
|
||||
inherit (self) nix-tools;
|
||||
inherit (pkgs) symlinkJoin;
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ dotCabal, pkgs, runCommand, nix-tools, cabal-install, ghc, hpack, symlinkJoin }:
|
||||
{ dotCabal, pkgs, runCommand, nix-tools, cabal-install, ghc, hpack, symlinkJoin, cacert }:
|
||||
let defaultGhc = ghc;
|
||||
defaultCabalInstall = cabal-install;
|
||||
in { index-state, index-sha256 ? (import ./index-state-hashes.nix).${index-state} or null, src, ghc ? defaultGhc, cabal-install ? defaultCabalInstall }:
|
||||
@ -29,6 +29,8 @@ let
|
||||
# without the source available (we cleaneSourceWith'd it),
|
||||
# this may not produce the right result.
|
||||
find . -name package.yaml -exec hpack "{}" \;
|
||||
export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
|
||||
export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
|
||||
HOME=${dotCabal { inherit index-state; sha256 = index-sha256; }} cabal new-configure
|
||||
|
||||
export LANG=C.utf8 # Needed or stack-to-nix will die on unicode inputs
|
||||
|
@ -1,4 +1,6 @@
|
||||
{ symlinkJoin, fetchExternal, cleanSourceHaskell, mkCabalProjectPkgSet }:
|
||||
{ lib, symlinkJoin, makeWrapper
|
||||
, hpack, git, nix, nix-prefetch-scripts
|
||||
, fetchExternal, cleanSourceHaskell, mkCabalProjectPkgSet }:
|
||||
|
||||
let
|
||||
src = cleanSourceHaskell (fetchExternal {
|
||||
@ -25,8 +27,15 @@ let
|
||||
|
||||
hsPkgs = pkgSet.config.hsPkgs;
|
||||
|
||||
tools = [ hpack git nix nix-prefetch-scripts ];
|
||||
in
|
||||
symlinkJoin {
|
||||
name = "nix-tools";
|
||||
paths = builtins.attrValues hsPkgs.nix-tools.components.exes;
|
||||
buildInputs = [ makeWrapper ];
|
||||
postBuild = ''
|
||||
for prog in stack-to-nix cabal-to-nix plan-to-nix; do
|
||||
wrapProgram "$out/bin/$prog" --prefix PATH : "${lib.makeBinPath tools}"
|
||||
done
|
||||
'';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user