summary refs log tree commit diff
path: root/nixos/modules/system/boot/plymouth.nix
diff options
context:
space:
mode:
authorAnders Kaseorg <andersk@mit.edu>2020-09-28 06:29:27 -0700
committerAnders Kaseorg <andersk@mit.edu>2021-02-21 10:27:15 -0800
commit9d21f1dfabe0d9be680c1b923c42155f482df30d (patch)
treeb0d233dd9efeb2e41dda4e286d18db7c50e864f5 /nixos/modules/system/boot/plymouth.nix
parentdaaa0e33505082716beb52efefe3064f0332b521 (diff)
downloadnixpkgs-9d21f1dfabe0d9be680c1b923c42155f482df30d.tar
nixpkgs-9d21f1dfabe0d9be680c1b923c42155f482df30d.tar.gz
nixpkgs-9d21f1dfabe0d9be680c1b923c42155f482df30d.tar.bz2
nixpkgs-9d21f1dfabe0d9be680c1b923c42155f482df30d.tar.lz
nixpkgs-9d21f1dfabe0d9be680c1b923c42155f482df30d.tar.xz
nixpkgs-9d21f1dfabe0d9be680c1b923c42155f482df30d.tar.zst
nixpkgs-9d21f1dfabe0d9be680c1b923c42155f482df30d.zip
nixos/plymouth: Add label plugin and a font to the initrd
This allows Plymouth to show the “NixOS 21.03” label under the logo at
startup like it already does at shutdown.

Fixes #59992.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Diffstat (limited to 'nixos/modules/system/boot/plymouth.nix')
-rw-r--r--nixos/modules/system/boot/plymouth.nix22
1 files changed, 21 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/plymouth.nix b/nixos/modules/system/boot/plymouth.nix
index 55e5b07ed61..d6d3f7a3b44 100644
--- a/nixos/modules/system/boot/plymouth.nix
+++ b/nixos/modules/system/boot/plymouth.nix
@@ -38,6 +38,14 @@ in
 
       enable = mkEnableOption "Plymouth boot splash screen";
 
+      font = mkOption {
+        default = "${pkgs.dejavu_fonts.minimal}/share/fonts/truetype/DejaVuSans.ttf";
+        type = types.path;
+        description = ''
+          Font file made available for displaying text on the splash screen.
+        '';
+      };
+
       themePackages = mkOption {
         default = [ nixosBreezePlymouth ];
         type = types.listOf types.package;
@@ -113,7 +121,7 @@ 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,$moduleName}.so $out/lib/plymouth
       cp ${plymouth}/lib/plymouth/renderers/{drm,frame-buffer}.so $out/lib/plymouth/renderers
 
       mkdir -p $out/share/plymouth/themes
@@ -133,6 +141,17 @@ in
 
       cp -r themes/* $out/share/plymouth/themes
       cp ${cfg.logo} $out/share/plymouth/logo.png
+
+      mkdir -p $out/share/fonts
+      cp ${cfg.font} $out/share/fonts
+      mkdir -p $out/etc/fonts
+      cat > $out/etc/fonts/fonts.conf <<EOF
+      <?xml version="1.0"?>
+      <!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
+      <fontconfig>
+          <dir>$out/share/fonts</dir>
+      </fontconfig>
+      EOF
     '';
 
     boot.initrd.extraUtilsCommandsTest = ''
@@ -154,6 +173,7 @@ 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/etc/fonts /etc/fonts
 
       plymouthd --mode=boot --pid-file=/run/plymouth/pid --attach-to-session
       plymouth show-splash