Install a custom version of boost?

I need to include a particular version of boost (1.74) which is not included in the nixos 24.11.

However the structure of the boost is quite complex, and I cannot copy it into my own /etc/nixos directory and use the “overlay” method to create my own boost package, which I did previously for other simple packages.

Is there any document that I can read to learn how to do this?

Thanks.

Do you need boost as systemPackage?

24.11 is having in version 1.81.0 currrently, according to the NixOS search, 25.05 in 1.87.0, same for unstable.

Are you using Nix Flakes or simply missing a channel update and rebuild for the latest version?

The problem that I’m facing is that I’m trying to build a FHS, which includes boost 1.74 in its /usr/lib directory.

I have now solve this problem by following steps.

  1. Copy the boost directory from nixpkgs to my own directory say /etc/nixos/pkgs/myboost
  2. execute cp 1.77.nix 1.74.nix in myboost
  3. Edit the overlay and append a line: boost174=prev.callPackage ../pkgs/myboost/1.74.nix {};

Then execute nix-shell -p boost1.74 will give the boost 1.74.

Though not a clever way…

According to nixhub.io there was a time in history where boost was packaged in 1.74 in nixpkgs.
You could checkout the commit listed there and try to build your FHS with it?