my configuration.nix has this line:
nixpkgs.config.allowUnfree = true;
If you’re using an additional nixpkgs, (I have both 24.11 and unstable) there’s another syntax for that, depending on whether you use flakes. Anyway the above should work, flakes or not.
If not, post the error you’re getting.
Probably you’re putting the code in the wrong place.
Maybe try searching GitHub for example code, lots of people put their configs on there. Or if you post your whole config file someone can probably help