on iko/ghcjs-patch-master help sign in
callStackToNix: Enable ignorePackageYaml argument (#226)
dadf29eBryan Richter
lib/call-stack-to-nix.nix+8−3
@@ -6,15 +6,20 @@
6 * see also `call-cabal-project-to-nix`!
6 * see also `call-cabal-project-to-nix`!
7 */
7 */
8{ runCommand, nix-tools, pkgs }:
8{ runCommand, nix-tools, pkgs }:
9−{ src, stackYaml ? null }:
9+{ src, stackYaml ? null, ignorePackageYaml ? false }:
10let
10let
11+ stackToNixArgs = builtins.concatStringsSep " " [
12+ "--stack-yaml=${src}/${if stackYaml == null then "stack.yaml" else stackYaml}"
13+ (if ignorePackageYaml then "--ignore-package-yaml" else "")
14+ "-o ."
15+ ];
11 stack = runCommand "stack-to-nix-pkgs" {
16 stack = runCommand "stack-to-nix-pkgs" {
12 nativeBuildInputs = [ nix-tools pkgs.nix-prefetch-git ];
17 nativeBuildInputs = [ nix-tools pkgs.nix-prefetch-git ];
13 } ''
18 } ''
14 export LANG=C.utf8 # Needed or stack-to-nix will die on unicode inputs
19 export LANG=C.utf8 # Needed or stack-to-nix will die on unicode inputs
15 mkdir -p $out
20 mkdir -p $out
16
21
17− (cd $out && stack-to-nix --stack-yaml=${src}/${if stackYaml == null then "stack.yaml" else stackYaml} -o .)
22+ (cd $out && stack-to-nix ${stackToNixArgs})
18
23
19 # We need to strip out any references to $src, as those won't
24 # We need to strip out any references to $src, as those won't
20 # be accessable in restricted mode.
25 # be accessable in restricted mode.
@@ -35,4 +40,4 @@ runCommand "stack-to-nix-pkgs-with-src" { nativeBuildInputs = [ pkgs.rsync ]; }
35 # nix sandboxing is enabled (since it can prevent nix from moving the directory
40 # nix sandboxing is enabled (since it can prevent nix from moving the directory
36 # out of the chroot sandbox).
41 # out of the chroot sandbox).
37 chmod +w $out
42 chmod +w $out
38−''
43+''