Add polymouth

This commit is contained in:
ItsDrike 2024-04-12 23:28:50 +02:00
parent 5514ffb24d
commit 97680bd24e
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0
5 changed files with 62 additions and 0 deletions

View file

@ -47,6 +47,13 @@
boot = {
secure-boot.enable = true;
tmpOnTmpfs = true;
# Boot splash screen
plymouth = {
enable = true;
withThemes = true; # enable adi1090x/plymouth-themes
selectedTheme = "colorful_loop";
};
};
};

View file

@ -5,6 +5,7 @@
in {
imports = [
./secure-boot.nix
./plymouth.nix
];
options.myOptions.system.boot = {

View file

@ -0,0 +1,25 @@
{ lib, ... }: with lib; let
inherit (lib) mkEnableOption mkOption types;
in
{
options.myOptions.system.boot.plymouth = {
enable = mkEnableOption ''Plymouth boot splash.'';
withThemes = mkEnableOption ''
Whether or not themes from https://github.com/adi1090x/plymouth-themes
should be enabled and configured.
'';
selectedTheme = mkOption {
type = types.str;
default = "bgrt";
description = ''
Choose which theme to use.
If you have `myOptions.system.boot.plymouth.withThemes` enabled, you can use more themes from the
https://github.com/adi1090x/plymouth-themes project. You can find the the available theme names at
https://github.com/NixOS/nixpkgs/blob/master/pkgs/data/themes/adi1090x-plymouth-themes/shas.nix.
'';
};
};
}

View file

@ -4,5 +4,6 @@ _: {
./generic.nix
./secure-boot.nix
./initrd.nix
./plymouth.nix
];
}

28
system/boot/plymouth.nix Normal file
View file

@ -0,0 +1,28 @@
{ config, lib, pkgs, ...}: let
inherit (lib) mkIf;
cfg = config.myOptions.system.boot.plymouth;
in {
config = mkIf cfg.enable {
boot.plymouth = {
enable = true;
theme = cfg.selectedTheme;
}
// lib.optionalAttrs cfg.withThemes {
themePackages = [
(pkgs.adi1090x-plymouth-themes.override {
selected_themes = [ cfg.selectedTheme ];
})
];
};
# Make polymouth work with sleep
powerManagement = {
powerDownCommands = ''
${pkgs.plymouth} --show-splash
'';
resumeCommands = ''
${pkgs.plymouth} --quit
'';
};
};
}