Ruby on Rails new project startup problem

Whenever I run the code rails new example I get an error like this:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

Even though I have the necessary packages in my nixos config, I still get the same error.