Skip to content

Conversation

@chaserhkj
Copy link
Contributor

This PR adds nix packaging for BNFC using haskell.nix, allowing it to be integrated directly with the nix ecosystem, producing more reproducible builds as well.

Note that this does not invalidate the current stack-based build system, this is just additional nix build scripts that can be used by nix systems, quite like the Dockerfile we are already providing. This does not create multiple sources of truth for building as well since haskell.nix reads stack yaml configurations and generate build instructions on the fly.

@andreasabel
Copy link
Member

Thanks for the contribution!

Would be great if this could be tested by a GitHub workflow (CI), so that it does not bit-rot.
Do you think you can add such a workflow?
I have seen it e.g. at https://github.com/haskell/hackage-server/blob/8a8d7391b819921f67aa446c134a2bf83da1b9b4/.github/workflows/nix-flake.yml

@chaserhkj
Copy link
Contributor Author

Workflow is added, should be working now for both os x and linux builds using nix. A few notes:

  • Currently I only added building with GHC 9.8 branch in nix workflow. Let me know if you feel building all supported versions makes more sense.
  • I saw that they were testing development environments in other example workflows. But our configured development environments includes Haskell language server that needs to be compiled. And that would take a ridiculously longer period of time (>20mins), so I just disabled it for now.
  • For nix flake check to pass I need to do some workarounds in flake.nix to deal with hydraJobs and doctests, see comments there.

@andreasabel andreasabel added the nix Building with nix label Jul 21, 2024
@andreasabel
Copy link
Member

Excellent, I'll merge this now!

I cannot promise to maintain this, unfortunately, as I lack the nix skills. So further involvement would be appreciated.

@andreasabel andreasabel merged commit 4496a35 into BNFC:master Jul 21, 2024
@andreasabel andreasabel added this to the 2.9.5.1 milestone Jul 21, 2024
@chaserhkj chaserhkj deleted the nix-packaging branch July 22, 2024 23:35
@andreasabel
Copy link
Member

andreasabel commented Jul 23, 2025

@chaserhkj : The nix workflow needs update to the lastest GHCs (it has now been broken for 9 months). https://github.com/BNFC/bnfc/actions/runs/11597112476
Can you update the nix config / workflow, please?

@chaserhkj
Copy link
Contributor Author

@chaserhkj : The nix workflow needs update to the lastest GHCs (it has now been broken for 9 months). https://github.com/BNFC/bnfc/actions/runs/11597112476 Can you update the nix config / workflow, please?

I'll take a look this week and open another PR.

@andreasabel andreasabel modified the milestones: 2.9.5.1, 2.9.6 Aug 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nix Building with nix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants