I have an existing cabal project that successfully does Lucid → HTML and Clay → CSS. It uses GHC. Its flake.nix
is based on the pkgs.haskell.packages.ghc8107
package set.
How should I add GHCJS (JavaScript) features to this project? Here is the issue:
- The haskell4nix ecosystem seems somehow “hardwired” for a single GHC (or GHCJS) at the same time. I can’t somehow magically “mix”
pkgs.haskell.packages.ghc8107
withpkgs.haskell.packages.ghcjs
in the same environment (AFAIK).
If I’m right, what are my options? My current ideas:
- Create two separate targets in my
flake.nix
: One for the HTML/CSS stuff (the one I already have) and another one for the JavaScript stuff. I could access those environments like this:nix develop .#htmlcss
andnix develop .#javascript
. (And similar fornix build
.) - This is a problem: Since they’re two separate targets, they’ll end up in two separate
/store/*
paths, so how should I package them into a single directory/package for deployment? (Ideally the.js
files should simply end up in the same place as the.css
and other static files.) - I can think of one solution: Those two Nix targets would go into an outer Nix project, and the outer Nix project would have a
postBuild
hook to merge those two inner Nix results into a single directory/package for deployment. (I could get this deployable directory/package by just runningnix build
on the outer Nix.)
Am I on the wrong path?