Merge pull request #114000 from worldofpeace/plymouth-bgrt
nixos/plymouth: use bgrt theme
This commit is contained in:
commit
583f1a96b1
|
@ -4,8 +4,7 @@ with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
inherit (pkgs) plymouth;
|
inherit (pkgs) plymouth nixos-icons;
|
||||||
inherit (pkgs) nixos-icons;
|
|
||||||
|
|
||||||
cfg = config.boot.plymouth;
|
cfg = config.boot.plymouth;
|
||||||
|
|
||||||
|
@ -16,14 +15,37 @@ let
|
||||||
osVersion = config.system.nixos.release;
|
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 {
|
themesEnv = pkgs.buildEnv {
|
||||||
name = "plymouth-themes";
|
name = "plymouth-themes";
|
||||||
paths = [ plymouth ] ++ cfg.themePackages;
|
paths = [
|
||||||
|
plymouth
|
||||||
|
plymouthLogos
|
||||||
|
] ++ cfg.themePackages;
|
||||||
};
|
};
|
||||||
|
|
||||||
configFile = pkgs.writeText "plymouthd.conf" ''
|
configFile = pkgs.writeText "plymouthd.conf" ''
|
||||||
[Daemon]
|
[Daemon]
|
||||||
ShowDelay=0
|
ShowDelay=0
|
||||||
|
DeviceTimeout=8
|
||||||
Theme=${cfg.theme}
|
Theme=${cfg.theme}
|
||||||
${cfg.extraConfig}
|
${cfg.extraConfig}
|
||||||
'';
|
'';
|
||||||
|
@ -47,7 +69,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
themePackages = mkOption {
|
themePackages = mkOption {
|
||||||
default = [ nixosBreezePlymouth ];
|
default = lib.optional (cfg.theme == "breeze") nixosBreezePlymouth;
|
||||||
type = types.listOf types.package;
|
type = types.listOf types.package;
|
||||||
description = ''
|
description = ''
|
||||||
Extra theme packages for plymouth.
|
Extra theme packages for plymouth.
|
||||||
|
@ -55,7 +77,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
theme = mkOption {
|
theme = mkOption {
|
||||||
default = "breeze";
|
default = "bgrt";
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = ''
|
description = ''
|
||||||
Splash screen theme.
|
Splash screen theme.
|
||||||
|
@ -64,7 +86,8 @@ in
|
||||||
|
|
||||||
logo = mkOption {
|
logo = mkOption {
|
||||||
type = types.path;
|
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 {
|
defaultText = ''pkgs.fetchurl {
|
||||||
url = "https://nixos.org/logo/nixos-hires.png";
|
url = "https://nixos.org/logo/nixos-hires.png";
|
||||||
sha256 = "1ivzgd7iz0i06y36p8m5w48fd8pjqwxhdaavc0pxs7w1g7mcy5si";
|
sha256 = "1ivzgd7iz0i06y36p8m5w48fd8pjqwxhdaavc0pxs7w1g7mcy5si";
|
||||||
|
@ -110,12 +133,18 @@ in
|
||||||
systemd.services.plymouth-poweroff.wantedBy = [ "poweroff.target" ];
|
systemd.services.plymouth-poweroff.wantedBy = [ "poweroff.target" ];
|
||||||
systemd.services.plymouth-reboot.wantedBy = [ "reboot.target" ];
|
systemd.services.plymouth-reboot.wantedBy = [ "reboot.target" ];
|
||||||
systemd.services.plymouth-read-write.wantedBy = [ "sysinit.target" ];
|
systemd.services.plymouth-read-write.wantedBy = [ "sysinit.target" ];
|
||||||
systemd.services.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"];
|
systemd.paths.systemd-ask-password-plymouth.wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
boot.initrd.extraUtilsCommands = ''
|
boot.initrd.extraUtilsCommands = ''
|
||||||
copy_bin_and_libs ${pkgs.plymouth}/bin/plymouthd
|
copy_bin_and_libs ${plymouth}/bin/plymouth
|
||||||
copy_bin_and_libs ${pkgs.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)"
|
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
|
mkdir -p $out/share/plymouth/themes
|
||||||
cp ${plymouth}/share/plymouth/plymouthd.defaults $out/share/plymouth
|
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
|
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
|
chmod -R +w themes
|
||||||
find themes -type f | while read file
|
find themes -type f | while read file
|
||||||
do
|
do
|
||||||
sed -i "s,/nix/.*/share/plymouth/themes,$out/share/plymouth/themes,g" $file
|
sed -i "s,/nix/.*/share/plymouth/themes,$out/share/plymouth/themes,g" $file
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Install themes
|
||||||
cp -r themes/* $out/share/plymouth/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
|
mkdir -p $out/share/fonts
|
||||||
cp ${cfg.font} $out/share/fonts
|
cp ${cfg.font} $out/share/fonts
|
||||||
mkdir -p $out/etc/fonts
|
mkdir -p $out/etc/fonts
|
||||||
|
|
|
@ -1,64 +1,111 @@
|
||||||
{ stdenv, fetchurl, autoreconfHook, pkg-config, libxslt, docbook_xsl
|
{ lib
|
||||||
, gtk3, udev, systemd, lib
|
, stdenv
|
||||||
|
, fetchpatch
|
||||||
|
, fetchFromGitLab
|
||||||
|
, pkg-config
|
||||||
|
, autoreconfHook
|
||||||
|
, libxslt
|
||||||
|
, docbook-xsl-nons
|
||||||
|
, gettext
|
||||||
|
, gtk3
|
||||||
|
, systemd
|
||||||
|
, pango
|
||||||
|
, cairo
|
||||||
|
, libdrm
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "plymouth";
|
pname = "plymouth-unstable";
|
||||||
version = "0.9.4";
|
version = "2020-12-07";
|
||||||
|
|
||||||
src = fetchurl {
|
outputs = [
|
||||||
url = "https://www.freedesktop.org/software/plymouth/releases/${pname}-${version}.tar.xz";
|
"out"
|
||||||
sha256 = "0l8kg7b2vfxgz9gnrn0v2w4jvysj2cirp0nxads5sy05397pl6aa";
|
"dev"
|
||||||
|
];
|
||||||
|
|
||||||
|
src = fetchFromGitLab {
|
||||||
|
domain = "gitlab.freedesktop.org";
|
||||||
|
owner = "plymouth";
|
||||||
|
repo = "plymouth";
|
||||||
|
rev = "c4ced2a2d70edea7fbb95274aa1d01d95928df1b";
|
||||||
|
sha256 = "7CPuKMA0fTt8DBsaA4Td74kHT/O7PW8N3awP04nUnOI=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
autoreconfHook pkg-config libxslt docbook_xsl
|
autoreconfHook
|
||||||
|
docbook-xsl-nons
|
||||||
|
gettext
|
||||||
|
libxslt
|
||||||
|
pkg-config
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
gtk3 udev systemd
|
cairo
|
||||||
|
gtk3
|
||||||
|
libdrm
|
||||||
|
pango
|
||||||
|
systemd
|
||||||
|
];
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
# KillMode=none is deprecated
|
||||||
|
# https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/123
|
||||||
|
(fetchpatch {
|
||||||
|
url = "https://gitlab.freedesktop.org/plymouth/plymouth/-/commit/b406b0895a95949db2adfedaeda451f36f2b51c3.patch";
|
||||||
|
sha256 = "/UBImNuFO0G/oxlttjGIXon8YXMXlc9XU8uVuR9QuxY=";
|
||||||
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
sed -i \
|
sed -i \
|
||||||
-e "s#\$(\$PKG_CONFIG --variable=systemdsystemunitdir systemd)#$out/etc/systemd/system#g" \
|
|
||||||
-e "s#plymouthplugindir=.*#plymouthplugindir=/etc/plymouth/plugins/#" \
|
-e "s#plymouthplugindir=.*#plymouthplugindir=/etc/plymouth/plugins/#" \
|
||||||
-e "s#plymouththemedir=.*#plymouththemedir=/etc/plymouth/themes#" \
|
-e "s#plymouththemedir=.*#plymouththemedir=/etc/plymouth/themes#" \
|
||||||
-e "s#plymouthpolicydir=.*#plymouthpolicydir=/etc/plymouth/#" \
|
-e "s#plymouthpolicydir=.*#plymouthpolicydir=/etc/plymouth/#" \
|
||||||
|
-e "s#plymouthconfdir=.*#plymouthconfdir=/etc/plymouth/#" \
|
||||||
configure.ac
|
configure.ac
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
configurePlatforms = [ "host" ];
|
||||||
|
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
"--sysconfdir=/etc"
|
"--enable-documentation"
|
||||||
"--with-systemdunitdir=${placeholder "out"}/etc/systemd/system"
|
"--enable-drm"
|
||||||
"--localstatedir=/var"
|
|
||||||
"--with-logo=/etc/plymouth/logo.png"
|
|
||||||
"--with-background-color=0x000000"
|
|
||||||
"--with-background-start-color-stop=0x000000"
|
|
||||||
"--with-background-end-color-stop=0x000000"
|
|
||||||
"--with-release-file=/etc/os-release"
|
|
||||||
"--without-system-root-install"
|
|
||||||
"--without-rhgb-compat-link"
|
|
||||||
"--enable-tracing"
|
|
||||||
"--enable-systemd-integration"
|
|
||||||
"--enable-pango"
|
|
||||||
"--enable-gdm-transition"
|
|
||||||
"--enable-gtk"
|
"--enable-gtk"
|
||||||
|
"--enable-pango"
|
||||||
|
"--enable-systemd-integration"
|
||||||
|
"--enable-tracing"
|
||||||
|
"--localstatedir=/var"
|
||||||
|
"--sysconfdir=/etc"
|
||||||
|
"--with-background-color=0x000000"
|
||||||
|
"--with-background-end-color-stop=0x000000"
|
||||||
|
"--with-background-start-color-stop=0x000000"
|
||||||
|
"--with-logo=/etc/plymouth/logo.png"
|
||||||
|
"--with-release-file=/etc/os-release"
|
||||||
|
"--with-runtimedir=/run"
|
||||||
|
"--with-systemdunitdir=${placeholder "out"}/etc/systemd/system"
|
||||||
|
"--without-rhgb-compat-link"
|
||||||
|
"--without-system-root-install"
|
||||||
"ac_cv_path_SYSTEMD_ASK_PASSWORD_AGENT=${lib.getBin systemd}/bin/systemd-tty-ask-password-agent"
|
"ac_cv_path_SYSTEMD_ASK_PASSWORD_AGENT=${lib.getBin systemd}/bin/systemd-tty-ask-password-agent"
|
||||||
];
|
];
|
||||||
|
|
||||||
configurePlatforms = [ "host" ];
|
|
||||||
|
|
||||||
installFlags = [
|
installFlags = [
|
||||||
"plymouthd_defaultsdir=$(out)/share/plymouth"
|
"localstatedir=\${TMPDIR}"
|
||||||
"plymouthd_confdir=$(out)/etc/plymouth"
|
"plymouthd_confdir=${placeholder "out"}/etc/plymouth"
|
||||||
|
"plymouthd_defaultsdir=${placeholder "out"}/share/plymouth"
|
||||||
|
"sysconfdir=${placeholder "out"}/etc"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
# Makes a symlink to /usr/share/pixmaps/system-logo-white.png
|
||||||
|
# We'll handle it in the nixos module.
|
||||||
|
rm $out/share/plymouth/themes/spinfinity/header-image.png
|
||||||
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
homepage = "http://www.freedesktop.org/wiki/Software/Plymouth";
|
homepage = "https://www.freedesktop.org/wiki/Software/Plymouth/";
|
||||||
description = "A graphical boot animation";
|
description = "Boot splash and boot logger";
|
||||||
license = licenses.gpl2;
|
license = licenses.gpl2Plus;
|
||||||
maintainers = [ maintainers.goibhniu ];
|
maintainers = [ maintainers.goibhniu teams.gnome.members ];
|
||||||
platforms = platforms.linux;
|
platforms = platforms.linux;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue