I made some backend using Stack.
My Stack project succeeds when I do stack build --nix
and it seems to create a nix package in local project cache directory in which executable is built. (.stack-work/install/x86_64-osx-<some sha1>
)
How can I cache it on Cachix? Cachix docs says do nix-build | cachix push
but I can't because I'm using stack build
instead.
FYI my ultimate goal is to run it on AWS and deliver the package via Cachix.
CodePudding user response:
stack build --nix
only uses Nix to get the compiler and system dependencies. The Haskell builds still run as user, as opposed to in Nix, so they don't produce store paths you can push.
You'll need to write a Nix expression that builds your project. For stack, I recommend haskell.nix.
It does rely on "import from derivation" quite a bit. If you need a CI with good support for this, I recommend Hercules CI. (full transparency: I created it)