Merge pull request #237908 from lilyinstarlight/upd/plymouth-2023-06-05

plymouth: unstable-2021-10-18 -> unstable-2023-06-05
This commit is contained in:
Will Fancher 2023-07-08 16:57:31 -04:00 committed by GitHub
commit 0b25b4c7c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 189 additions and 73 deletions

View File

@ -98,7 +98,8 @@ in
type = types.path; type = types.path;
# Dimensions are 48x48 to match GDM logo # Dimensions are 48x48 to match GDM logo
default = "${nixos-icons}/share/icons/hicolor/48x48/apps/nix-snowflake-white.png"; default = "${nixos-icons}/share/icons/hicolor/48x48/apps/nix-snowflake-white.png";
defaultText = literalExpression ''pkgs.fetchurl { defaultText = literalExpression ''"''${nixos-icons}/share/icons/hicolor/48x48/apps/nix-snowflake-white.png"'';
example = literalExpression ''pkgs.fetchurl {
url = "https://nixos.org/logo/nixos-hires.png"; url = "https://nixos.org/logo/nixos-hires.png";
sha256 = "1ivzgd7iz0i06y36p8m5w48fd8pjqwxhdaavc0pxs7w1g7mcy5si"; sha256 = "1ivzgd7iz0i06y36p8m5w48fd8pjqwxhdaavc0pxs7w1g7mcy5si";
}''; }'';
@ -134,6 +135,13 @@ in
# XXX: Needed because we supply a different set of plugins in initrd. # XXX: Needed because we supply a different set of plugins in initrd.
environment.etc."plymouth/plugins".source = "${plymouth}/lib/plymouth"; environment.etc."plymouth/plugins".source = "${plymouth}/lib/plymouth";
systemd.tmpfiles.rules = [
"d /run/plymouth 0755 root root 0 -"
"L+ /run/plymouth/plymouthd.defaults - - - - /etc/plymouth/plymouthd.defaults"
"L+ /run/plymouth/themes - - - - /etc/plymouth/themes"
"L+ /run/plymouth/plugins - - - - /etc/plymouth/plugins"
];
systemd.packages = [ plymouth ]; systemd.packages = [ plymouth ];
systemd.services.plymouth-kexec.wantedBy = [ "kexec.target" ]; systemd.services.plymouth-kexec.wantedBy = [ "kexec.target" ];
@ -160,8 +168,8 @@ in
contents = { contents = {
# Files # Files
"/etc/plymouth/plymouthd.conf".source = configFile; "/etc/plymouth/plymouthd.conf".source = configFile;
"/etc/plymouth/plymouthd.defaults".source = "${plymouth}/share/plymouth/plymouthd.defaults";
"/etc/plymouth/logo.png".source = cfg.logo; "/etc/plymouth/logo.png".source = cfg.logo;
"/etc/plymouth/plymouthd.defaults".source = "${plymouth}/share/plymouth/plymouthd.defaults";
# Directories # Directories
"/etc/plymouth/plugins".source = pkgs.runCommand "plymouth-initrd-plugins" {} '' "/etc/plymouth/plugins".source = pkgs.runCommand "plymouth-initrd-plugins" {} ''
# Check if the actual requested theme is here # Check if the actual requested theme is here
@ -174,8 +182,8 @@ in
mkdir -p $out/renderers mkdir -p $out/renderers
# module might come from a theme # module might come from a theme
cp ${themesEnv}/lib/plymouth/{text,details,label,$moduleName}.so $out cp ${themesEnv}/lib/plymouth/*.so $out
cp ${plymouth}/lib/plymouth/renderers/{drm,frame-buffer}.so $out/renderers cp ${plymouth}/lib/plymouth/renderers/*.so $out/renderers
''; '';
"/etc/plymouth/themes".source = pkgs.runCommand "plymouth-initrd-themes" {} '' "/etc/plymouth/themes".source = pkgs.runCommand "plymouth-initrd-themes" {} ''
# Check if the actual requested theme is here # Check if the actual requested theme is here
@ -184,19 +192,24 @@ in
exit 1 exit 1
fi fi
mkdir $out mkdir -p $out/${cfg.theme}
cp -r ${themesEnv}/share/plymouth/themes/${cfg.theme} $out cp -r ${themesEnv}/share/plymouth/themes/${cfg.theme}/* $out/${cfg.theme}
# Copy more themes if the theme depends on others # Copy more themes if the theme depends on others
for theme in $(grep -hRo '/etc/plymouth/themes/.*$' $out | xargs -n1 basename); do for theme in $(grep -hRo '/share/plymouth/themes/.*$' $out | xargs -n1 basename); do
if [[ -d "${themesEnv}/share/plymouth/themes/$theme" ]]; then if [[ -d "${themesEnv}/share/plymouth/themes/$theme" ]]; then
if [[ ! -d "$out/$theme" ]]; then if [[ ! -d "$out/$theme" ]]; then
echo "Adding dependent theme: $theme" echo "Adding dependent theme: $theme"
cp -r "${themesEnv}/share/plymouth/themes/$theme" $out mkdir -p "$out/$theme"
cp -r "${themesEnv}/share/plymouth/themes/$theme"/* "$out/$theme"
fi fi
else else
echo "Missing theme dependency: $theme" echo "Missing theme dependency: $theme"
fi fi
done done
# Fixup references
for theme in $out/*/*.plymouth; do
sed -i "s,${builtins.storeDir}/.*/share/plymouth/themes,$out," "$theme"
done
''; '';
# Fonts # Fonts
@ -225,6 +238,11 @@ in
plymouth-switch-root-initramfs.wantedBy = [ "halt.target" "kexec.target" "plymouth-switch-root-initramfs.service" "poweroff.target" "reboot.target" ]; plymouth-switch-root-initramfs.wantedBy = [ "halt.target" "kexec.target" "plymouth-switch-root-initramfs.service" "poweroff.target" "reboot.target" ];
plymouth-switch-root.wantedBy = [ "initrd-switch-root.target" ]; plymouth-switch-root.wantedBy = [ "initrd-switch-root.target" ];
}; };
# Link in runtime files before starting
services.plymouth-start.preStart = ''
mkdir -p /run/plymouth
ln -sf /etc/plymouth/{plymouthd.defaults,themes,plugins} /run/plymouth/
'';
}; };
# Insert required udev rules. We take stage 2 systemd because the udev # Insert required udev rules. We take stage 2 systemd because the udev
@ -249,8 +267,8 @@ in
mkdir -p $out/lib/plymouth/renderers mkdir -p $out/lib/plymouth/renderers
# module might come from a theme # module might come from a theme
cp ${themesEnv}/lib/plymouth/{text,details,label,$moduleName}.so $out/lib/plymouth cp ${themesEnv}/lib/plymouth/*.so $out/lib/plymouth
cp ${plymouth}/lib/plymouth/renderers/{drm,frame-buffer}.so $out/lib/plymouth/renderers cp ${plymouth}/lib/plymouth/renderers/*.so $out/lib/plymouth/renderers
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
@ -267,7 +285,7 @@ in
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,${builtins.storeDir}/.*/share/plymouth/themes,$out/share/plymouth/themes,g" $file
done done
# Install themes # Install themes
@ -275,7 +293,7 @@ in
# Install logo # Install logo
mkdir -p $out/etc/plymouth mkdir -p $out/etc/plymouth
cp -r -L ${themesEnv}/etc/plymouth $out cp -r -L ${themesEnv}/etc/plymouth $out/etc
# Setup font # Setup font
mkdir -p $out/share/fonts mkdir -p $out/share/fonts
@ -304,11 +322,11 @@ in
boot.initrd.preLVMCommands = mkIf (!config.boot.initrd.systemd.enable) (mkAfter '' boot.initrd.preLVMCommands = mkIf (!config.boot.initrd.systemd.enable) (mkAfter ''
mkdir -p /etc/plymouth mkdir -p /etc/plymouth
mkdir -p /run/plymouth mkdir -p /run/plymouth
ln -s $extraUtils/etc/plymouth/logo.png /etc/plymouth/logo.png
ln -s ${configFile} /etc/plymouth/plymouthd.conf ln -s ${configFile} /etc/plymouth/plymouthd.conf
ln -s $extraUtils/share/plymouth/plymouthd.defaults /etc/plymouth/plymouthd.defaults ln -s $extraUtils/share/plymouth/plymouthd.defaults /run/plymouth/plymouthd.defaults
ln -s $extraUtils/share/plymouth/logo.png /etc/plymouth/logo.png ln -s $extraUtils/share/plymouth/themes /run/plymouth/themes
ln -s $extraUtils/share/plymouth/themes /etc/plymouth/themes ln -s $extraUtils/lib/plymouth /run/plymouth/plugins
ln -s $extraUtils/lib/plymouth /etc/plymouth/plugins
ln -s $extraUtils/etc/fonts /etc/fonts ln -s $extraUtils/etc/fonts /etc/fonts
plymouthd --mode=boot --pid-file=/run/plymouth/pid --attach-to-session plymouthd --mode=boot --pid-file=/run/plymouth/pid --attach-to-session

View File

@ -0,0 +1,67 @@
diff --git a/meson.build b/meson.build
index 650ad189..1e1ebe1d 100644
--- a/meson.build
+++ b/meson.build
@@ -18,6 +18,11 @@ plymouth_time_dir = get_option('prefix') / get_option('localstatedir') / 'lib' /
plymouth_runtime_dir = get_option('runstatedir') / 'plymouth'
plymouth_runtime_theme_path = plymouth_runtime_dir / 'themes/'
+if get_option('runtime-plugins')
+ plymouth_runtime_plugin_path = plymouth_runtime_dir / 'plugins/'
+else
+ plymouth_runtime_plugin_path = plymouth_plugin_path
+endif
# Dependencies
cc = meson.get_compiler('c')
@@ -76,7 +81,7 @@ conf.set('PLY_ENABLE_TRACING', get_option('tracing'))
conf.set_quoted('PLYMOUTH_RUNTIME_DIR', plymouth_runtime_dir)
conf.set_quoted('PLYMOUTH_THEME_PATH', plymouth_theme_path)
conf.set_quoted('PLYMOUTH_RUNTIME_THEME_PATH', plymouth_runtime_theme_path)
-conf.set_quoted('PLYMOUTH_PLUGIN_PATH', plymouth_plugin_path)
+conf.set_quoted('PLYMOUTH_PLUGIN_PATH', plymouth_runtime_plugin_path)
conf.set_quoted('PLYMOUTH_POLICY_DIR', plymouth_policy_dir)
conf.set_quoted('PLYMOUTH_CONF_DIR', plymouth_conf_dir)
conf.set_quoted('PLYMOUTH_TIME_DIRECTORY', plymouth_time_dir)
diff --git a/meson_options.txt b/meson_options.txt
index 4f601bb0..61fccc12 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -28,6 +28,11 @@ option('runstatedir',
value: '/run',
description: 'runstatedir',
)
+option('runtime-plugins',
+ type: 'boolean',
+ value: false,
+ description: 'Use runstatedir for loading theme plugins',
+)
option('boot-tty',
type: 'string',
value: '/dev/tty1',
diff --git a/src/libply-splash-core/meson.build b/src/libply-splash-core/meson.build
index 69636b13..02bd5cbd 100644
--- a/src/libply-splash-core/meson.build
+++ b/src/libply-splash-core/meson.build
@@ -31,7 +31,7 @@ libply_splash_core_cflags = [
'-DPLYMOUTH_BACKGROUND_COLOR=@0@'.format(get_option('background-color')),
'-DPLYMOUTH_BACKGROUND_START_COLOR=@0@'.format(get_option('background-start-color-stop')),
'-DPLYMOUTH_BACKGROUND_END_COLOR=@0@'.format(get_option('background-end-color-stop')),
- '-DPLYMOUTH_PLUGIN_PATH="@0@"'.format(plymouth_plugin_path),
+ '-DPLYMOUTH_PLUGIN_PATH="@0@"'.format(plymouth_runtime_plugin_path),
]
libply_splash_core = library('ply-splash-core',
diff --git a/src/libply-splash-graphics/meson.build b/src/libply-splash-graphics/meson.build
index 32fad963..02b8440b 100644
--- a/src/libply-splash-graphics/meson.build
+++ b/src/libply-splash-graphics/meson.build
@@ -20,7 +20,7 @@ libply_splash_graphics_cflags = [
'-DPLYMOUTH_BACKGROUND_COLOR=@0@'.format(get_option('background-color')),
'-DPLYMOUTH_BACKGROUND_START_COLOR=@0@'.format(get_option('background-start-color-stop')),
'-DPLYMOUTH_BACKGROUND_END_COLOR=@0@'.format(get_option('background-end-color-stop')),
- '-DPLYMOUTH_PLUGIN_PATH="@0@"'.format(plymouth_plugin_path),
+ '-DPLYMOUTH_PLUGIN_PATH="@0@"'.format(plymouth_runtime_plugin_path),
]
libply_splash_graphics = library('ply-splash-graphics',

View File

@ -1,97 +1,115 @@
{ lib { lib
, stdenv , stdenv
, fetchpatch
, fetchFromGitLab , fetchFromGitLab
, writeText
, meson
, pkg-config , pkg-config
, autoreconfHook , ninja
, libxslt
, docbook-xsl-nons , docbook-xsl-nons
, gettext , gettext
, libxslt
, gtk3 , gtk3
, systemd
, pango
, cairo
, libdrm , libdrm
, libevdev
, libpng
, libxkbcommon
, pango
, systemd
, xorg
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation (finalAttrs: {
pname = "plymouth"; pname = "plymouth";
version = "unstable-2021-10-18"; version = "unstable-2023-06-05";
outputs = [ outputs = [ "out" "dev" ];
"out"
"dev"
];
src = fetchFromGitLab { src = fetchFromGitLab {
domain = "gitlab.freedesktop.org"; domain = "gitlab.freedesktop.org";
owner = "plymouth"; owner = "plymouth";
repo = "plymouth"; repo = "plymouth";
rev = "18363cd887dbfe7e82a2f4cc1a49ef9513919142"; rev = "a5eda165689864cc9a25ec14fd8c6da458598f42";
sha256 = "sha256-+AP4ALOFdYFt/8MDXjMaHptkogCwK1iXKuza1zfMaws="; hash = "sha256-TpMZZ0naC4D0Knmclc8JpmXPfnpM6q8YotIkNX+aRVo=";
}; };
patches = [
# do not create unnecessary symlink to non-existent header-image.png
./dont-create-broken-symlink.patch
# add support for loading plugins from /run to assist NixOS module
./add-runtime-plugin-path.patch
];
strictDeps = true;
nativeBuildInputs = [ nativeBuildInputs = [
autoreconfHook meson
pkg-config
ninja
docbook-xsl-nons docbook-xsl-nons
gettext gettext
libxslt libxslt
pkg-config
]; ];
buildInputs = [ buildInputs = [
cairo
gtk3 gtk3
libdrm libdrm
libevdev
libpng
libxkbcommon
pango pango
systemd systemd
xorg.xkeyboardconfig
];
mesonFlags = let
# https://gitlab.freedesktop.org/plymouth/plymouth/-/blob/a5eda165689864cc9a25ec14fd8c6da458598f42/meson.build#L47
crossFile = writeText "cross-file.conf" ''
[binaries]
systemd-tty-ask-password-agent = '${lib.getBin systemd}/bin/systemd-tty-ask-password-agent'
'';
in [
"--sysconfdir=/etc"
"--localstatedir=/var"
"-Dlogo=/etc/plymouth/logo.png"
"-Dbackground-color=0x000000"
"-Dbackground-start-color-stop=0x000000"
"-Dbackground-end-color-stop=0x000000"
"-Drelease-file=/etc/os-release"
"-Dudev=enabled"
"-Drunstatedir=/run"
"-Druntime-plugins=true"
"--cross-file=${crossFile}"
]; ];
postPatch = '' postPatch = ''
sed -i \ substituteInPlace meson.build \
-e "s#plymouthplugindir=.*#plymouthplugindir=/etc/plymouth/plugins/#" \ --replace "run_command(['scripts/generate-version.sh'], check: true).stdout().strip()" "'${finalAttrs.version}'"
-e "s#plymouththemedir=.*#plymouththemedir=/etc/plymouth/themes#" \
-e "s#plymouthpolicydir=.*#plymouthpolicydir=/etc/plymouth/#" \ # prevent installing unused non-$out dirs to DESTDIR
-e "s#plymouthconfdir=.*#plymouthconfdir=/etc/plymouth/#" \ sed -i '/^install_emptydir/d' src/meson.build
configure.ac
''; '';
configurePlatforms = [ "host" ];
configureFlags = [
"--enable-documentation"
"--enable-drm"
"--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"
];
installFlags = [
"localstatedir=\${TMPDIR}"
"plymouthd_confdir=${placeholder "out"}/etc/plymouth"
"plymouthd_defaultsdir=${placeholder "out"}/share/plymouth"
"sysconfdir=${placeholder "out"}/etc"
];
postInstall = '' postInstall = ''
# Makes a symlink to /usr/share/pixmaps/system-logo-white.png # Move stuff from DESTDIR to proper location.
# We'll handle it in the nixos module. cp -a "$DESTDIR/etc" "$out"
rm $out/share/plymouth/themes/spinfinity/header-image.png rm -r "$DESTDIR/etc"
for o in $(getAllOutputNames); do
if [[ "$o" = "debug" ]]; then continue; fi
cp -a "$DESTDIR/''${!o}" "$(dirname "''${!o}")"
rm -r "$DESTDIR/''${!o}"
done
# Ensure the DESTDIR is removed.
rmdir "$DESTDIR/${builtins.storeDir}" "$DESTDIR/${builtins.dirOf builtins.storeDir}" "$DESTDIR"
''; '';
# HACK: We want to install configuration files to $out/etc
# but Plymouth should read them from /etc on a NixOS system.
# With autotools, it was possible to override Make variables
# at install time but Meson does not support this
# so we need to convince it to install all files to a temporary
# location using DESTDIR and then move it to proper one in postInstall.
env.DESTDIR = "${placeholder "out"}/dest";
meta = with lib; { meta = with lib; {
homepage = "https://www.freedesktop.org/wiki/Software/Plymouth/"; homepage = "https://www.freedesktop.org/wiki/Software/Plymouth/";
description = "Boot splash and boot logger"; description = "Boot splash and boot logger";
@ -99,4 +117,4 @@ stdenv.mkDerivation rec {
maintainers = [ maintainers.goibhniu ] ++ teams.gnome.members; maintainers = [ maintainers.goibhniu ] ++ teams.gnome.members;
platforms = platforms.linux; platforms = platforms.linux;
}; };
} })

View File

@ -0,0 +1,13 @@
diff --git a/themes/spinfinity/meson.build b/themes/spinfinity/meson.build
index f48e8e55..5a2050c8 100644
--- a/themes/spinfinity/meson.build
+++ b/themes/spinfinity/meson.build
@@ -53,8 +53,3 @@ install_data(
'throbber-33.png',
install_dir: plymouth_theme_path / 'spinfinity',
)
-
-install_symlink('header-image.png',
- install_dir: plymouth_theme_path / 'spinfinity',
- pointing_to: plymouth_logo_file,
-)