diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index e97d594..ebc4712 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,4 +1,8 @@ { lib, ... }: { + imports = [ + ./grub.nix + ]; + options.catppuccin = { flavour = lib.mkOption { type = lib.types.enum [ "latte" "frappe" "macchiato" "mocha" ]; diff --git a/modules/nixos/grub.nix b/modules/nixos/grub.nix new file mode 100644 index 0000000..4cddf90 --- /dev/null +++ b/modules/nixos/grub.nix @@ -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; + }; +}