treewide: optionalize fonts
This will not be ready for merge before a few more targets begin using mkTarget.
Blocking targets
- [ ] GNOME HM (https://github.com/nix-community/stylix/pull/1650)
- [ ] GRUB NixOS
- [x] GTK HM (https://github.com/nix-community/stylix/pull/1596)
- [ ] KDE HM
- [ ] NixVim (https://github.com/nix-community/stylix/pull/1535)
- [x] ReGreet NixOS (https://github.com/nix-community/stylix/pull/1598)
- [x] Rio HM (https://github.com/nix-community/stylix/pull/1599)
- [ ] Sway HM
- [ ] Droid
fonts.nix
Things done
- [ ] Tested locally
- [ ] Tested in testbed
- [x] Commit message follows commit convention
- [ ] Fits style guide
- [ ] Respects license of any existing code used
Notify maintainers
I would prefer adding
stylix.fonts.enableinstead of making the entirestylix.fontsnullable, see #1640. Also optionalizing fonts in droid should be part of this pr imo.
Cross-post:
Making iconTheme null by default feels wrong.
I'd personally argue an
enablesub-option is usually better than a nullable option, at least in general.Much easier to override/merge/toggle option definitions this way.
E.g. if one module defines some
foo.*options, perhaps to set sane defaults or shared config, another module can setfoo.enablehow it likes.If the second module instead had to set
foo = null, then the first module would fail to merge itsfoo.*definitions.Agreed. The
enableoption scales better. For reference, usingnullas an implicitenable = false;has been originally discussed in:However, I personally prefer setting the values to
nullrather than having a separate enable option - this has the added benefit of causing an error if a module doesn't respectenable = falseand tries to use the value anyway.Yes, setting the values to
nullseems more ergonomic than setting a relatedenableoption tofalse.-- https://github.com/nix-community/stylix/issues/929#issuecomment-2698425488
-- https://github.com/nix-community/stylix/pull/1640#discussion_r2195536674
Because #1640 changes the precedent set in #717, #943, and https://github.com/nix-community/stylix/issues/929#issuecomment-2695762652, I am going to pause work on this until each of the current optional top-level options (image, cursor) have enable options like iconTheme. I believe that having parity between the functionality all of the top-level options should be the end goal.