Files
Nomarchy/themes/engine/plymouth.nix
Bernardo Magri f34f59c2aa
Some checks failed
Check / eval-and-lint (push) Has been cancelled
fix: drop mkDefault on three more list options it was silently dropping
Same footgun as the home.packages fix, found by sweeping the tree for
`mkDefault` on list options that other modules contribute to at normal
priority (so filterOverrides discards the mkDefault def entirely):

  * themes/engine/sddm.nix — environment.systemPackages = mkDefault
    [ nomarchy-sddm-theme ] was dropped, so the SDDM greeter theme package
    was never installed (unthemed login).
  * themes/engine/plymouth.nix — boot.kernelParams = mkDefault [ quiet
    splash loglevel=3 … ] was dropped, so boots weren't quiet/clean.
  * features/desktop/waybar/default.nix — home.packages = mkDefault
    [ font-awesome ] was dropped, so waybar's icon font was missing.

Verified via eval: nomarchy-sddm-theme now in systemPackages, "quiet" in
kernelParams, font-awesome in home.packages. Left the genuinely-safe
single-definition mkDefaults alone (plymouth.themePackages,
resolved.fallbackDns, hyprsunset.extraArgs) and the hybridGPU videoDrivers
mkDefault (it outranks nixpkgs' mkOptionDefault on real hardware).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 13:59:46 +01:00

78 lines
2.9 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{ config, pkgs, lib, ... }:
let
nomarchyLib = import ../../lib { inherit lib; };
palette = nomarchyLib.getPalette config.nomarchy.system.theme;
# Plymouth's Window.SetBackgroundTopColor takes three floats in 0.01.0;
# the .plymouth metadata's ConsoleLogBackgroundColor takes a 0xRRGGBB
# hex. Compute both from palette.base00 so the boot splash matches the
# rest of the active theme instead of staying frozen on the hardcoded
# Tokyo-Night-ish #1a1b26 it used to ship with.
hex = palette.base00;
rByte = lib.fromHexString (lib.substring 0 2 hex);
gByte = lib.fromHexString (lib.substring 2 2 hex);
bByte = lib.fromHexString (lib.substring 4 2 hex);
# byte → "0.XXX" decimal string. Nix has no floating-point math, so
# multiply first, integer-divide, then format. Plymouth tolerates more
# decimals than this (0.1019 etc.) but three digits matches the visual
# precision Plymouth renders at and keeps the substitution readable.
byteToFloat = n:
let
thousandths = (n * 1000) / 255;
s = toString thousandths;
padded =
if lib.stringLength s == 1 then "00${s}"
else if lib.stringLength s == 2 then "0${s}"
else s;
in "0.${padded}";
bgR = byteToFloat rByte;
bgG = byteToFloat gByte;
bgB = byteToFloat bByte;
nomarchy-plymouth = pkgs.stdenv.mkDerivation {
pname = "nomarchy-plymouth";
version = "1.0";
src = ./plymouth;
installPhase = ''
mkdir -p $out/share/plymouth/themes/nomarchy
cp * $out/share/plymouth/themes/nomarchy/
# Fix path in the plymouth file to point to the nix store
sed -i "s|/[a-z]*/share/plymouth/themes/nomarchy|$out/share/plymouth/themes/nomarchy|g" \
$out/share/plymouth/themes/nomarchy/nomarchy.plymouth
# Substitute the active theme's base00 in both the .script (RGB
# floats for the Window.SetBackground* calls) and the .plymouth
# metadata (0xRRGGBB for ConsoleLogBackgroundColor).
sed -i \
-e 's|@BG_R@|${bgR}|g' \
-e 's|@BG_G@|${bgG}|g' \
-e 's|@BG_B@|${bgB}|g' \
$out/share/plymouth/themes/nomarchy/nomarchy.script
sed -i 's|@BG_HEX@|${hex}|g' \
$out/share/plymouth/themes/nomarchy/nomarchy.plymouth
'';
};
in
{
boot.initrd.systemd.enable = lib.mkDefault true;
boot.initrd.verbose = lib.mkDefault false;
console.earlySetup = lib.mkDefault true;
boot.consoleLogLevel = lib.mkDefault 0;
boot.plymouth = {
enable = lib.mkDefault true;
themePackages = lib.mkDefault [ nomarchy-plymouth ];
theme = lib.mkDefault "nomarchy";
};
# Not mkDefault: kernelParams is a list nixpkgs and other modules add to at
# normal priority, so a mkDefault def is dropped — losing the quiet/splash
# boot. These params merge with (don't replace) the rest.
boot.kernelParams = [ "quiet" "splash" "loglevel=3" "rd.systemd.show_status=false" "rd.udev.log_level=3" "udev.log_priority=3" "boot.shell_on_fail" ];
}