nix-helpers: 3626477c86e9632157b3757afe2aaa432c56dffb
1: { cabal-install, callPackage, ghc, hackageIndex, lib, runCommand }:
2: with { oldHackageIndex = hackageIndex; };
3: { name, cabalFile, doCheck ? true, doBench ? false
4: , hackageIndex ? oldHackageIndex }:
5: with {
6: plan = runCommand "${name}-plan.json" {
7: buildInputs = [
8: cabal-install
9: ghc
10: (callPackage ./fakeCurl.nix { inherit hackageIndex; })
11: ];
12: CABAL_CONFIG = builtins.toFile "dummy-cabal.config" ''
13: repository repo
14: url: http://example.org/
15: secure: True
16: root-keys: []
17: key-threshold: 0
18: '';
19: } ''
20: export HOME="$PWD"
21: mkdir -p "$HOME/.cache/cabal"
22: cabal update
23: cp ${lib.escapeShellArg "${cabalFile}"} ./${
24: lib.escapeShellArg "${name}.cabal"
25: }
26: cabal build --dry-run ${if doCheck then "--enable-tests" else ""} ${
27: if doBench then "--enable-benchmarks" else ""
28: }
29: mv dist-newstyle/cache/plan.json "$out"
30: '';
31: };
32: plan // {
33: json = lib.importJSON plan;
34: }
Generated by git2html.