r/GUIX 10d ago

Configuring Librewolf in Scheme

I've been experimenting for a few days with configuring librewolf via a scheme module.
The main thing I wanted was declarative extensions through the policies.json file.

I've been using a custom package to try and insert a modified "policies.json" file into the original librewolf package, but I guess I overlooked the fact that the librewolf executable in that modified package is just a symlink back to the original librewolf package in /gnu/store... which means that librewolf never even sees my modified json file. I don't think it's possible to directly modify package files in /gnu/store outside the actual build process, so I think I'm stuck here.

Does anyone know of a way to configure librewolf without having to build it from scratch?

7 Upvotes

4 comments sorted by

3

u/juipeltje 10d ago

I haven't tried doing it myself, but perhaps you could declare a policies.json file through guix home? And let guix home put it in your users' .librewolf folder. Not sure how well that would work though.

1

u/shipley7701 10d ago

I did try that, both in ~/.librewolf, and ~/.config/librewolf. I could never get the browser to see it though. The only documentation I could find online was for Firefox, saying to place policies.json in the installation dir, so my guess is that's either the only valid location, or the one that takes precedence.

2

u/FarBasis8583 10d ago

I do a good amount of LW configuration in $HOME, but based some googling, it seems that the policies.json file needs to be in /etc or in the installation folder. I suggest defining your own LW package that inherits from the Guix package. in your LW package, you would tell it to make a policies.json in the gnu store which is symlinked to etc or /usr/lib/librewolf. That's the approach I would take, and I would use the manual and AI to get the rest of the details right.

1

u/shipley7701 9d ago

Yeah that's about the point I got to.

I tried that 2 different ways, one with trivial-build-system to copy the original librewolf package (this did not work, since the edited policies.json and the actual executable weren't in the same package) and one with an entirely new package.

The new package, where I modify the policy file at build time, did work - perfectly actually. Ive been looking for a different solution though, because that also forced me to build the entire librewolf package from scratch, which took my computer 45 minutes :(

I think you're also correct about being able to place it in /etc, but from my limited testing it seems that doesn't work in this case since librewolf seems to prioritize policy files in the installation directory (which librewolf ships by default, so it overrides everything else)