79 lines
1.9 KiB
Nix
79 lines
1.9 KiB
Nix
{
|
|
callPackage,
|
|
haskellPackages,
|
|
haskell,
|
|
zlib,
|
|
watchexec,
|
|
wasm32-wasi-cabal,
|
|
wasm32-wasi-ghc,
|
|
writeShellApplication,
|
|
nodejs,
|
|
pkg-config,
|
|
python3,
|
|
fetchFromGitHub,
|
|
}:
|
|
let
|
|
# TODO: this information is duplicated at the bottom. need to fix that.
|
|
ghc-wasm-compat-rev = "ef21ada9436046c7b118314d0c73752253ec58e1";
|
|
ghc-wasm-compat-src = fetchFromGitHub {
|
|
owner = "konn";
|
|
repo = "ghc-wasm-earthly";
|
|
rev = ghc-wasm-compat-rev;
|
|
hash = "sha256-oUf7HFLNxBZ/roFRe5q7Sz0D0ZRygu8prxEYoYuhSU8=";
|
|
};
|
|
in
|
|
let
|
|
shell = haskellPackages.developPackage {
|
|
name = "numbersquare";
|
|
root = ./.;
|
|
overrides = _: _: {
|
|
ghc-wasm-compat =
|
|
haskellPackages.callCabal2nix "ghc-wasm-compat" "${ghc-wasm-compat-src}/ghc-wasm-compat"
|
|
{ };
|
|
};
|
|
modifier =
|
|
let
|
|
addBuildTools =
|
|
drv:
|
|
haskell.lib.addBuildTools drv (
|
|
[
|
|
watchexec
|
|
wasm32-wasi-cabal
|
|
wasm32-wasi-ghc
|
|
nodejs
|
|
pkg-config
|
|
(writeShellApplication {
|
|
name = "dev-server";
|
|
text = ''
|
|
python -m http.server -d ./out
|
|
'';
|
|
runtimeInputs = [ python3 ];
|
|
})
|
|
]
|
|
++ (with haskellPackages; [
|
|
fourmolu
|
|
happy
|
|
haskell-language-server
|
|
cabal-install
|
|
hpack
|
|
ghcid
|
|
cabal-fmt
|
|
hoogle
|
|
])
|
|
);
|
|
addExtraLibraries = drv: haskell.lib.addExtraLibraries drv [ zlib ];
|
|
in
|
|
drv: addExtraLibraries (addBuildTools drv);
|
|
};
|
|
in
|
|
shell.overrideAttrs (old: {
|
|
shellHook = (old.shellHook or "") + ''
|
|
cat > cabal.project.local <<EOF
|
|
source-repository-package
|
|
type: git
|
|
location: https://github.com/konn/ghc-wasm-earthly
|
|
tag: ${ghc-wasm-compat-rev}
|
|
subdir: ghc-wasm-compat
|
|
EOF
|
|
'';
|
|
})
|