feat(nixos): add support for grub

This commit is contained in:
seth 2023-04-16 16:11:09 -04:00 committed by Sam Nystrom
parent 8f930092e5
commit 8b7aa60e3f
2 changed files with 36 additions and 0 deletions

View file

@ -1,4 +1,8 @@
{ lib, ... }: {
imports = [
./grub.nix
];
options.catppuccin = {
flavour = lib.mkOption {
type = lib.types.enum [ "latte" "frappe" "macchiato" "mocha" ];

32
modules/nixos/grub.nix Normal file
View file

@ -0,0 +1,32 @@
{ config, pkgs, lib, ... }:
let
cfg = config.boot.loader.grub.catppuccin;
theme = with pkgs;
let
src = fetchFromGitHub {
owner = "catppuccin";
repo = "grub";
rev = "803c5df0e83aba61668777bb96d90ab8f6847106";
sha256 = "sha256-/bSolCta8GCZ4lP0u5NVqYQ9Y3ZooYCNdTwORNvR7M0=";
};
in runCommand "catppuccin-grub-theme" { } ''
mkdir -p "$out"
cp -r ${src}/src/catppuccin-${cfg.flavour}-grub-theme/* "$out"/
'';
in {
options.boot.loader.grub.catppuccin = with lib; {
enable = mkEnableOption "Catppuccin theme";
flavour = mkOption {
type = types.enum [ "latte" "frappe" "macchiato" "mocha" ];
default = config.catppuccin.flavour;
description = "Catppuccin flavour for grub";
};
};
config.boot.loader.grub = with lib; mkIf cfg.enable {
font = "${theme}/font.pf2";
splashImage = "${theme}/background.png";
inherit theme;
};
}