28 haskellPackages = pkgs.pkgsCross.ghcjs.haskell.packages.${ghc}.extend (
29 with pkgs.haskell.lib;
30 finalHaskellPkgs: previousHaskellPkgs: {
31 # Includes BigInt patch to support the jsbi polyfill, for Quick/PrimJS
32 ghc = previousHaskellPkgs.ghc.overrideAttrs (
36 patches = (drv.patches or [ ]) ++ [ "${inputs.miso}/nix/patches/jsbi.patch" ];
41 miso = finalHaskellPkgs.callCabal2nix "miso" inputs.miso { };
42 miso-lynx = finalHaskellPkgs.callCabal2nix "miso-lynx" inputs.miso-lynx { };
45 jsaddle = finalHaskellPkgs.callCabal2nix "jsaddle" "${inputs.miso.inputs.jsaddle}/jsaddle" { };
46 ghcjs-base = finalHaskellPkgs.callCabal2nix "ghcjs-base" inputs.ghcjs-base { };
49 crypton = dontCheck previousHaskellPkgs.crypton;
50 cryptonite = dontCheck previousHaskellPkgs.cryptonite;
51 monad-logger = doJailbreak previousHaskellPkgs.monad-logger;
52 string-interpolate = doJailbreak previousHaskellPkgs.string-interpolate;
53 servant-server = doJailbreak previousHaskellPkgs.servant-server;
56 package = haskellPackages.callCabal2nix pname src { };
57 miso-lynx-node_modules = stdenv.mkDerivation {
58 pname = "miso-lynx-node_modules";
61 nativeBuildInputs = [ bun ];
63 # ExplanationNote: fixed-output derivation
64 # cannot reference Nix store paths,
65 # and the fixup phase would change /usr/bin/… into /nix/store/…
68 export BUN_INSTALL_CACHE_DIR=$(mktemp -d)
69 bun install --force --frozen-lockfile --no-progress --production
72 mkdir -p $out/node_modules
73 cp -R ./node_modules $out
75 # CorrectionNote: this has to be updated each time `${miso-lynx}/bun.lock` is updated
76 # eg. with `bun install --lockfile-only`
77 outputHash = "sha256-d3LP42/XGKs/GUnPQ8sO3JE4fVsacWuIfYEbsNlDZTE=";
78 outputHashAlgo = "sha256";
79 outputHashMode = "recursive";
81 mainLynxBundle = stdenv.mkDerivation {
83 version = package.version;
91 cp -r ${miso-lynx-node_modules}/node_modules .
92 substituteInPlace node_modules/.bin/rspack \
93 --replace-fail "#!/usr/bin/env" "#!${coreutils}/bin/env"
101 cp -v ${package}/bin/demo.jsexe/all.js .
102 bun build --minify all.js --target=bun --outfile=dist/all.js
111 cp -v dist/main.lynx.bundle $out/