Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stylix: delegate default font declarations #366

Open
trueNAHO opened this issue May 13, 2024 · 7 comments
Open

stylix: delegate default font declarations #366

trueNAHO opened this issue May 13, 2024 · 7 comments
Labels
technical debt Things which should be cleaned up or improved

Comments

@trueNAHO
Copy link
Collaborator

trueNAHO commented May 13, 2024

The

  • stylix.fonts.emoji
  • stylix.fonts.monospace
  • stylix.fonts.sansSerif
  • stylix.fonts.serif

Stylix options 2 should be removed since NixOS 1 and Home Manager 3 provide the same

  • fonts.fontconfig.defaultFonts.emoji
  • fonts.fontconfig.defaultFonts.monospace
  • fonts.fontconfig.defaultFonts.sansSerif
  • fonts.fontconfig.defaultFonts.serif

options.

This would close the following tickets:

@trueNAHO trueNAHO added the technical debt Things which should be cleaned up or improved label May 13, 2024
@danth
Copy link
Owner

danth commented May 13, 2024

Some apps don't respect fontconfig, which is why Stylix has its own options which build on top of fontconfig but also configure those unsupported apps explicitly.

@trueNAHO
Copy link
Collaborator Author

Some apps don't respect fontconfig, which is why Stylix has its own options which build on top of fontconfig but also configure those unsupported apps explicitly.

In that case, the

options should default to the fonts.fontconfig.defaultFonts values for NixOS and Home Manager. Currently, Stylix hard-codes the Home Manager default value.

Considering that the Home Manager fonts.fontconfig.defaultFonts values default to [], what should Stylix do when this value is []? Either we provide a hard-coded fallback or we do not declare fonts in that case. Since Stylix aims to provide a coherent experience, it might be better to provide a fallback but try the fonts.fontconfig.defaultFonts value from Home Manager.

@danth
Copy link
Owner

danth commented May 13, 2024

Perhaps we should simply do nothing for an empty list. This would coincide with supporting null values for other options, which has been suggested in the past as an alternative to a global stylix.enable option.

I support removing the current defaults since they can make desktop environments which have their own standard font, such as GNOME, look unusual unless the user knows the name of that standard font and explicitly chooses it.

@trueNAHO
Copy link
Collaborator Author

Perhaps we should simply do nothing for an empty list. This would coincide with supporting null values for other options, which has been suggested in the past as an alternative to a global stylix.enable option.

I support removing the current defaults since they can make desktop environments which have their own standard font, such as GNOME, look unusual unless the user knows the name of that standard font and explicitly chooses it.

Yes, not declaring fonts when the fonts.fontconfig.defaultFonts values are set to [] would be the least controversial and best solution.

In conclusion we declare fonts.fontconfig.defaultFonts as the default in all cases, and do not declare the fonts in Stylix applications when they are set to [].

@ernestha
Copy link

ernestha commented Jun 16, 2024

I'm writing here since this discussion might be related to my issue and maybe you guys can clear that up. If it is not, please let me know and I"ll turn somewhere else for help.

I just installed Stylix yesterday both in my NixOS as well as my Home Manager config (I have HM set up as standalone). It works well for the most part, but when trying to set default fonts, I encounter errors both during nixos-rebuild and during home-manager switch. In HM, I have also set up fonts.fontconfig for my user. In NixOS, that is not the case.

I have used the example from the Stylix book in my config (this is part of a file imported by my HM config):

{ config, pkgs, ... }:

{
    stylix.enable = true;

   ... omitted for brevity ...

    # Fonts config
    stylix.fonts = {
        #  monospace = {
        #          package = pkgs.nerdfonts.override { fonts = [ “Meslo” ]; };
        #          name = “MesloLGS Nerd Font”;
        #       };
          sansSerif = {
                  package = pkgs.dejavu_fonts;
                  name =DejaVu Sans;
          };
          serif = {
                  package = pkgs.dejavu_fonts;
                  name =DejaVu Serif;
          };
    };
}

The monospace part is commented out b/c I thought originally, that the error was related to my override.

When running home-manager switch, I get the following error on all the lines name = ...: "error: syntax error, unexpected invalid token". The same happens on the system level with the same config.

I am pretty new to Nix, but I thought I was able to figure out at least syntax errors. However, this gives me a headache. Could it be related to fonts.fontconfig being enabled? Or is there something else I am missing?

Thanks in advance for any help or advice!

@trueNAHO
Copy link
Collaborator Author

trueNAHO commented Jun 16, 2024

    stylix.fonts = {
        #  monospace = {
        #          package = pkgs.nerdfonts.override { fonts = [ “Meslo” ]; };
        #          name = “MesloLGS Nerd Font”;
        #       };
          sansSerif = {
                  package = pkgs.dejavu_fonts;
                  name =DejaVu Sans;
          };
          serif = {
                  package = pkgs.dejavu_fonts;
                  name =DejaVu Serif;
          };
    };

I get the following error on all the lines name = ...: "error: syntax error, unexpected invalid token". The same happens on the system level with the same config.

Try replacing the (U+201C) and (U+201D) characters with " (U+0022).

@ernestha
Copy link

@trueNAHO: Oh wow, I did not spot that. That's what you get from copy-pasting, I guess :) Thank you so much! And sorry for hijacking this thread with that oversight.

@trueNAHO trueNAHO mentioned this issue Dec 29, 2024
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
technical debt Things which should be cleaned up or improved
Projects
None yet
Development

No branches or pull requests

3 participants