How do I abstract this part of the configuration

Not quite sure what shape you want programs.firefox.policies."3rdparty".Extensions."redirector@einaregilsson.com".redirects to take, but listToAttrs expects the element attr sets to have both a name and a value. And your redirect function seems to only return what I assume you intend the value to be?

Nevermind, I fixed the syntax error already. I forgot what I did though but thanks for the heads about listToAttrs. nix-config/home/librewolf.nix at c099f6ecde1c745cadb5dec49d8efd0fa46a9284 · xNyfPtx/nix-config · GitHub