@@ -1,9 +1,10 @@
11{ dotCabal, pkgs, runCommand, nix-tools, cabal-install, ghc, hpack, symlinkJoin, cacert, index-state-hashes, haskellLib }@defaults:
22{ name ? null # optional name for better error messages
33, src
4−, index-state ? null
5−, index-sha256 ? null
6−, cabalProject ? null
4+, index-state ? null # Hackage index-state, eg. "2019-10-10T00:00:00Z"
5+, index-sha256 ? null # The hash of the truncated hackage index-state
6+, plan-sha256 ? null # The hash of the plan-to-nix output (makes the plan-to-nix step a fixed output derivation)
7+, cabalProject ? null # Cabal project file (when null uses "${src}/cabal.project")
78, ghc ? defaults.ghc
89, nix-tools ? defaults.nix-tools
910, hpack ? defaults.hpack
@@ -149,11 +150,18 @@ let
149150 }
150151 else replaceSoureRepos rawCabalProject;
151152
152− plan-nix = runCommand "plan-to-nix-pkgs" {
153+ plan-nix = runCommand "plan-to-nix-pkgs" ({
153154 nativeBuildInputs = [ nix-tools ghc hpack cabal-install pkgs.rsync pkgs.git ];
154155 # Needed or stack-to-nix will die on unicode inputs
155156 LANG = "en_US.UTF-8";
156− } (''
157+ } // (if plan-sha256 == null
158+ then {}
159+ else {
160+ outputHashMode = "recursive";
161+ outputHashAlgo = "sha256";
162+ outputHash = plan-sha256;
163+ })
164+ ) (''
157165 tmp=$(mktemp -d)
158166 cd $tmp
159167 cp -r ${maybeCleanedSource}/* .