Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Commit

Permalink
Merge branch 'sandbox-webghc'
Browse files Browse the repository at this point in the history
  • Loading branch information
shlevy committed Apr 20, 2022
2 parents 01912a9 + 4d84785 commit 948ab16
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions nix/pkgs/web-ghc/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ haskell, makeWrapper, runCommand, extraPackagesFun ? ps: [ ] }:
{ haskell, makeWrapper, runCommand, extraPackagesFun ? ps: [ ], writeScriptBin, bubblewrap }:
let
web-ghc-server = haskell.packages.web-ghc.components.exes.web-ghc-server;

Expand All @@ -9,14 +9,19 @@ let
ps.plutus-contract
ps.plutus-ledger
] ++ (extraPackagesFun ps));

runtimeGhcWrapped = writeScriptBin "runghc" ''
export PATH=${bubblewrap}/bin:${runtimeGhc}/bin
exec bwrap --ro-bind /nix /nix --proc /proc --dev /dev --ro-bind "''${@: -1}" "''${@: -1}" --unshare-all runghc "$@"
'';
in
runCommand "web-ghc" { buildInputs = [ makeWrapper ]; } ''
# We need to provide the ghc interpreter with the location of the ghc lib dir and the package db
mkdir -p $out/bin
ln -s ${web-ghc-server}/bin/web-ghc-server $out/bin/web-ghc-server
wrapProgram $out/bin/web-ghc-server \
--set GHC_LIB_DIR "${runtimeGhc}/lib/ghc-${runtimeGhc.version}" \
--set GHC_BIN_DIR "${runtimeGhc}/bin" \
--set GHC_BIN_DIR "${runtimeGhcWrapped}/bin" \
--set GHC_PACKAGE_PATH "${runtimeGhc}/lib/ghc-${runtimeGhc.version}/package.conf.d" \
--set GHC_RTS "-M2G"
''

0 comments on commit 948ab16

Please sign in to comment.