From 27683fd6b812d8527488bb102477879779f4b38d Mon Sep 17 00:00:00 2001 From: seth Date: Tue, 18 Apr 2023 20:01:16 -0400 Subject: [PATCH] style: format with nixpkgs-fmt --- modules/home-manager/alacritty.nix | 16 +++++++----- modules/home-manager/bottom.nix | 13 ++++----- modules/home-manager/btop.nix | 16 +++++++----- modules/home-manager/default.nix | 42 ++++++++++++++++-------------- modules/home-manager/gtk.nix | 25 +++++++++--------- modules/home-manager/helix.nix | 13 ++++----- modules/home-manager/polybar.nix | 13 ++++----- modules/home-manager/tmux.nix | 3 ++- modules/lib/default.nix | 3 ++- modules/nixos/default.nix | 19 ++++++++------ modules/nixos/grub.nix | 6 +++-- 11 files changed, 94 insertions(+), 75 deletions(-) diff --git a/modules/home-manager/alacritty.nix b/modules/home-manager/alacritty.nix index 89bcb2e..19dbdc8 100644 --- a/modules/home-manager/alacritty.nix +++ b/modules/home-manager/alacritty.nix @@ -8,12 +8,14 @@ in { with lib; with pkgs; let - file = fetchFromGitHub { - owner = "catppuccin"; - repo = "alacritty"; - rev = "3c808cbb4f9c87be43ba5241bc57373c793d2f17"; - sha256 = "sha256-w9XVtEe7TqzxxGUCDUR9BFkzLZjG8XrplXJ3lX6f+x0="; - } + "/catppuccin-${cfg.flavour}.yml"; + file = fetchFromGitHub + { + owner = "catppuccin"; + repo = "alacritty"; + rev = "3c808cbb4f9c87be43ba5241bc57373c793d2f17"; + sha256 = "sha256-w9XVtEe7TqzxxGUCDUR9BFkzLZjG8XrplXJ3lX6f+x0="; + } + "/catppuccin-${cfg.flavour}.yml"; - in mkIf cfg.enable (ctp.fromYaml pkgs file); + in + mkIf cfg.enable (ctp.fromYaml pkgs file); } diff --git a/modules/home-manager/bottom.nix b/modules/home-manager/bottom.nix index bd110f1..e098f56 100644 --- a/modules/home-manager/bottom.nix +++ b/modules/home-manager/bottom.nix @@ -7,10 +7,11 @@ in { config.programs.bottom.settings = with builtins; with lib; with pkgs; - mkIf cfg.enable (fromTOML (readFile (fetchFromGitHub { - owner = "catppuccin"; - repo = "bottom"; - rev = "c0efe9025f62f618a407999d89b04a231ba99c92"; - sha256 = "sha256-VaHX2I/Gn82wJWzybpWNqU3dPi3206xItOlt0iF6VVQ="; - } + "/themes/${cfg.flavour}.toml"))); + mkIf cfg.enable (fromTOML (readFile (fetchFromGitHub + { + owner = "catppuccin"; + repo = "bottom"; + rev = "c0efe9025f62f618a407999d89b04a231ba99c92"; + sha256 = "sha256-VaHX2I/Gn82wJWzybpWNqU3dPi3206xItOlt0iF6VVQ="; + } + "/themes/${cfg.flavour}.toml"))); } diff --git a/modules/home-manager/btop.nix b/modules/home-manager/btop.nix index 919c5d9..db43092 100644 --- a/modules/home-manager/btop.nix +++ b/modules/home-manager/btop.nix @@ -2,13 +2,15 @@ let cfg = config.programs.btop.catppuccin; themePath = "/themes/catppuccin_${cfg.flavour}.theme"; - theme = pkgs.fetchFromGitHub { - owner = "catppuccin"; - repo = "btop"; - rev = "7109eac2884e9ca1dae431c0d7b8bc2a7ce54e54"; - sha256 = "sha256-QoPPx4AzxJMYo/prqmWD/CM7e5vn/ueyx+XQ5+YfHF8="; - } + themePath; -in { + theme = pkgs.fetchFromGitHub + { + owner = "catppuccin"; + repo = "btop"; + rev = "7109eac2884e9ca1dae431c0d7b8bc2a7ce54e54"; + sha256 = "sha256-QoPPx4AzxJMYo/prqmWD/CM7e5vn/ueyx+XQ5+YfHF8="; + } + themePath; +in +{ options.programs.btop.catppuccin = lib.ctp.mkCatppuccinOpt "btop" config; diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index db38602..3999379 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -1,22 +1,26 @@ -{ config, pkgs, lib, ... }: let - extendedLib = import ../lib/mkExtLib.nix lib; -in { - imports = let - files = [ - ./alacritty.nix - ./bat.nix - ./bottom.nix - ./btop.nix - ./kitty.nix - ./starship.nix - ./helix.nix - ./gtk.nix - ./neovim.nix - ./polybar.nix - ./sway.nix - ./tmux.nix - ]; - in extendedLib.ctp.mapModules config pkgs extendedLib files; +{ config, pkgs, lib, ... }: +let + extendedLib = import ../lib/mkExtLib.nix lib; +in +{ + imports = + let + files = [ + ./alacritty.nix + ./bat.nix + ./bottom.nix + ./btop.nix + ./kitty.nix + ./starship.nix + ./helix.nix + ./gtk.nix + ./neovim.nix + ./polybar.nix + ./sway.nix + ./tmux.nix + ]; + in + extendedLib.ctp.mapModules config pkgs extendedLib files; options.catppuccin = with extendedLib; { flavour = mkOption { diff --git a/modules/home-manager/gtk.nix b/modules/home-manager/gtk.nix index d4c5c7f..e697da3 100644 --- a/modules/home-manager/gtk.nix +++ b/modules/home-manager/gtk.nix @@ -3,18 +3,18 @@ let cfg = config.gtk.catppuccin; in { options.gtk.catppuccin = with lib; ctp.mkCatppuccinOpt "gtk" config // { - accent = ctp.mkAccentOpt "gtk" config; - size = mkOption { - type = types.enum [ "standard" "compact" ]; - default = "standard"; - description = "Catppuccin size variant for gtk"; + accent = ctp.mkAccentOpt "gtk" config; + size = mkOption { + type = types.enum [ "standard" "compact" ]; + default = "standard"; + description = "Catppuccin size variant for gtk"; + }; + tweaks = mkOption { + type = types.listOf (types.enum [ "black" "rimless" "normal" ]); + default = [ "normal" ]; + description = "Catppuccin tweaks for gtk"; + }; }; - tweaks = mkOption { - type = types.listOf (types.enum [ "black" "rimless" "normal" ]); - default = [ "normal" ]; - description = "Catppuccin tweaks for gtk"; - }; - }; config.gtk.theme = with builtins; with lib; @@ -26,7 +26,8 @@ in { # use the light gtk theme for latte gtkTheme = if cfg.flavour == "latte" then "Light" else "Dark"; - in mkIf cfg.enable { + in + mkIf cfg.enable { name = "Catppuccin-${flavourUpper}-${sizeUpper}-${accentUpper}-${gtkTheme}"; package = pkgs.catppuccin-gtk.override { diff --git a/modules/home-manager/helix.nix b/modules/home-manager/helix.nix index 2ba8c05..7c9ae91 100644 --- a/modules/home-manager/helix.nix +++ b/modules/home-manager/helix.nix @@ -15,11 +15,12 @@ in { theme = "catppuccin-${cfg.flavour}"; editor.color-modes = mkDefault true; }; - themes."catppuccin-${cfg.flavour}" = fromTOML (readFile (fetchFromGitHub { - owner = "catppuccin"; - repo = "helix"; - rev = "5677c16dc95297a804caea9161072ff174018fdd"; - sha256 = "sha256-aa8KZ7/1TXcBqaV/TYOZ8rpusOf5QeQ9i2Upnncbziw="; - } + "/themes/${subdir}/catppuccin_${cfg.flavour}.toml")); + themes."catppuccin-${cfg.flavour}" = fromTOML (readFile (fetchFromGitHub + { + owner = "catppuccin"; + repo = "helix"; + rev = "5677c16dc95297a804caea9161072ff174018fdd"; + sha256 = "sha256-aa8KZ7/1TXcBqaV/TYOZ8rpusOf5QeQ9i2Upnncbziw="; + } + "/themes/${subdir}/catppuccin_${cfg.flavour}.toml")); }; } diff --git a/modules/home-manager/polybar.nix b/modules/home-manager/polybar.nix index f8d8a9a..f0f8b09 100644 --- a/modules/home-manager/polybar.nix +++ b/modules/home-manager/polybar.nix @@ -7,10 +7,11 @@ in { config.services.polybar.extraConfig = with builtins; with lib; with pkgs; - mkIf cfg.enable (readFile (fetchFromGitHub { - owner = "catppuccin"; - repo = "polybar"; - rev = "9ee66f83335404186ce979bac32fcf3cd047396a"; - sha256 = "sha256-bUbSgMg/sa2faeEUZo80GNmhOX3wn2jLzfA9neF8ERA="; - } + "/themes/${cfg.flavour}.ini")); + mkIf cfg.enable (readFile (fetchFromGitHub + { + owner = "catppuccin"; + repo = "polybar"; + rev = "9ee66f83335404186ce979bac32fcf3cd047396a"; + sha256 = "sha256-bUbSgMg/sa2faeEUZo80GNmhOX3wn2jLzfA9neF8ERA="; + } + "/themes/${cfg.flavour}.ini")); } diff --git a/modules/home-manager/tmux.nix b/modules/home-manager/tmux.nix index c87b549..2d2a0df 100644 --- a/modules/home-manager/tmux.nix +++ b/modules/home-manager/tmux.nix @@ -15,7 +15,8 @@ let sha256 = "sha256-bXEsxt4ozl3cAzV3ZyvbPsnmy0RAdpLxHwN82gvjLdU="; }; }; -in { +in +{ options.programs.tmux.catppuccin = lib.ctp.mkCatppuccinOpt "tmux" config; diff --git a/modules/lib/default.nix b/modules/lib/default.nix index aefe19d..542d1e4 100644 --- a/modules/lib/default.nix +++ b/modules/lib/default.nix @@ -17,7 +17,8 @@ with lib; rec { json = with pkgs; runCommand "converted.json" { } '' ${yj}/bin/yj < ${file} > $out ''; - in fromJSON (readFile json); + in + fromJSON (readFile json); # a -> a -> [path] -> [path] # this imports a list of paths while inheriting diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 2a7f126..884f888 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,11 +1,14 @@ -{ config, pkgs, lib, ... }: let - extendedLib = import ../lib/mkExtLib.nix lib; -in { - imports = let - files = [ - ./grub.nix - ]; - in +{ config, pkgs, lib, ... }: +let + extendedLib = import ../lib/mkExtLib.nix lib; +in +{ + imports = + let + files = [ + ./grub.nix + ]; + in extendedLib.ctp.mapModules config pkgs extendedLib files; diff --git a/modules/nixos/grub.nix b/modules/nixos/grub.nix index 30ce971..77ecfc8 100644 --- a/modules/nixos/grub.nix +++ b/modules/nixos/grub.nix @@ -10,11 +10,13 @@ let rev = "803c5df0e83aba61668777bb96d90ab8f6847106"; sha256 = "sha256-/bSolCta8GCZ4lP0u5NVqYQ9Y3ZooYCNdTwORNvR7M0="; }; - in runCommand "catppuccin-grub-theme" { } '' + in + runCommand "catppuccin-grub-theme" { } '' mkdir -p "$out" cp -r ${src}/src/catppuccin-${cfg.flavour}-grub-theme/* "$out"/ ''; -in { +in +{ options.boot.loader.grub.catppuccin = lib.ctp.mkCatppuccinOpt "grub" config;