Packaging mutt configuration

I am trying to package mutt-wizard, which is basically a configuration manager for neomutt. At first, it worked great, I wrote it and published in my NUR repo:

When you add an account this script creates muttrc files in your home. And it starts like that:

# vim: filetype=neomuttrc

source /nix/store/bbsg34b9vi1rgq174gbrn82kcbb2hl59-mutt-wizard/share/mutt-wizard/mutt-wizard.muttrc # mw-autogenerated
set charset = "utf-8"
set send_charset = "utf-8:us-ascii:iso-8859-1"
set config_charset = "utf-8"

I’m pointing to master branch on NUR so it was cached only for 1 hour. So if I run nixos-rebuild it creates a new store entry with a new hash. And it stops working after nix-collect-garbage -d, which is clear why.

Can I do something about it? With /etc we can symlink files from the nix store. Maybe it is possible to link /usr/local/share as well? Or maybe there is an even more nix-friendly solution?

I would probably investigate a home-manager module.

1 Like

Yeah, but I want this to be globally available…
For now I added this:

    "neomuttrc".text = builtins.readFile "${}/share/mutt-wizard/mutt-wizard.muttrc";

It works but requires more than adding package to systemPackages

I have new idea to use makeWrapper to hardcode config file into mutt. And at the end of this muttrc file I would add source $HOME/.config/mutt/muttrc to load user individual config. I’ll post updates soon.

Here’s a working example:

just to let you know that home-manager can generate parts of the (neo)mutt configuration. Certainly not as advanced as mutt-wizard though but I thought I would mention it.