-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
nixos/plymouth: use bgrt theme #114000
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
nixos/plymouth: use bgrt theme #114000
Changes from all commits
f4208fe
dd88056
726dd98
6bd4f9a
9e84dc0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,8 +4,7 @@ with lib; | |
|
|
||
| let | ||
|
|
||
| inherit (pkgs) plymouth; | ||
| inherit (pkgs) nixos-icons; | ||
| inherit (pkgs) plymouth nixos-icons; | ||
|
|
||
| cfg = config.boot.plymouth; | ||
|
|
||
|
|
@@ -16,14 +15,37 @@ let | |
| osVersion = config.system.nixos.release; | ||
| }; | ||
|
|
||
| plymouthLogos = pkgs.runCommand "plymouth-logos" { inherit (cfg) logo; } '' | ||
| mkdir -p $out | ||
|
|
||
| # For themes that are compiled with PLYMOUTH_LOGO_FILE | ||
| mkdir -p $out/etc/plymouth | ||
| ln -s $logo $out/etc/plymouth/logo.png | ||
|
|
||
| # Logo for bgrt theme | ||
| # Note this is technically an abuse of watermark for the bgrt theme | ||
| # See: https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/95#note_813768 | ||
| mkdir -p $out/share/plymouth/themes/spinner | ||
| ln -s $logo $out/share/plymouth/themes/spinner/watermark.png | ||
|
|
||
| # Logo for spinfinity theme | ||
| # See: https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/106 | ||
| mkdir -p $out/share/plymouth/themes/spinfinity | ||
| ln -s $logo $out/share/plymouth/themes/spinfinity/header-image.png | ||
| ''; | ||
|
|
||
| themesEnv = pkgs.buildEnv { | ||
| name = "plymouth-themes"; | ||
| paths = [ plymouth ] ++ cfg.themePackages; | ||
| paths = [ | ||
| plymouth | ||
| plymouthLogos | ||
| ] ++ cfg.themePackages; | ||
| }; | ||
|
|
||
| configFile = pkgs.writeText "plymouthd.conf" '' | ||
| [Daemon] | ||
| ShowDelay=0 | ||
| DeviceTimeout=8 | ||
| Theme=${cfg.theme} | ||
| ${cfg.extraConfig} | ||
| ''; | ||
|
|
@@ -47,15 +69,15 @@ in | |
| }; | ||
|
|
||
| themePackages = mkOption { | ||
| default = [ nixosBreezePlymouth ]; | ||
| default = lib.optional (cfg.theme == "breeze") nixosBreezePlymouth; | ||
| type = types.listOf types.package; | ||
| description = '' | ||
| Extra theme packages for plymouth. | ||
| ''; | ||
| }; | ||
|
|
||
| theme = mkOption { | ||
| default = "breeze"; | ||
| default = "bgrt"; | ||
| type = types.str; | ||
| description = '' | ||
| Splash screen theme. | ||
|
|
@@ -64,7 +86,8 @@ in | |
|
|
||
| logo = mkOption { | ||
| type = types.path; | ||
| default = "${nixos-icons}/share/icons/hicolor/128x128/apps/nix-snowflake.png"; | ||
| # Dimensions are 48x48 to match GDM logo | ||
| default = "${nixos-icons}/share/icons/hicolor/48x48/apps/nix-snowflake-white.png"; | ||
| defaultText = ''pkgs.fetchurl { | ||
| url = "https://nixos.org/logo/nixos-hires.png"; | ||
| sha256 = "1ivzgd7iz0i06y36p8m5w48fd8pjqwxhdaavc0pxs7w1g7mcy5si"; | ||
|
|
@@ -110,12 +133,18 @@ in | |
| systemd.services.plymouth-poweroff.wantedBy = [ "poweroff.target" ]; | ||
| systemd.services.plymouth-reboot.wantedBy = [ "reboot.target" ]; | ||
| systemd.services.plymouth-read-write.wantedBy = [ "sysinit.target" ]; | ||
| systemd.services.systemd-ask-password-plymouth.wantedBy = ["multi-user.target"]; | ||
| systemd.paths.systemd-ask-password-plymouth.wantedBy = ["multi-user.target"]; | ||
| systemd.services.systemd-ask-password-plymouth.wantedBy = [ "multi-user.target" ]; | ||
| systemd.paths.systemd-ask-password-plymouth.wantedBy = [ "multi-user.target" ]; | ||
|
|
||
| boot.initrd.extraUtilsCommands = '' | ||
| copy_bin_and_libs ${pkgs.plymouth}/bin/plymouthd | ||
| copy_bin_and_libs ${pkgs.plymouth}/bin/plymouth | ||
| copy_bin_and_libs ${plymouth}/bin/plymouth | ||
| copy_bin_and_libs ${plymouth}/bin/plymouthd | ||
|
|
||
| # Check if the actual requested theme is here | ||
|
||
| if [[ ! -d ${themesEnv}/share/plymouth/themes/${cfg.theme} ]]; then | ||
| echo "The requested theme: ${cfg.theme} is not provided by any of the packages in boot.plymouth.themePackages" | ||
| exit 1 | ||
| fi | ||
|
|
||
| moduleName="$(sed -n 's,ModuleName *= *,,p' ${themesEnv}/share/plymouth/themes/${cfg.theme}/${cfg.theme}.plymouth)" | ||
|
|
||
|
|
@@ -127,21 +156,29 @@ in | |
| mkdir -p $out/share/plymouth/themes | ||
| cp ${plymouth}/share/plymouth/plymouthd.defaults $out/share/plymouth | ||
|
|
||
| # copy themes into working directory for patching | ||
| # Copy themes into working directory for patching | ||
| mkdir themes | ||
| # use -L to copy the directories proper, not the symlinks to them | ||
| cp -r -L ${themesEnv}/share/plymouth/themes/{text,details,${cfg.theme}} themes | ||
|
|
||
| # patch out any attempted references to the theme or plymouth's themes directory | ||
| # Use -L to copy the directories proper, not the symlinks to them. | ||
|
||
| # Copy all themes because they're not large assets, and bgrt depends on the ImageDir of | ||
| # the spinner theme. | ||
| cp -r -L ${themesEnv}/share/plymouth/themes/* themes | ||
|
|
||
| # Patch out any attempted references to the theme or plymouth's themes directory | ||
| chmod -R +w themes | ||
| find themes -type f | while read file | ||
| do | ||
| sed -i "s,/nix/.*/share/plymouth/themes,$out/share/plymouth/themes,g" $file | ||
| done | ||
|
|
||
| # Install themes | ||
| cp -r themes/* $out/share/plymouth/themes | ||
| cp ${cfg.logo} $out/share/plymouth/logo.png | ||
|
|
||
| # Install logo | ||
| mkdir -p $out/etc/plymouth | ||
| cp -r -L ${themesEnv}/etc/plymouth $out | ||
|
|
||
| # Setup font | ||
| mkdir -p $out/share/fonts | ||
| cp ${cfg.font} $out/share/fonts | ||
| mkdir -p $out/etc/fonts | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,64 +1,111 @@ | ||||||||||||
| { stdenv, fetchurl, autoreconfHook, pkg-config, libxslt, docbook_xsl | ||||||||||||
| , gtk3, udev, systemd, lib | ||||||||||||
| { lib | ||||||||||||
| , stdenv | ||||||||||||
| , fetchpatch | ||||||||||||
| , fetchFromGitLab | ||||||||||||
| , pkg-config | ||||||||||||
| , autoreconfHook | ||||||||||||
| , libxslt | ||||||||||||
| , docbook-xsl-nons | ||||||||||||
| , gettext | ||||||||||||
| , gtk3 | ||||||||||||
| , systemd | ||||||||||||
| , pango | ||||||||||||
| , cairo | ||||||||||||
| , libdrm | ||||||||||||
| }: | ||||||||||||
|
|
||||||||||||
| stdenv.mkDerivation rec { | ||||||||||||
| pname = "plymouth"; | ||||||||||||
| version = "0.9.4"; | ||||||||||||
| pname = "plymouth-unstable"; | ||||||||||||
| version = "2020-12-07"; | ||||||||||||
|
||||||||||||
|
|
||||||||||||
| src = fetchurl { | ||||||||||||
| url = "https://www.freedesktop.org/software/plymouth/releases/${pname}-${version}.tar.xz"; | ||||||||||||
| sha256 = "0l8kg7b2vfxgz9gnrn0v2w4jvysj2cirp0nxads5sy05397pl6aa"; | ||||||||||||
| outputs = [ | ||||||||||||
| "out" | ||||||||||||
| "dev" | ||||||||||||
| ]; | ||||||||||||
|
||||||||||||
| outputs = [ | |
| "out" | |
| "dev" | |
| ]; | |
| outputs = [ "out" "dev" ]; |
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.
Using Nix value directly is IMO clearer than passing it to environment as a middleman: