# How do I abstract this part of the configuration

**URL:** https://discourse.nixos.org/t/how-do-i-abstract-this-part-of-the-configuration/64574
**Category:** Help
**Created:** [May 21, 2025, 3:05pm UTC](https://discourse.nixos.org/t/how-do-i-abstract-this-part-of-the-configuration/64574 "2025-05-21T15:05:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![2kYworGj](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/2/67e7ee/32.png) [@2kYworGj](https://discourse.nixos.org/u/2kYworGj)
#### Post date: [May 21, 2025, 3:05pm UTC](https://discourse.nixos.org/t/how-do-i-abstract-this-part-of-the-configuration/64574/1 "2025-05-21T15:05:45Z")

</div>

- [file that I am trying to abstract](https://github.com/xNyfPtx/nix-config/blob/dd0273ec5f10bdcfaa7a901724a3d75bc7277ccd/home/librewolf.nix#L73-164).
- [attempt in trying to abstract but it doesn’t build because of a syntax error](https://github.com/xNyfPtx/nix-config/blob/6bf84afbde58b2fd24137d202dc83d66c1c70e3f/home/librewolf.nix#L73-L100).
- [what i’m trying to do](https://discourse.nixos.org/t/declare-firefox-extensions-and-settings/36265/17).
- How do I abstract this? I still don’t get the function syntax despite the Nix Manual and the NixOS Manual.

---

<div class="post-metadata">

### Author: ![smkuehnhold](https://discourse.nixos.org/user_avatar/discourse.nixos.org/smkuehnhold/32/4326_2.png) [@smkuehnhold](https://discourse.nixos.org/u/smkuehnhold)
#### Post date: [May 21, 2025, 3:23pm UTC](https://discourse.nixos.org/t/how-do-i-abstract-this-part-of-the-configuration/64574/2 "2025-05-21T15:23:45Z")

</div>

Not quite sure what shape you want `programs.firefox.policies."3rdparty".Extensions."redirector@einaregilsson.com".redirects` to take, but [listToAttrs](https://noogle.dev/f/builtins/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?

---

<div class="post-metadata">

### Author: ![2kYworGj](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/2/67e7ee/32.png) [@2kYworGj](https://discourse.nixos.org/u/2kYworGj)
#### Post date: [May 21, 2025, 4:38pm UTC](https://discourse.nixos.org/t/how-do-i-abstract-this-part-of-the-configuration/64574/3 "2025-05-21T16:38:05Z")

</div>

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](https://github.com/xNyfPtx/nix-config/blob/c099f6ecde1c745cadb5dec49d8efd0fa46a9284/home/librewolf.nix)
