···
cfg = config.boot.plymouth;
opt = options.boot.plymouth;
20
+
nixosBreezePlymouth = pkgs.kdePackages.breeze-plymouth.override {
21
+
logoFile = cfg.logo;
24
+
osVersion = config.system.nixos.release;
plymouthLogos = pkgs.runCommand "plymouth-logos" { inherit (cfg) logo; } ''
···
70
+
checkIfThemeExists = ''
71
+
# Check if the actual requested theme is here
72
+
if [[ ! -d ${themesEnv}/share/plymouth/themes/${cfg.theme} ]]; then
73
+
echo "The requested theme: ${cfg.theme} is not provided by any of the packages in boot.plymouth.themePackages"
74
+
echo "The following themes exist: $(ls ${themesEnv}/share/plymouth/themes/)"
···
themePackages = mkOption {
98
+
default = lib.optional (cfg.theme == "breeze") nixosBreezePlymouth;
99
+
defaultText = literalMD ''
100
+
A NixOS branded variant of the breeze theme when
101
+
`config.${opt.theme} == "breeze"`, otherwise
type = types.listOf types.package;
Extra theme packages for plymouth.
···
"/etc/plymouth/logo.png".source = cfg.logo;
"/etc/plymouth/plymouthd.defaults".source = "${plymouth}/share/plymouth/plymouthd.defaults";
179
-
"/etc/plymouth/plugins".source = pkgs.runCommand "plymouth-initrd-plugins" { } ''
180
-
# Check if the actual requested theme is here
181
-
if [[ ! -d ${themesEnv}/share/plymouth/themes/${cfg.theme} ]]; then
182
-
echo "The requested theme: ${cfg.theme} is not provided by any of the packages in boot.plymouth.themePackages"
199
+
"/etc/plymouth/plugins".source = pkgs.runCommand "plymouth-initrd-plugins" { } (
202
+
moduleName="$(sed -n 's,ModuleName *= *,,p' ${themesEnv}/share/plymouth/themes/${cfg.theme}/${cfg.theme}.plymouth)"
186
-
moduleName="$(sed -n 's,ModuleName *= *,,p' ${themesEnv}/share/plymouth/themes/${cfg.theme}/${cfg.theme}.plymouth)"
188
-
mkdir -p $out/renderers
189
-
# module might come from a theme
190
-
cp ${themesEnv}/lib/plymouth/*.so $out
191
-
cp ${plymouth}/lib/plymouth/renderers/*.so $out/renderers
192
-
# useless in the initrd, and adds several megabytes to the closure
193
-
rm $out/renderers/x11.so
195
-
"/etc/plymouth/themes".source = pkgs.runCommand "plymouth-initrd-themes" { } ''
196
-
# Check if the actual requested theme is here
197
-
if [[ ! -d ${themesEnv}/share/plymouth/themes/${cfg.theme} ]]; then
198
-
echo "The requested theme: ${cfg.theme} is not provided by any of the packages in boot.plymouth.themePackages"
202
-
mkdir -p $out/${cfg.theme}
203
-
cp -r ${themesEnv}/share/plymouth/themes/${cfg.theme}/* $out/${cfg.theme}
204
-
# Copy more themes if the theme depends on others
205
-
for theme in $(grep -hRo '/share/plymouth/themes/.*$' $out | xargs -n1 basename); do
206
-
if [[ -d "${themesEnv}/share/plymouth/themes/$theme" ]]; then
207
-
if [[ ! -d "$out/$theme" ]]; then
208
-
echo "Adding dependent theme: $theme"
209
-
mkdir -p "$out/$theme"
210
-
cp -r "${themesEnv}/share/plymouth/themes/$theme"/* "$out/$theme"
213
-
echo "Missing theme dependency: $theme"
217
-
for theme in $out/*/*.plymouth; do
218
-
sed -i "s,${builtins.storeDir}/.*/share/plymouth/themes,$out," "$theme"
204
+
mkdir -p $out/renderers
205
+
# module might come from a theme
206
+
cp ${themesEnv}/lib/plymouth/*.so $out
207
+
cp ${plymouth}/lib/plymouth/renderers/*.so $out/renderers
208
+
# useless in the initrd, and adds several megabytes to the closure
209
+
rm $out/renderers/x11.so
212
+
"/etc/plymouth/themes".source = pkgs.runCommand "plymouth-initrd-themes" { } (
215
+
mkdir -p $out/${cfg.theme}
216
+
cp -r ${themesEnv}/share/plymouth/themes/${cfg.theme}/* $out/${cfg.theme}
217
+
# Copy more themes if the theme depends on others
218
+
for theme in $(grep -hRo '/share/plymouth/themes/.*$' $out | xargs -n1 basename); do
219
+
if [[ -d "${themesEnv}/share/plymouth/themes/$theme" ]]; then
220
+
if [[ ! -d "$out/$theme" ]]; then
221
+
echo "Adding dependent theme: $theme"
222
+
mkdir -p "$out/$theme"
223
+
cp -r "${themesEnv}/share/plymouth/themes/$theme"/* "$out/$theme"
226
+
echo "Missing theme dependency: $theme"
230
+
for theme in $out/*/*.plymouth; do
231
+
sed -i "s,${builtins.storeDir}/.*/share/plymouth/themes,$out," "$theme"
"/etc/plymouth/fonts".source = pkgs.runCommand "plymouth-initrd-fonts" { } ''
···
274
-
boot.initrd.extraUtilsCommands = lib.mkIf (!config.boot.initrd.systemd.enable) ''
275
-
copy_bin_and_libs ${plymouth}/bin/plymouth
276
-
copy_bin_and_libs ${plymouth}/bin/plymouthd
288
+
boot.initrd.extraUtilsCommands = lib.mkIf (!config.boot.initrd.systemd.enable) (
290
+
copy_bin_and_libs ${plymouth}/bin/plymouth
291
+
copy_bin_and_libs ${plymouth}/bin/plymouthd
278
-
# Check if the actual requested theme is here
279
-
if [[ ! -d ${themesEnv}/share/plymouth/themes/${cfg.theme} ]]; then
280
-
echo "The requested theme: ${cfg.theme} is not provided by any of the packages in boot.plymouth.themePackages"
294
+
+ checkIfThemeExists
284
-
moduleName="$(sed -n 's,ModuleName *= *,,p' ${themesEnv}/share/plymouth/themes/${cfg.theme}/${cfg.theme}.plymouth)"
297
+
moduleName="$(sed -n 's,ModuleName *= *,,p' ${themesEnv}/share/plymouth/themes/${cfg.theme}/${cfg.theme}.plymouth)"
286
-
mkdir -p $out/lib/plymouth/renderers
287
-
# module might come from a theme
288
-
cp ${themesEnv}/lib/plymouth/*.so $out/lib/plymouth
289
-
cp ${plymouth}/lib/plymouth/renderers/*.so $out/lib/plymouth/renderers
290
-
# useless in the initrd, and adds several megabytes to the closure
291
-
rm $out/lib/plymouth/renderers/x11.so
299
+
mkdir -p $out/lib/plymouth/renderers
300
+
# module might come from a theme
301
+
cp ${themesEnv}/lib/plymouth/*.so $out/lib/plymouth
302
+
cp ${plymouth}/lib/plymouth/renderers/*.so $out/lib/plymouth/renderers
303
+
# useless in the initrd, and adds several megabytes to the closure
304
+
rm $out/lib/plymouth/renderers/x11.so
293
-
mkdir -p $out/share/plymouth/themes
294
-
cp ${plymouth}/share/plymouth/plymouthd.defaults $out/share/plymouth
306
+
mkdir -p $out/share/plymouth/themes
307
+
cp ${plymouth}/share/plymouth/plymouthd.defaults $out/share/plymouth
296
-
# Copy themes into working directory for patching
309
+
# Copy themes into working directory for patching
299
-
# Use -L to copy the directories proper, not the symlinks to them.
300
-
# Copy all themes because they're not large assets, and bgrt depends on the ImageDir of
301
-
# the spinner theme.
302
-
cp -r -L ${themesEnv}/share/plymouth/themes/* themes
312
+
# Use -L to copy the directories proper, not the symlinks to them.
313
+
# Copy all themes because they're not large assets, and bgrt depends on the ImageDir of
314
+
# the spinner theme.
315
+
cp -r -L ${themesEnv}/share/plymouth/themes/* themes
304
-
# Patch out any attempted references to the theme or plymouth's themes directory
306
-
find themes -type f | while read file
308
-
sed -i "s,${builtins.storeDir}/.*/share/plymouth/themes,$out/share/plymouth/themes,g" $file
317
+
# Patch out any attempted references to the theme or plymouth's themes directory
319
+
find themes -type f | while read file
321
+
sed -i "s,${builtins.storeDir}/.*/share/plymouth/themes,$out/share/plymouth/themes,g" $file
312
-
cp -r themes/* $out/share/plymouth/themes
325
+
cp -r themes/* $out/share/plymouth/themes
315
-
mkdir -p $out/etc/plymouth
316
-
cp -r -L ${themesEnv}/etc/plymouth $out/etc
328
+
mkdir -p $out/etc/plymouth
329
+
cp -r -L ${themesEnv}/etc/plymouth $out/etc
319
-
mkdir -p $out/share/fonts
320
-
cp ${cfg.font} $out/share/fonts
321
-
mkdir -p $out/etc/fonts
322
-
cat > $out/etc/fonts/fonts.conf <<EOF
323
-
<?xml version="1.0"?>
324
-
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
326
-
<dir>$out/share/fonts</dir>
332
+
mkdir -p $out/share/fonts
333
+
cp ${cfg.font} $out/share/fonts
334
+
mkdir -p $out/etc/fonts
335
+
cat > $out/etc/fonts/fonts.conf <<EOF
336
+
<?xml version="1.0"?>
337
+
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
339
+
<dir>$out/share/fonts</dir>
boot.initrd.extraUtilsCommandsTest = mkIf (!config.boot.initrd.systemd.enable) ''
$out/bin/plymouthd --help >/dev/null