Skip to content

Commit

Permalink
nixos/modules/plymouth: add font option
Browse files Browse the repository at this point in the history
In order to utilize the label-ft plugin, we need a font
  • Loading branch information
eadwu committed Aug 11, 2020
1 parent 100ea05 commit 0209b8b
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion nixos/modules/system/boot/plymouth.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ in
'';
};

font = mkOption {
default = "${pkgs.dejavu_fonts.minimal}/share/fonts/truetype/DejaVuSans.ttf";
type = types.path;
description = ''
Splash font label
'';
};

theme = mkOption {
default = "breeze";
type = types.str;
Expand Down Expand Up @@ -113,9 +121,13 @@ in
mkdir -p $out/lib/plymouth/renderers
# module might come from a theme
cp ${themesEnv}/lib/plymouth/{text,details,$moduleName}.so $out/lib/plymouth
cp ${themesEnv}/lib/plymouth/{text,details,label-ft,$moduleName}.so $out/lib/plymouth
cp ${plymouth}/lib/plymouth/renderers/{drm,frame-buffer}.so $out/lib/plymouth/renderers
# copy font
mkdir -p $out/share/plymouth
cp ${cfg.font} $out/share/plymouth/label.ttf
mkdir -p $out/share/plymouth/themes
cp ${plymouth}/share/plymouth/plymouthd.defaults $out/share/plymouth
Expand Down Expand Up @@ -154,13 +166,17 @@ in
ln -s $extraUtils/share/plymouth/logo.png /etc/plymouth/logo.png
ln -s $extraUtils/share/plymouth/themes /etc/plymouth/themes
ln -s $extraUtils/lib/plymouth /etc/plymouth/plugins
ln -s $extraUtils/share/plymouth/label.ttf /etc/plymouth/label.ttf
plymouthd --mode=boot --pid-file=/run/plymouth/pid --attach-to-session
plymouth show-splash
'';

boot.initrd.postMountCommands = ''
plymouth update-root-fs --new-root-dir="$targetRoot"
# not needed anymore
rm /etc/plymouth/label.ttf
'';

# `mkBefore` to ensure that any custom prompts would be visible.
Expand Down

0 comments on commit 0209b8b

Please sign in to comment.