Copy ob-run.hs file to local directory
In some environments, ghc will try to create .hi files in the same
directory as the source code when compiling. When the .hs file is in
the read-only Nix store this gives “openBinaryFile: permission
denied”. To avoid this, just copy the file to the working directory.
commitfc60da5aae9e57c90d755b5abbe7c0212f97b93d
authorMatthew Bauer <mjbauer95@gmail.com>
dateThu 7 May 2020, 13:01 (6 years ago)
parent8954990
default.nix+2−1
@@ -342,8 +342,9 @@ in rec {
342342 in nixpkgs.runCommand "ob-run" {
343343 buildInputs = [ (profiled.ghc.ghcWithPackages (p: [ p.backend p.frontend])) ];
344344 } ''
345+ cp ${exeSource} $PWD/ob-run.hs
345346 mkdir -p $out/bin/
346− ghc -x hs -prof -fno-prof-auto -threaded ${exeSource} -o $out/bin/ob-run
347+ ghc -x hs -prof -fno-prof-auto -threaded ob-run.hs -o $out/bin/ob-run
347348 '';
348349
349350 linuxExeConfigurable = linuxExe;