File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ with lib.types;
2121 shell = mkOption {
2222 type = submodule [
2323 ( import ./shell.nix { projectConfig = config ; } )
24- { _module . args = { inherit ( pkgs . haskell-nix ) haskellLib ; } ; }
24+ { _module . args = { inherit pkgs ; inherit ( pkgs . haskell-nix ) haskellLib ; } ; }
2525 ] ;
2626 default = { } ;
2727 description = ''
Original file line number Diff line number Diff line change 6363 } ;
6464 shellHook = lib . mkOption {
6565 type = lib . types . str ;
66- default = "" ;
66+ # Shell hook to set EM_CACHE to a writable temporary directory if not already set
67+ default = lib . optionalString pkgs . stdenv . hostPlatform . isGhcjs ''
68+ if [ -z "$EM_CACHE" ]; then
69+ # Create a unique temporary directory using mktemp
70+ EM_CACHE_DIR=$(mktemp -d -t emcache-ghcjs-XXXXXX)
71+
72+ # Copy the default Emscripten cache contents to the temporary directory
73+ DEFAULT_EM_CACHE="${ pkgs . pkgsBuildBuild . emscripten } /share/emscripten/cache"
74+ if [ -d "$DEFAULT_EM_CACHE" ]; then
75+ cp -r "$DEFAULT_EM_CACHE"/* "$EM_CACHE_DIR" 2>/dev/null || true
76+ chmod -R u+w "$EM_CACHE_DIR"
77+ fi
78+
79+ export EM_CACHE="$EM_CACHE_DIR"
80+ echo "Set EM_CACHE to $EM_CACHE"
81+ else
82+ echo "EM_CACHE already set to $EM_CACHE"
83+ fi
84+ '' ;
6785 } ;
6886
6987 # mkDerivation args
You can’t perform that action at this time.
0 commit comments