on iko/ghcjs-patch-master help sign in
Fix callCabalProjectToNix plans with source repos (#149)
bc01ebcHamish Mackenzie
@@ -117,7 +117,11 @@ let
117 # Programs for generating Nix expressions from Cabal and Stack
117 # Programs for generating Nix expressions from Cabal and Stack
118 # files. We need to make sure we build this from the buildPackages,
118 # files. We need to make sure we build this from the buildPackages,
119 # we never want to actually cross compile nix-tools on it's own.
119 # we never want to actually cross compile nix-tools on it's own.
120− nix-tools = pkgs.buildPackages.callPackage ./nix-tools { inherit fetchExternal cleanSourceHaskell; inherit (self) mkCabalProjectPkgSet; };
120+ nix-tools = pkgs.buildPackages.callPackage ./nix-tools {
121+ inherit fetchExternal cleanSourceHaskell;
122+ inherit (pkgs.buildPackages.haskellPackages) hpack;
123+ inherit (self) mkCabalProjectPkgSet;
124+ };
121
125
122 # Function to call stackToNix
126 # Function to call stackToNix
123 callStackToNix = self.callPackage ./call-stack-to-nix.nix {};
127 callStackToNix = self.callPackage ./call-stack-to-nix.nix {};
@@ -188,10 +192,9 @@ let
188 callCabalProjectToNix = import ./lib/cabalProjectToNix.nix {
192 callCabalProjectToNix = import ./lib/cabalProjectToNix.nix {
189 inherit (self) dotCabal;
193 inherit (self) dotCabal;
190 inherit pkgs;
194 inherit pkgs;
191− inherit (pkgs) runCommand cabal-install ghc;
195+ inherit (pkgs) runCommand cabal-install ghc symlinkJoin cacert;
192 inherit (pkgs.haskellPackages) hpack;
196 inherit (pkgs.haskellPackages) hpack;
193 inherit (self) nix-tools;
197 inherit (self) nix-tools;
194− inherit (pkgs) symlinkJoin;
195 };
198 };
196 });
199 });
197
200
lib/cabalProjectToNix.nix+3−1
@@ -1,4 +1,4 @@
1−{ dotCabal, pkgs, runCommand, nix-tools, cabal-install, ghc, hpack, symlinkJoin }:
1+{ dotCabal, pkgs, runCommand, nix-tools, cabal-install, ghc, hpack, symlinkJoin, cacert }:
2let defaultGhc = ghc;
2let defaultGhc = ghc;
3 defaultCabalInstall = cabal-install;
3 defaultCabalInstall = cabal-install;
4in { index-state, index-sha256 ? (import ./index-state-hashes.nix).${index-state} or null, src, ghc ? defaultGhc, cabal-install ? defaultCabalInstall }:
4in { index-state, index-sha256 ? (import ./index-state-hashes.nix).${index-state} or null, src, ghc ? defaultGhc, cabal-install ? defaultCabalInstall }:
@@ -29,6 +29,8 @@ let
29 # without the source available (we cleaneSourceWith'd it),
29 # without the source available (we cleaneSourceWith'd it),
30 # this may not produce the right result.
30 # this may not produce the right result.
31 find . -name package.yaml -exec hpack "{}" \;
31 find . -name package.yaml -exec hpack "{}" \;
32+ export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
33+ export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
32 HOME=${dotCabal { inherit index-state; sha256 = index-sha256; }} cabal new-configure
34 HOME=${dotCabal { inherit index-state; sha256 = index-sha256; }} cabal new-configure
33
35
34 export LANG=C.utf8 # Needed or stack-to-nix will die on unicode inputs
36 export LANG=C.utf8 # Needed or stack-to-nix will die on unicode inputs
nix-tools/default.nix+10−1
@@ -1,4 +1,6 @@
1+{ lib, symlinkJoin, makeWrapper
2+, hpack, git, nix, nix-prefetch-scripts
1−{ symlinkJoin, fetchExternal, cleanSourceHaskell, mkCabalProjectPkgSet }:
3+, fetchExternal, cleanSourceHaskell, mkCabalProjectPkgSet }:
2
4
3let
5let
4 src = cleanSourceHaskell (fetchExternal {
6 src = cleanSourceHaskell (fetchExternal {
@@ -25,8 +27,15 @@ let
25
27
26 hsPkgs = pkgSet.config.hsPkgs;
28 hsPkgs = pkgSet.config.hsPkgs;
27
29
30+ tools = [ hpack git nix nix-prefetch-scripts ];
28in
31in
29 symlinkJoin {
32 symlinkJoin {
30 name = "nix-tools";
33 name = "nix-tools";
31 paths = builtins.attrValues hsPkgs.nix-tools.components.exes;
34 paths = builtins.attrValues hsPkgs.nix-tools.components.exes;
35+ buildInputs = [ makeWrapper ];
36+ postBuild = ''
37+ for prog in stack-to-nix cabal-to-nix plan-to-nix; do
38+ wrapProgram "$out/bin/$prog" --prefix PATH : "${lib.makeBinPath tools}"
39+ done
40+ '';
32 }
41 }