-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
nixos/plymouth: Add label plugin and a font to the initrd #99011
Conversation
Nice! This has been bugging me for literally years. I wonder if the font should be controlled by some option. What determines the font that gets used during shutdown? Should we try and make sure it's the same one? |
I'd be fine with using the label-ft patches in plymouth, however... there is a PR that fixes this and overhauls a lot of plymouth #84158. But the issue with it is it aspires to do slightly too much in one PR (mostly the commonFunction pieces breaking things) I'm planning on fixing up that PR and then subsequently defaulting to the bgrt theme. Flicker free boot is blocked on #74842 and that is a long ways to being ready. |
I am however interested in why 3128d14 is different from what you have... |
The difference is that this PR uses the upstream label plugin, while 3128d14 (#84158) uses the label-ft plugin via a patch (6502fff) that’s still not merged upstream (https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/45). Plus side for label-ft: it uses Freetype directly, so it can get away without pulling in 5 MB of libraries and needing a fontconfig configuration. Minus side: there seems to have been no upstream activity toward merging that for 4 years. |
@jtojnar Does your reservation on using those patches still stand from #84158 (comment) with this in context? If so, I'd defer to that decision and merge this with a |
5 MB increase does not sound that bad to me so I would still prefer the upstream label solution over unmerged patches. But initrd maintainers will have final say. We can try to slim down cairo as suggested above it they see it as a problem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually compared this to my intrd and then a the size increase... not really something to be overly concerned about. It's off by default too.
If we can add a font option like that other plymouth PR I'd merge.
This allows Plymouth to show the “NixOS 21.03” label under the logo at startup like it already does at shutdown. Fixes NixOS#59992. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
b7f1a65
to
9d21f1d
Compare
Okay, I added an option for the font file. It’s a little weird in that the theme actually decides which font to request from Fontconfig, and this option only affects which font file is made available to Fontconfig during boot to satisfy this request. During shutdown, the normal system Fontconfig configuration and fonts are used. I set the default as DejaVu Sans because it has the privileged position of being our Fontconfig fallback font:
If the user adds |
@@ -38,6 +38,14 @@ in | |||
|
|||
enable = mkEnableOption "Plymouth boot splash screen"; | |||
|
|||
font = mkOption { | |||
default = "${pkgs.dejavu_fonts.minimal}/share/fonts/truetype/DejaVuSans.ttf"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be nice to be able to figure what font is the default sans font for a system. this is just a comment and not a suggestion, but I feel it would be pretty boring to do this with passthru
listing all the paths to a font within a package, and making a fonts.fonts.primaryFont
, and fonts having $variant.path
attr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The relevant font here is not a system default, but one specified by the theme.
Finding the default sans font is a simple matter of running fc-match -f '%{file}' Sans
in an environment with the appropriate Fontconfig configuration. Or if we could somehow pull out the value Noto Sans
from the selected Plymouth theme, we could run fc-match -f '%{file}' 'Noto Sans'
. Unfortunately Plymouth themes are written in a custom scripting language and I don’t see a way to evaluate them except in Plymouth itself. We could maybe write some atrocious regex that works most of the time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I now see the nixos version at boot
Motivation for this change
This allows Plymouth to show the “NixOS 21.03” label under the logo at startup like it already does at shutdown.
Fixes #59992.
Increases the compressed initrd size by about 5 MB when Plymouth is enabled, since
/etc/plymouth/plugins/label.so
depends on rather more libraries than you’d like. Maybe this is fine since Plymouth is opt-in. We might be able to trim this by using a copy of Cairo compiled against fewer backends? A more minimal version of the label plugin was proposed at https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/45.Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)