# Boot theme follows ../../theme.nix: Rosé Pine Dawn or Gruvpine dark. # Stylix only owns GRUB and the console; desktop palettes are hand-tuned. { inputs, ... }: let theme = import ../_palette.nix; mkGrubTheme = pkgs: let themeText = builtins.replaceStrings [ "@BASE@" "@TEXT@" "@FOAM@" "@SUBTLE@" "@GOLD@" ] [ theme.palette.base theme.palette.text theme.palette.foam theme.palette.subtle theme.palette.gold ] (builtins.readFile ./_grub/theme.txt); template = pkgs.writeText "nixdaemon-grub-theme.txt" themeText; in pkgs.runCommand "nixdaemon-grub-theme" { nativeBuildInputs = [ pkgs.librsvg pkgs.grub2 ]; } '' mkdir -p "$out" cp ${template} "$out/theme.txt" rsvg-convert -w 80 -h 80 ${../../assets/nixos-gruvpine.svg} -o "$out/nixos.png" for size in 20 24 40; do grub-mkfont -s "$size" -n "NixDaemon Mono" \ -o "$out/mono-$size.pf2" ${pkgs.dejavu_fonts}/share/fonts/truetype/DejaVuSansMono.ttf done tile() { printf '' "$2" > tile.svg rsvg-convert tile.svg -o "$out/$1.png" } for part in c n s e w nw ne sw se; do if [ "$part" = c ]; then tile "menu_$part" '${theme.palette.surface}' tile "selection_$part" '${theme.palette.overlay}' else tile "menu_$part" '${theme.palette.hlMed}' tile "selection_$part" '${theme.palette.foam}' fi done ''; in { perSystem = { pkgs, ... }: { packages.grub-theme = mkGrubTheme pkgs; }; flake.nixosModules.theme = { pkgs, lib, ... }: { imports = [ inputs.stylix.nixosModules.stylix ]; boot.loader.grub.theme = lib.mkForce (mkGrubTheme pkgs); stylix = { enable = true; autoEnable = false; homeManagerIntegration.autoImport = false; base16Scheme = if theme.name != "rose-pine" then theme.base16 else "${pkgs.base16-schemes}/share/themes/rose-pine-dawn.yaml"; polarity = if theme.name != "rose-pine" then "dark" else "light"; # GRUB renders these (converted to .pf2); applications is its font size, # sized up for the 2560x1440 panel GRUB draws at natively. fonts = { sansSerif = { package = pkgs.noto-fonts; name = "Noto Sans"; }; monospace = { package = pkgs.noto-fonts; name = "Noto Sans Mono"; }; sizes.applications = 24; }; targets.grub.enable = true; # themed background and selection bar targets.console.enable = true; # the VT palette tuigreet uses }; } ; }