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
boot.loader.grub: add theme option #83678
Conversation
@yutyo this is the thing you need |
4663ffc
to
ab73952
Compare
# Load theme fonts | ||
"; | ||
|
||
find( { wanted => sub { # TODO: recursive glob for *.pf2 in theme, rewrite path from $theme/(.*) to $1 |
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 want to get this hack removed before merge, anyone with good perl knowledge has any idea?
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.
Breaks if the .pf2 file is in a subfolder of the theme, since we're referencing it by it's filename, not sub-path
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 wanted function takes no arguments but rather does its work through a collection of variables.
`$File::Find::dir` is the current directory name, `$_` is the current filename within that directory `$File::Find::name` is the complete pathname to the file.
https://perldoc.perl.org/File/Find.html#The-wanted-function
I believe you should be able to replace $_
with $File::Find::name
to fix the issue with files in subfolders.
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.
Alternatively, could we instead leave it to the user to set EDIT: nofont
separately from theme
?
It's not like it's a self-contained theme system anyway, which is why we have this hack.
Having distinct options allows more customization in the end. The user would use "${pkgs.nixos-grub-theme}/the/font.pf2"
as a value in that instance.
Or am I missing something?
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 theme specifies the font, we're just loading it
See ${nixos-grub2-theme}/theme.txt
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.
Right, I see what I did there.
It's been such a long time I don't remember all that :|
I figure then that this find
is appropriate, given that AFAICT from superficial searches there is no recursive glob. That's the perl way to do it.
50427eb
to
46a42bd
Compare
46a42bd
to
6a2c8e6
Compare
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.
Looks okay, though not big on perl, I don't see problems.
Though obviously, approval only once the discussion about the "hacky" function resolved.
# Load theme fonts | ||
"; | ||
|
||
find( { wanted => sub { # TODO: recursive glob for *.pf2 in theme, rewrite path from $theme/(.*) to $1 |
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 wanted function takes no arguments but rather does its work through a collection of variables.
`$File::Find::dir` is the current directory name, `$_` is the current filename within that directory `$File::Find::name` is the complete pathname to the file.
https://perldoc.perl.org/File/Find.html#The-wanted-function
I believe you should be able to replace $_
with $File::Find::name
to fix the issue with files in subfolders.
# Load theme fonts | ||
"; | ||
|
||
find( { wanted => sub { # TODO: recursive glob for *.pf2 in theme, rewrite path from $theme/(.*) to $1 |
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.
Alternatively, could we instead leave it to the user to set EDIT: nofont
separately from theme
?
It's not like it's a self-contained theme system anyway, which is why we have this hack.
Having distinct options allows more customization in the end. The user would use "${pkgs.nixos-grub-theme}/the/font.pf2"
as a value in that instance.
Or am I missing something?
898d008
to
03d817a
Compare
03d817a
to
6382a15
Compare
merge? |
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.
Co-authored-by: Eelco Dolstra <edolstra@gmail.com> Co-authored-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
5d4ba4b
to
a7a0d79
Compare
Thank you very much! |
Motivation for this change
Added theme option for grub
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)