1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
{ lib
, stdenv
, fetchFromGitLab
, writeText
, substituteAll
, meson
, pkg-config
, ninja
, docbook-xsl-nons
, gettext
, libxslt
, gtk3
, libdrm
, libevdev
, libpng
, libxkbcommon
, pango
, systemd
, xorg
, fontconfig
}:
stdenv.mkDerivation (finalAttrs: {
pname = "plymouth";
version = "24.004.60";
outputs = [ "out" "dev" ];
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "plymouth";
repo = "plymouth";
rev = finalAttrs.version;
hash = "sha256-9JmZCm8bjteJTQrMSJeL4x2CAI6RpKowFUDSCcMS4MM=";
};
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
# fix FHS hardcoded paths
(substituteAll {
src = ./fix-paths.patch;
fcmatch = "${fontconfig}/bin/fc-match";
})
];
strictDeps = true;
nativeBuildInputs = [
meson
pkg-config
ninja
docbook-xsl-nons
gettext
libxslt
];
buildInputs = [
gtk3
libdrm
libevdev
libpng
libxkbcommon
pango
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 = ''
substituteInPlace meson.build \
--replace "run_command(['scripts/generate-version.sh'], check: true).stdout().strip()" "'${finalAttrs.version}'"
# prevent installing unused non-$out dirs to DESTDIR
sed -i '/^install_emptydir/d' src/meson.build
'';
postInstall = ''
# Move stuff from DESTDIR to proper location.
cp -a "$DESTDIR/etc" "$out"
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; {
homepage = "https://www.freedesktop.org/wiki/Software/Plymouth/";
description = "Boot splash and boot logger";
license = licenses.gpl2Plus;
maintainers = [ maintainers.goibhniu ] ++ teams.gnome.members;
platforms = platforms.linux;
};
})
|