How can I stop mongodb being build from source very frequently when I upgrade nixos?
Not the answer you’re looking for… but see Petition to build and cache unfree packages on cache.nixos.org - #7 by vcunat
From what I can find, mongodb is provided in 2 versions, 3.x and 4.x. The former is using AGPL and considered a “free” license, the latter is using a license that isn’t considered “free” and therefore can’t be built by hydra.
As the latter license seems to allow redistribution though, it might be built by hydra again once some things and discussions have been settled. In the thread @aanderse linked are some links to GitHub issues, which again link to other issues.
I skimmed it yesterday and the topics TL’DR seems to be “it’s not as easy as it sounds for legal and ethical reasons”.
PS: A kind-of workaround would be to use a version controlled configuration with pinning and only update the pins through CI, let it build the config and then upload the built system to a (private) cachix instance or a self hosted substitute.
For anyone else that stumbles across this older topic (like I did), one option is to pin the mongodb version. I did that in my flakes setup.
I don’t like packaging binary packages, but I had no choice here since I’m struggling building an up-to-date version of MongoDB 7 (mongodb-7_0: init at 7.0.12 by drupol · Pull Request #333258 · NixOS/nixpkgs · GitHub).
This PR proposes MongoDB Community Edition (binary packages): mongodb-ce: init at 7.0.12 by drupol · Pull Request #333623 · NixOS/nixpkgs · GitHub
Feel free to review it and add some feedback.
Many thanks for making that available. I noticed 7-CE listed when searching for MongoDB from Devbox. Building wasn’t working well on either my laptop or desktop machine, so it’s great to be able to use this.