mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 22:36:23 +01:00
45 lines
1.2 KiB
Nix
45 lines
1.2 KiB
Nix
|
{stdenv, splashutils, backgrounds}:
|
||
|
|
||
|
rec {
|
||
|
name = "tty-backgrounds";
|
||
|
|
||
|
unpackTheme = theme: stdenv.mkDerivation {
|
||
|
name = "theme";
|
||
|
builder = ./unpack-theme.sh;
|
||
|
inherit theme;
|
||
|
};
|
||
|
|
||
|
themesUnpacked = stdenv.mkDerivation {
|
||
|
name = "splash-themes";
|
||
|
builder = ./tty-backgrounds-combine.sh;
|
||
|
# !!! Should use XML here.
|
||
|
ttys = map (x: x.tty) backgrounds;
|
||
|
themes = map (x: if x ? theme then (unpackTheme x.theme) else "default") backgrounds;
|
||
|
};
|
||
|
|
||
|
job = "
|
||
|
start on hardware-scan
|
||
|
|
||
|
script
|
||
|
|
||
|
rm -f /etc/splash
|
||
|
ln -s ${themesUnpacked} /etc/splash
|
||
|
|
||
|
# Critical: tell the kernel where to find splash_helper. It calls
|
||
|
# this program every time we switch between consoles.
|
||
|
echo ${splashutils}/bin/splash_helper > /proc/sys/kernel/fbsplash
|
||
|
|
||
|
# Set the theme for each console, as determined by
|
||
|
# tty-backgrounds-combine.sh above.
|
||
|
for tty in ${toString (map (x: x.tty) backgrounds)}; do
|
||
|
theme=$(readlink ${themesUnpacked}/$tty)
|
||
|
${splashutils}/bin/splash_util --tty $tty -c setcfg -t $theme || true
|
||
|
${splashutils}/bin/splash_util --tty $tty -c setpic -t $theme || true
|
||
|
${splashutils}/bin/splash_util --tty $tty -c on || true
|
||
|
done
|
||
|
|
||
|
end script
|
||
|
";
|
||
|
|
||
|
}
|