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

fonts broken for some applications #338933

Closed
yshui opened this issue Sep 2, 2024 · 21 comments
Closed

fonts broken for some applications #338933

yshui opened this issue Sep 2, 2024 · 21 comments

Comments

@yshui
Copy link
Contributor

yshui commented Sep 2, 2024

Describe the bug

root cause is #324516 removing the <include /> directive from fonts.conf. #338326 (and #338815) attempted at fixing this, but they are incomplete. as they only hot patched the fonts.conf installed to /etc, but not the one in the output of fontconfig, which is used by some packages.

for example:

--set-default FONTCONFIG_FILE "${fontconfig.out}/etc/fonts/fonts.conf" \
--set-default FONTCONFIG_PATH "${fontconfig.out}/etc/fonts" \

(just search for FONTCONFIG_FILE, there are many more.)

feels wrong to me to hardcode a fonconfig path for the application instead of using /etc/fonts.

related: #338908

Notify maintainers

@teto @K900


Add a 👍 reaction to issues you find important.

@yshui
Copy link
Contributor Author

yshui commented Sep 2, 2024

a simple workaround for this is setting FONTCONFIG_FILE and FONTCONFIG_PATH in environment.sessionVariables.

(Even with this workaround, some applications still doesn't fully work, like librewolf. I don't know what's causing it.)

@yshui
Copy link
Contributor Author

yshui commented Sep 2, 2024

I reverted #324516 locally and now i have 700 derivations to build :(

yshui added a commit to yshui/nixpkgs that referenced this issue Sep 2, 2024
Commit c55536c parameterized the
"include" direction in fonts.conf created by make-font-conf.xsl.
But it forgot to update the one use of make-font-conf.xsl in the
fontconfig derivation.

Fixes NixOS#324516 NixOS#338933
yshui added a commit to yshui/nixpkgs that referenced this issue Sep 2, 2024
Commit c55536c parameterized the
"include" directive in fonts.conf created by make-font-conf.xsl.
But it forgot to update the one use of make-font-conf.xsl in the
fontconfig derivation.

Fixes NixOS#324516 NixOS#338933
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/tests-are-failing-due-to-missing-fontconfig-config/51487/4

@alyssais alyssais pinned this issue Sep 2, 2024
@teto
Copy link
Member

teto commented Sep 2, 2024

sorry about that. I usually run a nixpkgs-review on my PRs, especially of this magnitude but It's been some time so I dont remember the details.
I confess I missed that pkgs/development/libraries/fontconfig/default.nix was calling ./make-fonts-conf.xsl directly instead of makeFontsConf. If it stays like this, I fear a similar issue rises again: it should use the function.
Thanks for providing fixes to the issue.

@yshui
Copy link
Contributor Author

yshui commented Sep 2, 2024

don't worry about it, everyone makes mistakes/misses stuff from time to time, it's inevitable.

i am more disappointed by the fact nixpkgs doesn't have some process in place to catch mistakes like this. and mistakes like this isn't even that subtle. (well, maybe things like this is actually much harder to catch than it seems on the surface. i am not involved in nixpkgs development, so please correct me.)

personally, since i started using nixos-unstable, on average i have had easy-to-catch bugs like this around once per month. which feels way more frequent than it should be, and does erode my trust in nixpkgs.

@JohnRTitor

This comment was marked as duplicate.

@tukanoidd
Copy link

i am more disappointed by the fact nixpkgs doesn't have some process in place to catch mistakes like this. and mistakes like this isn't even that subtle. (well, maybe things like this is actually much harder to catch than it seems on the surface. i am not involved in nixpkgs development, so please correct me.)

personally, since i started using nixos-unstable, on average i have had easy-to-catch bugs like this around once per month. which feels way more frequent than it should be, and does erode my trust in nixpkgs.

Not involved either, just pure speculation, but i think it's just not feasible to have some kind of automated testing for these things because there are more than 100k packages, 10k module options + home-manager, which also interacts with nixpkgs for some things. And they all can be mix-and-matched in variaety of different configurations, which nobody can predict. The language itself is lazy-evaluated and doesn't have any static type safety that you could encode your logic with (lib.types are runtime-based and dont enforce any compile-time guarantees either, just fancy test "identity" functions from what I can gather) and get errors as soon as the code is not used properly (LSPs try to provide as much static typing as possible based on pre-evaluated nixpkgs, but that usually is not enough). Basically, everything is mostly runtime and configuration (in terms of personal preferences) - dependant, hard/impossible to automate (unless you can think of something, then you're only welcome to contribute and make everyone's lives easier!)

@eclairevoyant
Copy link
Contributor

eclairevoyant commented Sep 3, 2024

Er no, we have package tests and NixOS tests, it's documented in the manual.
https://nixos.org/manual/nixpkgs/stable/#var-meta-tests-packages

And half the time it's people not even checking if their PRs eval, so that's not even at the level of writing package tests. We just need more restraint and less self-merges and other rushed merges.

@tukanoidd
Copy link

Er no, we have package tests and NixOS tests, it's documented in the manual.
https://nixos.org/manual/nixpkgs/stable/#var-meta-tests-packages

And half the time it's people not even checking if their PRs eval, so that's not even at the level of writing package tests. We just need more restraint and less self-merges and other rushed merges.

My bad, should've looked.

@luiswirth
Copy link
Contributor

This just broke my system...
Is there a workaround?
I tried adding this to my configuration.nix:

  environment.sessionVariables = {
    FONTCONFIG_FILE = "${pkgs.fontconfig.out}/etc/fonts/fonts.conf";
    FONTCONFIG_PATH = "${pkgs.fontconfig.out}/etc/fonts";
  };

but it doesn't help :(

@K900
Copy link
Contributor

K900 commented Sep 4, 2024

The fix should be making its way to channels very soon.

@MrSom3body
Copy link
Contributor

This just broke my system... Is there a workaround? I tried adding this to my configuration.nix:

  environment.sessionVariables = {
    FONTCONFIG_FILE = "${pkgs.fontconfig.out}/etc/fonts/fonts.conf";
    FONTCONFIG_PATH = "${pkgs.fontconfig.out}/etc/fonts";
  };

but it doesn't help :(

You need to remove the .out part so it looks like this:

environment.sessionVariables = {                               
  FONTCONFIG_PATH = "${pkgs.fontconfig}/etc/fonts";            
  FONTCONFIG_FILE = "${pkgs.fontconfig}/etc/fonts/fonts.conf"; 
};                                                             

@K900
Copy link
Contributor

K900 commented Sep 4, 2024

No, you don't, and it's not actually going to help.

@couchpotato007
Copy link

This just broke my system... Is there a workaround? I tried adding this to my configuration.nix:

  environment.sessionVariables = {
    FONTCONFIG_FILE = "${pkgs.fontconfig.out}/etc/fonts/fonts.conf";
    FONTCONFIG_PATH = "${pkgs.fontconfig.out}/etc/fonts";
  };

but it doesn't help :(

if you use flakes you can simply use an old flake.lock file until the fix comes. That works for me.

@nakoo
Copy link

nakoo commented Sep 4, 2024

The fix should be making its way to channels very soon.

Is there a PR tracker related to this?

@eclairevoyant
Copy link
Contributor

You'll have to wait for the next staging-next merge - #338840

@K900
Copy link
Contributor

K900 commented Sep 5, 2024

The fix for most applications should be in nixos-unstable now.

@K900 K900 closed this as completed Sep 5, 2024
@luiswirth
Copy link
Contributor

This did fix many of my applications. But wezterm is for instance still broken... So this issue is not fully fixed.

@K900
Copy link
Contributor

K900 commented Sep 5, 2024

What is broken about wezterm?

@eclairevoyant
Copy link
Contributor

eclairevoyant commented Sep 5, 2024

@luiswirth that's an unrelated issue, follow #336069 instead

@acid-bong
Copy link
Contributor

Is this issue the reason why mono font is (was?) no longer an alias for monospace? I just updated today (using nixos-unstable) and Rofi (which uses mono instead of monospace) now falls back to sans-serif

@fabianhjr fabianhjr unpinned this issue Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests