Wrong version of go used for flake, don't understand why

I can’t seem to build the Crowdsec flake. See #31 - Can't build crowdsec after `nix flake update` - kampka/nix-flake-crowdsec - Codeberg.org. I can’t understand why my system keeps using go 1.23.6. I have not installed go on my system.

The crowdsec package you are using is written in such a way that it uses the default (usually the latest available) go in the branch. You seem to be on the nixos-24.11 branch, which doesn’t have go 1.24 yet (and won’t receive it either, 25.05 will have it, as it is in the unstable branches already). What versions of go you have installed on your system does not affect your builds in the nix sandbox.
What the package author in the discussion you linked seems to not realize is that you’re using crowdsec via the nixos module. This calls the package using the nixpkgs instance used for you whole system, which is nixos-24.11.
You can now fix your problem by specifying services.crowdsec.package to be the package output of the crowdsec flake. That way it actually gets built using go 1.24 out of the nixpkgs in the flake.
This is not the prettiest solution, but it should work as far as I can tell.

Setting:

services.crowdsec.package = 
  inputs.crowdsec.packages."x86_64-linux".crowdsec;
services.crowdsec-firewall-bouncer.package = 
  inputs.crowdsec.packages."x86_64-linux".crowdsec-firewall-bouncer;

solved the problem. Thank you for pointing me in the right direction!