stylix icon indicating copy to clipboard operation
stylix copied to clipboard

treewide: optionalize fonts

Open Flameopathic opened this issue 5 months ago • 2 comments

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

Notify maintainers

Flameopathic avatar Jul 05 '25 14:07 Flameopathic

I would prefer adding stylix.fonts.enable instead of making the entire stylix.fonts nullable, 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 enable sub-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 set foo.enable how it likes.

If the second module instead had to set foo = null, then the first module would fail to merge its foo.* definitions.

Agreed. The enable option scales better. For reference, using null as an implicit enable = false; has been originally discussed in:

However, I personally prefer setting the values to null rather than having a separate enable option - this has the added benefit of causing an error if a module doesn't respect enable = false and tries to use the value anyway.

Yes, setting the values to null seems more ergonomic than setting a related enable option to false.

-- https://github.com/nix-community/stylix/issues/929#issuecomment-2698425488

-- https://github.com/nix-community/stylix/pull/1640#discussion_r2195536674

trueNAHO avatar Jul 09 '25 17:07 trueNAHO

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.

Flameopathic avatar Jul 09 '25 19:07 Flameopathic