From b5309c13e77b881e70d958108908042dbadc684b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 22 Jan 2025 20:43:21 +0000 Subject: [PATCH] style: format 6c244e5 --- default.nix | 58 +-- dev/flake.nix | 64 +-- docs/mk-search.nix | 6 +- docs/mk-site.nix | 17 +- docs/package.nix | 106 ++-- flake.nix | 50 +- modules/global.nix | 31 +- modules/home-manager/aerc.nix | 9 +- modules/home-manager/alacritty.nix | 15 +- modules/home-manager/bat.nix | 9 +- modules/home-manager/bottom.nix | 12 +- modules/home-manager/btop.nix | 19 +- modules/home-manager/cava.nix | 45 +- modules/home-manager/chrome.nix | 20 +- modules/home-manager/cursors.nix | 46 +- modules/home-manager/default.nix | 4 +- modules/home-manager/delta.nix | 15 +- modules/home-manager/dunst.nix | 53 +- modules/home-manager/fcitx5.nix | 72 ++- modules/home-manager/fish.nix | 12 +- modules/home-manager/foot.nix | 9 +- modules/home-manager/freetube.nix | 66 +-- modules/home-manager/fuzzel.nix | 12 +- modules/home-manager/fzf.nix | 18 +- modules/home-manager/gh-dash.nix | 16 +- modules/home-manager/ghostty.nix | 13 +- modules/home-manager/gitui.nix | 12 +- modules/home-manager/glamour.nix | 12 +- modules/home-manager/gtk.nix | 270 ++++------ modules/home-manager/helix.nix | 45 +- modules/home-manager/hyprland.nix | 20 +- modules/home-manager/hyprlock.nix | 16 +- modules/home-manager/imv.nix | 12 +- modules/home-manager/k9s.nix | 82 ++- modules/home-manager/kitty.nix | 15 +- modules/home-manager/kvantum.nix | 88 ++-- modules/home-manager/lazygit.nix | 28 +- modules/home-manager/lsd.nix | 6 +- modules/home-manager/mako.nix | 26 +- modules/home-manager/micro.nix | 27 +- modules/home-manager/mpv.nix | 13 +- modules/home-manager/neovim.nix | 53 +- modules/home-manager/newsboat.nix | 12 +- modules/home-manager/obs.nix | 15 +- modules/home-manager/polybar.nix | 12 +- modules/home-manager/rio.nix | 9 +- modules/home-manager/rofi.nix | 9 +- modules/home-manager/skim.nix | 12 +- modules/home-manager/spotify-player.nix | 14 +- modules/home-manager/starship.nix | 12 +- modules/home-manager/sway.nix | 10 +- modules/home-manager/swaylock.nix | 40 +- modules/home-manager/tmux.nix | 86 ++-- modules/home-manager/tofi.nix | 13 +- modules/home-manager/waybar.nix | 91 ++-- modules/home-manager/wlogout.nix | 74 ++- modules/home-manager/yazi.nix | 9 +- modules/home-manager/zathura.nix | 12 +- modules/home-manager/zed-editor.nix | 33 +- modules/home-manager/zellij.nix | 18 +- .../home-manager/zsh-syntax-highlighting.nix | 8 +- modules/lib/default.nix | 474 ++++++++---------- modules/nixos/all-modules.nix | 8 +- modules/nixos/default.nix | 4 +- modules/nixos/fcitx5.nix | 22 +- modules/nixos/grub.nix | 19 +- modules/nixos/plymouth.nix | 21 +- modules/nixos/sddm.nix | 212 +++----- modules/nixos/tty.nix | 14 +- modules/tests/darwin.nix | 28 +- modules/tests/home.nix | 5 +- modules/tests/nixos.nix | 37 +- pkgs/buildCatppuccinPort/package.nix | 40 +- pkgs/catppuccinInstallHook/package.nix | 4 +- pkgs/catwalk/package.nix | 33 +- pkgs/cursors/package.nix | 14 +- pkgs/delta/package.nix | 5 +- pkgs/fetchCatppuccinPort/package.nix | 26 +- pkgs/gtk/package.nix | 39 +- pkgs/kvantum/package.nix | 9 +- pkgs/nvim/package.nix | 12 +- pkgs/palette/package.nix | 5 +- pkgs/plymouth/package.nix | 5 +- pkgs/sddm/package.nix | 51 +- pkgs/spotify-player/package.nix | 5 +- pkgs/tmux/package.nix | 12 +- pkgs/whiskers/package.nix | 11 +- pkgs/wlogout/package.nix | 5 +- shell.nix | 13 +- 89 files changed, 1132 insertions(+), 2012 deletions(-) diff --git a/default.nix b/default.nix index f76cb8ba..f5c11065 100644 --- a/default.nix +++ b/default.nix @@ -1,40 +1,31 @@ -{ - pkgs ? import { - inherit system; - config = { }; - overlays = [ ]; - }, - lib ? pkgs.lib, - system ? builtins.currentSystem, -}: +{ pkgs ? import { + inherit system; + config = { }; + overlays = [ ]; +}, lib ? pkgs.lib, system ? builtins.currentSystem, }: let - catppuccinPackages = - let - generated = lib.foldlAttrs ( - acc: port: - { rev, hash }: - lib.recursiveUpdate acc { - # Save our sources for each port - sources.${port} = catppuccinPackages.fetchCatppuccinPort { inherit port rev hash; }; + catppuccinPackages = let + generated = lib.foldlAttrs (acc: port: + { rev, hash }: + lib.recursiveUpdate acc { + # Save our sources for each port + sources.${port} = + catppuccinPackages.fetchCatppuccinPort { inherit port rev hash; }; - # And create a default package for them - "${port}" = catppuccinPackages.buildCatppuccinPort { pname = port; }; - } - ) { } (lib.importJSON ./pkgs/sources.json); + # And create a default package for them + "${port}" = catppuccinPackages.buildCatppuccinPort { pname = port; }; + }) { } (lib.importJSON ./pkgs/sources.json); - collected = lib.packagesFromDirectoryRecursive { - callPackage = lib.callPackageWith (pkgs // catppuccinPackages); - directory = ./pkgs; - }; - in - generated // collected; -in + collected = lib.packagesFromDirectoryRecursive { + callPackage = lib.callPackageWith (pkgs // catppuccinPackages); + directory = ./pkgs; + }; + in generated // collected; -{ +in { # Filter out derivations not available on/meant for the current system - packages = lib.filterAttrs (lib.const ( - deriv: + packages = lib.filterAttrs (lib.const (deriv: let # Only export packages available on the current system, *unless* they are being cross compiled availableOnHost = lib.meta.availableOn pkgs.stdenv.hostPlatform deriv; @@ -43,9 +34,8 @@ in isCross = deriv.stdenv.buildPlatform != deriv.stdenv.targetPlatform; # Make sure we don't remove our functions isFunction = lib.isFunction deriv; - in - isFunction || (!broken) && availableOnHost || isCross - )) catppuccinPackages; + in isFunction || (!broken) && availableOnHost || isCross)) + catppuccinPackages; shell = import ./shell.nix { inherit pkgs; }; } diff --git a/dev/flake.nix b/dev/flake.nix index 9c59b07c..90158d13 100644 --- a/dev/flake.nix +++ b/dev/flake.nix @@ -43,13 +43,7 @@ }; }; - outputs = - { - self, - nixpkgs, - catppuccin, - ... - }@inputs: + outputs = { self, nixpkgs, catppuccin, ... }@inputs: let inherit (nixpkgs) lib; @@ -63,10 +57,8 @@ "v1.2" = inputs.catppuccin-v1_2; "rolling" = catppuccin; }; - in - eachDefaultSystem ( - system: + in eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; @@ -76,48 +68,36 @@ callWith = pkgs: lib.flip pkgs.callPackage; callUnstable = callWith pkgs { inherit (inputs) home-manager; }; - callStable = callWith pkgsStable { home-manager = inputs.home-manager-stable; }; - in + callStable = + callWith pkgsStable { home-manager = inputs.home-manager-stable; }; - { - apps = { - serve = mkApp' self.packages.${system}.site.serve; - }; + in { + apps = { serve = mkApp' self.packages.${system}.site.serve; }; - checks = - { - darwin = { - test-unstable = callUnstable (catppuccin + "/modules/tests/darwin.nix"); - test-stable = callStable (catppuccin + "/modules/tests/darwin.nix"); - }; + checks = { + darwin = { + test-unstable = + callUnstable (catppuccin + "/modules/tests/darwin.nix"); + test-stable = callStable (catppuccin + "/modules/tests/darwin.nix"); + }; - linux = { - test-unstable = callUnstable (catppuccin + "/modules/tests/nixos.nix"); - test-stable = callStable (catppuccin + "/modules/tests/nixos.nix"); - }; - } - .${kernelName} or { }; + linux = { + test-unstable = + callUnstable (catppuccin + "/modules/tests/nixos.nix"); + test-stable = callStable (catppuccin + "/modules/tests/nixos.nix"); + }; + }.${kernelName} or { }; packages = { # Used in CI - all-ports = pkgs.linkFarm "all-ports" ( - lib.foldlAttrs ( - acc: name: pkg: - if pkg ? "outPath" then - acc - // { - ${name} = pkg.outPath; - } - else - acc - ) { } (lib.removeAttrs catppuccin.packages.${system} [ "default" ]) - ); + all-ports = pkgs.linkFarm "all-ports" (lib.foldlAttrs (acc: name: pkg: + if pkg ? "outPath" then acc // { ${name} = pkg.outPath; } else acc) + { } (lib.removeAttrs catppuccin.packages.${system} [ "default" ])); site = pkgs.callPackage (catppuccin + "/docs/package.nix") { inherit inputs searchVersions; nuscht-search = inputs.nuscht-search.packages.${system}; }; }; - } - ); + }); } diff --git a/docs/mk-search.nix b/docs/mk-search.nix index 0f97bad0..5eeec72c 100644 --- a/docs/mk-search.nix +++ b/docs/mk-search.nix @@ -3,10 +3,10 @@ { catppuccin, versionName }: let - urlPrefix = "https://github.com/catppuccin/nix/tree/${catppuccin.rev or "main"}/"; -in + urlPrefix = + "https://github.com/catppuccin/nix/tree/${catppuccin.rev or "main"}/"; -mkMultiSearch { +in mkMultiSearch { title = "catppuccin/nix Option Search"; baseHref = "/search/${versionName}/"; diff --git a/docs/mk-site.nix b/docs/mk-site.nix index 87a85181..d716cf50 100644 --- a/docs/mk-site.nix +++ b/docs/mk-site.nix @@ -1,17 +1,9 @@ -{ - lib, - stdenvNoCC, - mdbook, - python3, - writeShellApplication, -}: +{ lib, stdenvNoCC, mdbook, python3, writeShellApplication, }: args: -stdenvNoCC.mkDerivation ( - finalAttrs: - args - // { +stdenvNoCC.mkDerivation (finalAttrs: + args // { nativeBuildInputs = args.nativeBuildInputs or [ ] ++ [ mdbook ]; dontConfigure = true; @@ -40,5 +32,4 @@ stdenvNoCC.mkDerivation ( ''; }; }; - } -) + }) diff --git a/docs/package.nix b/docs/package.nix index dd5e6fbf..c79ed7e9 100644 --- a/docs/package.nix +++ b/docs/package.nix @@ -1,71 +1,57 @@ -{ - lib, - callPackage, - linkFarm, - writeText, +{ lib, callPackage, linkFarm, writeText, - nuscht-search, - inputs, - /* - Should be in the format of +nuscht-search, inputs, +/* Should be in the format of - ``` - { - = ; - } - ``` + ``` + { + = ; + } + ``` - i.e., + i.e., - ``` - { - "v1.1" = catppuccin_v1_1; - "rolling" = catppuccin; - } - */ - searchVersions ? null, -}: + ``` + { + "v1.1" = catppuccin_v1_1; + "rolling" = catppuccin; + } +*/ +searchVersions ? null, }: -assert lib.assertMsg ( - searchVersions != null -) "./docs/package.nix: `searchVersions` must be provided"; +assert lib.assertMsg (searchVersions != null) + "./docs/package.nix: `searchVersions` must be provided"; let inherit (inputs) catppuccin; mkSite = callPackage ./mk-site.nix { }; - mkSearchInstance = callPackage ./mk-search.nix { - inherit (nuscht-search) mkMultiSearch; - }; + mkSearchInstance = + callPackage ./mk-search.nix { inherit (nuscht-search) mkMultiSearch; }; # Collect the latest stable version from the `searchVersions` given - latestStableVersion = - let - latest = lib.foldl' ( - latest: versionName: - if (versionName != "rolling" && lib.versionOlder latest (lib.removePrefix "v" versionName)) then - versionName - else - latest - ) "0" (lib.attrNames searchVersions); - in - assert lib.assertMsg (latest != "0") "Unable to determine latest stable version!"; - latest; + latestStableVersion = let + latest = lib.foldl' (latest: versionName: + if (versionName != "rolling" + && lib.versionOlder latest (lib.removePrefix "v" versionName)) then + versionName + else + latest) "0" (lib.attrNames searchVersions); + in assert lib.assertMsg (latest != "0") + "Unable to determine latest stable version!"; + latest; # Then create a search instance for each one - searchInstances = lib.mapAttrs ( - versionName: catppuccin: mkSearchInstance { inherit catppuccin versionName; } - ) searchVersions; + searchInstances = lib.mapAttrs (versionName: catppuccin: + mkSearchInstance { inherit catppuccin versionName; }) searchVersions; # Create an html page for redirecting to a given endpoint - redirectTo = - endpoint: + redirectTo = endpoint: writeText "index.html" '' ''; -in -mkSite { +in mkSite { pname = "catppuccin-nix-site"; version = catppuccin.shortRev or catppuccin.dirtyShortRev or "unknown"; @@ -75,19 +61,17 @@ mkSite { postInstall = '' ln -sf ${ - linkFarm "search-engines" ( - [ - { - name = "stable.html"; - path = redirectTo "/search/${latestStableVersion}/"; - } - { - name = "index.html"; - path = redirectTo "/search/stable.html"; - } - ] - ++ lib.mapAttrsToList (name: path: { inherit name path; }) searchInstances - ) + linkFarm "search-engines" ([ + { + name = "stable.html"; + path = redirectTo "/search/${latestStableVersion}/"; + } + { + name = "index.html"; + path = redirectTo "/search/stable.html"; + } + ] ++ lib.mapAttrsToList (name: path: { inherit name path; }) + searchInstances) } $out/search ''; } diff --git a/flake.nix b/flake.nix index 6cfdf6f1..c5e441c7 100644 --- a/flake.nix +++ b/flake.nix @@ -1,12 +1,9 @@ { description = "Soothing pastel theme for Nix"; - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - }; + inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; }; - outputs = - { self, nixpkgs }: + outputs = { self, nixpkgs }: let inherit (nixpkgs) lib; @@ -16,50 +13,37 @@ # Systems for development related outputs # (that evaluate more exotic packages cleanly, unlike some systems above) - devSystems = [ - "x86_64-linux" - "aarch64-linux" - "x86_64-darwin" - "aarch64-darwin" - ]; + devSystems = + [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; forAllSystems = lib.genAttrs systems; forAllDevSystems = lib.genAttrs devSystems; - mkModule = - { - name ? "catppuccin", - type, - file, - }: - { pkgs, ... }: - { + mkModule = { name ? "catppuccin", type, file, }: + { pkgs, ... }: { _file = "${self.outPath}/flake.nix#${type}Modules.${name}"; imports = [ file ]; - catppuccin.sources = lib.mkDefault self.packages.${pkgs.stdenv.hostPlatform.system}; + catppuccin.sources = + lib.mkDefault self.packages.${pkgs.stdenv.hostPlatform.system}; }; - in - { - packages = forAllSystems ( - system: + in { + packages = forAllSystems (system: let pkgs = nixpkgs.legacyPackages.${system}; - catppuccinPackages = (import ./default.nix { inherit pkgs; }).packages; - in - catppuccinPackages - // { - default = catppuccinPackages.whiskers; - } - ); + catppuccinPackages = + (import ./default.nix { inherit pkgs; }).packages; + in catppuccinPackages // { default = catppuccinPackages.whiskers; }); devShells = forAllDevSystems (system: { - default = import ./shell.nix { pkgs = nixpkgs.legacyPackages.${system}; }; + default = + import ./shell.nix { pkgs = nixpkgs.legacyPackages.${system}; }; }); - formatter = forAllDevSystems (system: nixpkgs.legacyPackages.${system}.nixfmt); + formatter = + forAllDevSystems (system: nixpkgs.legacyPackages.${system}.nixfmt); homeManagerModules.catppuccin = mkModule { type = "homeManager"; diff --git a/modules/global.nix b/modules/global.nix index 6d72242d..6e8339d1 100644 --- a/modules/global.nix +++ b/modules/global.nix @@ -1,19 +1,10 @@ { catppuccinModules }: -{ - config, - lib, - pkgs, - ... -}: - -let - catppuccinLib = import ./lib { inherit config lib pkgs; }; -in - -{ - config = { - assertions = [ (catppuccinLib.assertMinimumVersion "24.11") ]; - }; +{ config, lib, pkgs, ... }: + +let catppuccinLib = import ./lib { inherit config lib pkgs; }; + +in { + config = { assertions = [ (catppuccinLib.assertMinimumVersion "24.11") ]; }; imports = catppuccinLib.applyToModules catppuccinModules; @@ -33,10 +24,8 @@ in }; sources = - let - defaultSources = (import ../default.nix { inherit pkgs; }).packages; - in - lib.mkOption { + let defaultSources = (import ../default.nix { inherit pkgs; }).packages; + in lib.mkOption { type = lib.types.lazyAttrsOf lib.types.raw; default = defaultSources; defaultText = "{ ... }"; @@ -52,7 +41,9 @@ in config = { nix.settings = lib.mkIf config.catppuccin.cache.enable { substituters = [ "https://catppuccin.cachix.org" ]; - trusted-public-keys = [ "catppuccin.cachix.org-1:noG/4HkbhJb+lUAdKrph6LaozJvAeEEZj4N732IysmU=" ]; + trusted-public-keys = [ + "catppuccin.cachix.org-1:noG/4HkbhJb+lUAdKrph6LaozJvAeEEZj4N732IysmU=" + ]; }; }; } diff --git a/modules/home-manager/aerc.nix b/modules/home-manager/aerc.nix index 83c11f0a..a426c159 100644 --- a/modules/home-manager/aerc.nix +++ b/modules/home-manager/aerc.nix @@ -5,17 +5,12 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.aerc; themeName = "catppuccin-${cfg.flavor}"; -in -{ +in { options.catppuccin.aerc = catppuccinLib.mkCatppuccinOption { name = "aerc"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "aerc" - "catppuccin" - ]; + from = [ "programs" "aerc" "catppuccin" ]; to = "aerc"; }; diff --git a/modules/home-manager/alacritty.nix b/modules/home-manager/alacritty.nix index 299e99a9..9d3be3a9 100644 --- a/modules/home-manager/alacritty.nix +++ b/modules/home-manager/alacritty.nix @@ -4,23 +4,20 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.alacritty; -in -{ - options.catppuccin.alacritty = catppuccinLib.mkCatppuccinOption { name = "alacritty"; }; +in { + options.catppuccin.alacritty = + catppuccinLib.mkCatppuccinOption { name = "alacritty"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "alacritty" - "catppuccin" - ]; + from = [ "programs" "alacritty" "catppuccin" ]; to = "alacritty"; }; config = lib.mkIf cfg.enable { programs.alacritty = { - settings.general.import = lib.mkBefore [ "${sources.alacritty}/catppuccin-${cfg.flavor}.toml" ]; + settings.general.import = + lib.mkBefore [ "${sources.alacritty}/catppuccin-${cfg.flavor}.toml" ]; }; }; } diff --git a/modules/home-manager/bat.nix b/modules/home-manager/bat.nix index 1cda6a17..59b7e852 100644 --- a/modules/home-manager/bat.nix +++ b/modules/home-manager/bat.nix @@ -5,17 +5,12 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.bat; themeName = "Catppuccin ${catppuccinLib.mkUpper cfg.flavor}"; -in -{ +in { options.catppuccin.bat = catppuccinLib.mkCatppuccinOption { name = "bat"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "bat" - "catppuccin" - ]; + from = [ "programs" "bat" "catppuccin" ]; to = "bat"; }; diff --git a/modules/home-manager/bottom.nix b/modules/home-manager/bottom.nix index 5089230d..56a41b57 100644 --- a/modules/home-manager/bottom.nix +++ b/modules/home-manager/bottom.nix @@ -4,17 +4,13 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.bottom; -in -{ - options.catppuccin.bottom = catppuccinLib.mkCatppuccinOption { name = "bottom"; }; +in { + options.catppuccin.bottom = + catppuccinLib.mkCatppuccinOption { name = "bottom"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "bottom" - "catppuccin" - ]; + from = [ "programs" "bottom" "catppuccin" ]; to = "bottom"; }; diff --git a/modules/home-manager/btop.nix b/modules/home-manager/btop.nix index ce59d9e3..04c97e2e 100644 --- a/modules/home-manager/btop.nix +++ b/modules/home-manager/btop.nix @@ -9,29 +9,18 @@ let themeFile = "catppuccin_${cfg.flavor}.theme"; theme = sources.btop + "/${themeFile}"; -in -{ +in { options.catppuccin.btop = catppuccinLib.mkCatppuccinOption { name = "btop"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "btop" - "catppuccin" - ]; + from = [ "programs" "btop" "catppuccin" ]; to = "btop"; }; config = lib.mkIf enable { - xdg.configFile = { - "btop/themes/${themeFile}".source = theme; - }; + xdg.configFile = { "btop/themes/${themeFile}".source = theme; }; - programs.btop = { - settings = { - color_theme = themeFile; - }; - }; + programs.btop = { settings = { color_theme = themeFile; }; }; }; } diff --git a/modules/home-manager/cava.nix b/modules/home-manager/cava.nix index 5130e12b..ff6bffb9 100644 --- a/modules/home-manager/cava.nix +++ b/modules/home-manager/cava.nix @@ -6,37 +6,24 @@ let cfg = config.catppuccin.cava; flavor = "${cfg.flavor}" + lib.optionalString cfg.transparent "-transparent"; -in -{ - options.catppuccin.cava = catppuccinLib.mkCatppuccinOption { name = "cava"; } // { - transparent = lib.mkEnableOption "transparent version of flavor"; - }; +in { + options.catppuccin.cava = catppuccinLib.mkCatppuccinOption { name = "cava"; } + // { + transparent = lib.mkEnableOption "transparent version of flavor"; + }; - imports = - (catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "cava" - "catppuccin" - ]; - to = "cava"; - }) - ++ [ - (lib.mkRenamedOptionModule - [ - "programs" - "cava" - "catppuccin" - "transparent" - ] - [ - "catppuccin" - "cava" - "transparent" - ] - ) - ]; + imports = (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ "programs" "cava" "catppuccin" ]; + to = "cava"; + }) ++ [ + (lib.mkRenamedOptionModule [ + "programs" + "cava" + "catppuccin" + "transparent" + ] [ "catppuccin" "cava" "transparent" ]) + ]; config = lib.mkIf cfg.enable { programs.cava = { diff --git a/modules/home-manager/chrome.nix b/modules/home-manager/chrome.nix index 9af34469..f5f6711a 100644 --- a/modules/home-manager/chrome.nix +++ b/modules/home-manager/chrome.nix @@ -12,22 +12,16 @@ let # Google Chrome is not supported since it does not support extensions # See nix-community/home-manager#1383 for more information. - supportedBrowsers = [ - "brave" - "chromium" - "vivaldi" - ]; + supportedBrowsers = [ "brave" "chromium" "vivaldi" ]; - generateConfig = - browser: + generateConfig = browser: lib.mkIf cfg.${browser}.enable { - programs.${browser}.extensions = [ { id = identifiers.${cfg.${browser}.flavor}; } ]; + programs.${browser}.extensions = + [{ id = identifiers.${cfg.${browser}.flavor}; }]; }; -in -{ - options.catppuccin = lib.genAttrs supportedBrowsers ( - name: catppuccinLib.mkCatppuccinOption { inherit name; } - ); +in { + options.catppuccin = lib.genAttrs supportedBrowsers + (name: catppuccinLib.mkCatppuccinOption { inherit name; }); config = lib.mkMerge (map generateConfig supportedBrowsers); } diff --git a/modules/home-manager/cursors.nix b/modules/home-manager/cursors.nix index 0994d01d..f6823398 100644 --- a/modules/home-manager/cursors.nix +++ b/modules/home-manager/cursors.nix @@ -1,9 +1,5 @@ { catppuccinLib }: -{ - config, - lib, - ... -}: +{ config, lib, ... }: let inherit (config.catppuccin) sources; @@ -11,35 +7,25 @@ let cfg = config.catppuccin.cursors; # "dark" and "light" can be used alongside the regular accents - cursorAccentType = catppuccinLib.mergeEnums catppuccinLib.types.accent ( - lib.types.enum [ - "dark" - "light" - ] - ); -in + cursorAccentType = catppuccinLib.mergeEnums catppuccinLib.types.accent + (lib.types.enum [ "dark" "light" ]); -{ - options.catppuccin.cursors = - catppuccinLib.mkCatppuccinOption { - name = "pointer cursors"; - # NOTE: We exclude this as there is no `enable` option in the upstream - # module to guard it - useGlobalEnable = false; - } - // { - accent = lib.mkOption { - type = cursorAccentType; - default = config.catppuccin.accent; - description = "Catppuccin accent for pointer cursors"; - }; +in { + options.catppuccin.cursors = catppuccinLib.mkCatppuccinOption { + name = "pointer cursors"; + # NOTE: We exclude this as there is no `enable` option in the upstream + # module to guard it + useGlobalEnable = false; + } // { + accent = lib.mkOption { + type = cursorAccentType; + default = config.catppuccin.accent; + description = "Catppuccin accent for pointer cursors"; }; + }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "catppuccin" - "pointerCursor" - ]; + from = [ "catppuccin" "pointerCursor" ]; to = "cursors"; accentSupport = true; }; diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index a67b800b..e118d1d5 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -2,6 +2,8 @@ { imports = [ - (lib.modules.importApply ../global.nix { catppuccinModules = import ./all-modules.nix; }) + (lib.modules.importApply ../global.nix { + catppuccinModules = import ./all-modules.nix; + }) ]; } diff --git a/modules/home-manager/delta.nix b/modules/home-manager/delta.nix index 4ea9f323..2a9d73d7 100644 --- a/modules/home-manager/delta.nix +++ b/modules/home-manager/delta.nix @@ -6,24 +6,19 @@ let cfg = config.catppuccin.delta; enable = cfg.enable && config.programs.git.delta.enable; -in -{ - options.catppuccin.delta = catppuccinLib.mkCatppuccinOption { name = "delta"; }; +in { + options.catppuccin.delta = + catppuccinLib.mkCatppuccinOption { name = "delta"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "git" - "delta" - "catppuccin" - ]; + from = [ "programs" "git" "delta" "catppuccin" ]; to = "delta"; }; config = lib.mkIf enable { programs.git = { - includes = [ { path = "${sources.delta}/catppuccin.gitconfig"; } ]; + includes = [{ path = "${sources.delta}/catppuccin.gitconfig"; }]; delta.options.features = "catppuccin-${cfg.flavor}"; }; }; diff --git a/modules/home-manager/dunst.nix b/modules/home-manager/dunst.nix index ad5764bf..0511cb67 100644 --- a/modules/home-manager/dunst.nix +++ b/modules/home-manager/dunst.nix @@ -6,41 +6,27 @@ let cfg = config.catppuccin.dunst; enable = cfg.enable && config.services.dunst.enable; -in -{ - options.catppuccin.dunst = catppuccinLib.mkCatppuccinOption { name = "dunst"; } // { - prefix = lib.mkOption { - type = lib.types.str; - default = "00"; - description = "Prefix to use for the dunst drop-in file"; +in { + options.catppuccin.dunst = + catppuccinLib.mkCatppuccinOption { name = "dunst"; } // { + prefix = lib.mkOption { + type = lib.types.str; + default = "00"; + description = "Prefix to use for the dunst drop-in file"; + }; }; - }; - imports = - (catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "services" - "dunst" - "catppuccin" - ]; - to = "dunst"; - }) - ++ [ - (lib.mkRenamedOptionModule - [ - "services" - "dunst" - "catppuccin" - "prefix" - ] - [ - "catppuccin" - "dunst" - "prefix" - ] - ) - ]; + imports = (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ "services" "dunst" "catppuccin" ]; + to = "dunst"; + }) ++ [ + (lib.mkRenamedOptionModule [ "services" "dunst" "catppuccin" "prefix" ] [ + "catppuccin" + "dunst" + "prefix" + ]) + ]; # Dunst currently has no "include" functionality, but has "drop-ins" # Unfortunately, this may cause inconvenience as it overrides ~/.config/dunst/dunstrc @@ -50,7 +36,8 @@ in # Using a prefix like this is necessary because drop-ins' precedence depends on lexical order # such that later drop-ins override earlier ones # This way, users have better control over precedence - "dunst/dunstrc.d/${cfg.prefix}-catppuccin.conf".source = sources.dunst + "/${cfg.flavor}.conf"; + "dunst/dunstrc.d/${cfg.prefix}-catppuccin.conf".source = sources.dunst + + "/${cfg.flavor}.conf"; }; }; } diff --git a/modules/home-manager/fcitx5.nix b/modules/home-manager/fcitx5.nix index 5c048d17..b52908b9 100644 --- a/modules/home-manager/fcitx5.nix +++ b/modules/home-manager/fcitx5.nix @@ -6,57 +6,41 @@ let cfg = config.catppuccin.fcitx5; enable = cfg.enable && config.i18n.inputMethod.enabled == "fcitx5"; -in -{ - options.catppuccin.fcitx5 = - catppuccinLib.mkCatppuccinOption { - name = "Fcitx5"; - accentSupport = true; - } - // { - apply = lib.mkOption { - type = lib.types.bool; - default = true; - description = '' - Applies the theme by overwriting `$XDG_CONFIG_HOME/fcitx5/conf/classicui.conf`. - If this is disabled, you must manually set the theme (e.g. by using `fcitx5-configtool`). - ''; - }; +in { + options.catppuccin.fcitx5 = catppuccinLib.mkCatppuccinOption { + name = "Fcitx5"; + accentSupport = true; + } // { + apply = lib.mkOption { + type = lib.types.bool; + default = true; + description = '' + Applies the theme by overwriting `$XDG_CONFIG_HOME/fcitx5/conf/classicui.conf`. + If this is disabled, you must manually set the theme (e.g. by using `fcitx5-configtool`). + ''; }; + }; - imports = - (catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "i18n" - "inputMethod" - "fcitx5" - "catppuccin" - ]; - to = "fcitx5"; - accentSupport = true; - }) - ++ [ - (lib.mkRenamedOptionModule - [ - "i18n" - "inputMethod" - "fcitx5" - "catppuccin" - "apply" - ] - [ - "catppuccin" - "fcitx5" - "apply" - ] - ) - ]; + imports = (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ "i18n" "inputMethod" "fcitx5" "catppuccin" ]; + to = "fcitx5"; + accentSupport = true; + }) ++ [ + (lib.mkRenamedOptionModule [ + "i18n" + "inputMethod" + "fcitx5" + "catppuccin" + "apply" + ] [ "catppuccin" "fcitx5" "apply" ]) + ]; config = lib.mkIf enable { xdg.dataFile = { "fcitx5/themes/catppuccin-${cfg.flavor}-${cfg.accent}" = { - source = "${sources.fcitx5}/share/fcitx5/themes/catppuccin-${cfg.flavor}-${cfg.accent}"; + source = + "${sources.fcitx5}/share/fcitx5/themes/catppuccin-${cfg.flavor}-${cfg.accent}"; recursive = true; }; }; diff --git a/modules/home-manager/fish.nix b/modules/home-manager/fish.nix index d3cc3843..224a860f 100644 --- a/modules/home-manager/fish.nix +++ b/modules/home-manager/fish.nix @@ -8,22 +8,18 @@ let enable = cfg.enable && config.programs.fish.enable; themeName = "Catppuccin ${catppuccinLib.mkUpper cfg.flavor}"; -in -{ +in { options.catppuccin.fish = catppuccinLib.mkCatppuccinOption { name = "fish"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "fish" - "catppuccin" - ]; + from = [ "programs" "fish" "catppuccin" ]; to = "fish"; }; config = lib.mkIf enable { - xdg.configFile."fish/themes/${themeName}.theme".source = "${sources.fish}/${themeName}.theme"; + xdg.configFile."fish/themes/${themeName}.theme".source = + "${sources.fish}/${themeName}.theme"; programs.fish.shellInit = '' fish_config theme choose "${themeName}" diff --git a/modules/home-manager/foot.nix b/modules/home-manager/foot.nix index 16329e49..957394b9 100644 --- a/modules/home-manager/foot.nix +++ b/modules/home-manager/foot.nix @@ -5,17 +5,12 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.foot; -in -{ +in { options.catppuccin.foot = catppuccinLib.mkCatppuccinOption { name = "foot"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "foot" - "catppuccin" - ]; + from = [ "programs" "foot" "catppuccin" ]; to = "foot"; }; diff --git a/modules/home-manager/freetube.nix b/modules/home-manager/freetube.nix index 048c58ae..9d5f6a4e 100644 --- a/modules/home-manager/freetube.nix +++ b/modules/home-manager/freetube.nix @@ -6,50 +6,34 @@ let inherit (config.programs.freetube.settings) baseTheme; cfg = config.catppuccin.freetube; -in -{ - options.catppuccin.freetube = - catppuccinLib.mkCatppuccinOption { - name = "freetube"; - accentSupport = true; - } - // { - # FreeTube supports two accent colors - secondaryAccent = lib.mkOption { - type = catppuccinLib.types.accent; - # Have the secondary accent default to FreeTube's main accent rather than the global Catppuccin accent - # This assumes most users would prefer both accent colors to be the same when only overriding the main one - default = cfg.accent; - description = "Secondary accent for freetube"; - }; +in { + options.catppuccin.freetube = catppuccinLib.mkCatppuccinOption { + name = "freetube"; + accentSupport = true; + } // { + # FreeTube supports two accent colors + secondaryAccent = lib.mkOption { + type = catppuccinLib.types.accent; + # Have the secondary accent default to FreeTube's main accent rather than the global Catppuccin accent + # This assumes most users would prefer both accent colors to be the same when only overriding the main one + default = cfg.accent; + description = "Secondary accent for freetube"; }; + }; - imports = - (catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "freetube" - "catppuccin" - ]; - to = "freetube"; - accentSupport = true; - }) - ++ [ - (lib.mkRenamedOptionModule - [ - "programs" - "freetube" - "catppuccin" - "secondaryAccent" - ] - [ - "catppuccin" - "freetube" - "secondaryAccent" - ] - ) - ]; + imports = (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ "programs" "freetube" "catppuccin" ]; + to = "freetube"; + accentSupport = true; + }) ++ [ + (lib.mkRenamedOptionModule [ + "programs" + "freetube" + "catppuccin" + "secondaryAccent" + ] [ "catppuccin" "freetube" "secondaryAccent" ]) + ]; config = lib.mkIf cfg.enable { programs.freetube.settings = { diff --git a/modules/home-manager/fuzzel.nix b/modules/home-manager/fuzzel.nix index 8ed78af3..60279e31 100644 --- a/modules/home-manager/fuzzel.nix +++ b/modules/home-manager/fuzzel.nix @@ -5,20 +5,15 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.fuzzel; -in -{ +in { options.catppuccin.fuzzel = catppuccinLib.mkCatppuccinOption { name = "fuzzel"; accentSupport = true; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "fuzzel" - "catppuccin" - ]; + from = [ "programs" "fuzzel" "catppuccin" ]; to = "fuzzel"; accentSupport = true; }; @@ -26,7 +21,8 @@ in config = lib.mkIf cfg.enable { programs.fuzzel = { settings = { - main.include = sources.fuzzel + "/catppuccin-${cfg.flavor}/${cfg.accent}.ini"; + main.include = sources.fuzzel + + "/catppuccin-${cfg.flavor}/${cfg.accent}.ini"; }; }; }; diff --git a/modules/home-manager/fzf.nix b/modules/home-manager/fzf.nix index 88cfc1fc..ab6e2802 100644 --- a/modules/home-manager/fzf.nix +++ b/modules/home-manager/fzf.nix @@ -5,7 +5,8 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.fzf; - palette = (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors; + palette = + (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors; # Manually populate with colors from catppuccin/fzf # The ordering is meant to match the order of catppuccin/fzf to make comparison easier @@ -23,27 +24,18 @@ let prompt = cfg.accent; "hl+" = cfg.accent; }; -in -{ +in { options.catppuccin.fzf = catppuccinLib.mkCatppuccinOption { name = "fzf"; accentSupport = true; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "fzf" - "catppuccin" - ]; + from = [ "programs" "fzf" "catppuccin" ]; to = "fzf"; accentSupport = true; }; - config = lib.mkIf cfg.enable { - programs.fzf = { - inherit colors; - }; - }; + config = lib.mkIf cfg.enable { programs.fzf = { inherit colors; }; }; } diff --git a/modules/home-manager/gh-dash.nix b/modules/home-manager/gh-dash.nix index 31b33b51..2e953cdf 100644 --- a/modules/home-manager/gh-dash.nix +++ b/modules/home-manager/gh-dash.nix @@ -5,28 +5,22 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.gh-dash; - theme = "${sources.gh-dash}/${cfg.flavor}/catppuccin-${cfg.flavor}-${cfg.accent}.yml"; -in + theme = + "${sources.gh-dash}/${cfg.flavor}/catppuccin-${cfg.flavor}-${cfg.accent}.yml"; -{ +in { options.catppuccin.gh-dash = catppuccinLib.mkCatppuccinOption { name = "gh-dash"; accentSupport = true; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "gh-dash" - "catppuccin" - ]; + from = [ "programs" "gh-dash" "catppuccin" ]; to = "gh-dash"; accentSupport = true; }; config = lib.mkIf cfg.enable { - programs.gh-dash = { - settings = catppuccinLib.importYAML theme; - }; + programs.gh-dash = { settings = catppuccinLib.importYAML theme; }; }; } diff --git a/modules/home-manager/ghostty.nix b/modules/home-manager/ghostty.nix index 20612c14..e405d107 100644 --- a/modules/home-manager/ghostty.nix +++ b/modules/home-manager/ghostty.nix @@ -7,19 +7,18 @@ let cfg = config.catppuccin.ghostty; themeName = "catppuccin-${cfg.flavor}"; enable = cfg.enable && config.programs.ghostty.enable; -in -{ - options.catppuccin.ghostty = catppuccinLib.mkCatppuccinOption { name = "ghostty"; }; +in { + options.catppuccin.ghostty = + catppuccinLib.mkCatppuccinOption { name = "ghostty"; }; config = lib.mkIf enable { xdg.configFile = { - "ghostty/themes/${themeName}".source = "${sources.ghostty}/${themeName}.conf"; + "ghostty/themes/${themeName}".source = + "${sources.ghostty}/${themeName}.conf"; }; programs.ghostty = { - settings = { - theme = "light:${themeName},dark:${themeName}"; - }; + settings = { theme = "light:${themeName},dark:${themeName}"; }; }; }; } diff --git a/modules/home-manager/gitui.nix b/modules/home-manager/gitui.nix index e16a6bfd..48bb1ac9 100644 --- a/modules/home-manager/gitui.nix +++ b/modules/home-manager/gitui.nix @@ -5,17 +5,13 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.gitui; -in -{ - options.catppuccin.gitui = catppuccinLib.mkCatppuccinOption { name = "gitui"; }; +in { + options.catppuccin.gitui = + catppuccinLib.mkCatppuccinOption { name = "gitui"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "gitui" - "catppuccin" - ]; + from = [ "programs" "gitui" "catppuccin" ]; to = "gitui"; }; diff --git a/modules/home-manager/glamour.nix b/modules/home-manager/glamour.nix index 57f468da..4098fc71 100644 --- a/modules/home-manager/glamour.nix +++ b/modules/home-manager/glamour.nix @@ -5,17 +5,13 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.glamour; -in -{ - options.catppuccin.glamour = catppuccinLib.mkCatppuccinOption { name = "glamour"; }; +in { + options.catppuccin.glamour = + catppuccinLib.mkCatppuccinOption { name = "glamour"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "glamour" - "catppuccin" - ]; + from = [ "programs" "glamour" "catppuccin" ]; to = "glamour"; }; diff --git a/modules/home-manager/gtk.nix b/modules/home-manager/gtk.nix index b1fa6ef4..a345c0d7 100644 --- a/modules/home-manager/gtk.nix +++ b/modules/home-manager/gtk.nix @@ -1,211 +1,143 @@ { catppuccinLib }: -{ - config, - lib, - pkgs, - ... -}: +{ config, lib, pkgs, ... }: let inherit (lib) - concatStringsSep - mkEnableOption - mkIf - mkMerge - mkOption - mkRenamedOptionModule - types - ; + concatStringsSep mkEnableOption mkIf mkMerge mkOption mkRenamedOptionModule + types; cfg = config.catppuccin.gtk; enable = cfg.enable && config.gtk.enable; -in -{ - options.catppuccin.gtk = - catppuccinLib.mkCatppuccinOption { - name = "gtk"; - useGlobalEnable = false; - - accentSupport = true; - } - // { - 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" - "float" - ] - ); - default = [ ]; - description = "Catppuccin tweaks for gtk"; - }; +in { + options.catppuccin.gtk = catppuccinLib.mkCatppuccinOption { + name = "gtk"; + useGlobalEnable = false; + + accentSupport = true; + } // { + size = mkOption { + type = types.enum [ "standard" "compact" ]; + default = "standard"; + description = "Catppuccin size variant for gtk"; + }; - gnomeShellTheme = mkEnableOption "Catppuccin gtk theme for GNOME Shell"; + tweaks = mkOption { + type = types.listOf (types.enum [ "black" "rimless" "normal" "float" ]); + default = [ ]; + description = "Catppuccin tweaks for gtk"; + }; - icon = catppuccinLib.mkCatppuccinOption { - name = "GTK modified Papirus icon theme"; - # NOTE: we exclude this from the global `catppuccin.enable` as there is no - # `enable` option in the upstream module to guard it - default = false; + gnomeShellTheme = mkEnableOption "Catppuccin gtk theme for GNOME Shell"; - accentSupport = true; - }; - }; + icon = catppuccinLib.mkCatppuccinOption { + name = "GTK modified Papirus icon theme"; + # NOTE: we exclude this from the global `catppuccin.enable` as there is no + # `enable` option in the upstream module to guard it + default = false; - imports = - (catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "gtk" - "catppuccin" - ]; - to = "gtk"; accentSupport = true; - }) - ++ (catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "gtk" - "catppuccin" - "cursor" - ]; - to = "cursors"; - accentSupport = true; - }) - ++ [ - (mkRenamedOptionModule - [ - "gtk" - "catppuccin" - "size" - ] - [ - "catppuccin" - "gtk" - "size" - ] - ) - - (mkRenamedOptionModule - [ - "gtk" - "catppuccin" - "tweaks" - ] - [ - "catppuccin" - "gtk" - "tweaks" - ] - ) - - (mkRenamedOptionModule - [ - "gtk" - "catppuccin" - "gnomeShellTheme" - ] - [ - "catppuccin" - "gtk" - "gnomeShellTheme" - ] - ) - - (mkRenamedOptionModule - [ - "gtk" - "catppuccin" - "icon" - ] - [ - "catppuccin" - "gtk" - "icon" - ] - ) - ]; + }; + }; + + imports = (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ "gtk" "catppuccin" ]; + to = "gtk"; + accentSupport = true; + }) ++ (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ "gtk" "catppuccin" "cursor" ]; + to = "cursors"; + accentSupport = true; + }) ++ [ + (mkRenamedOptionModule [ "gtk" "catppuccin" "size" ] [ + "catppuccin" + "gtk" + "size" + ]) + + (mkRenamedOptionModule [ "gtk" "catppuccin" "tweaks" ] [ + "catppuccin" + "gtk" + "tweaks" + ]) + + (mkRenamedOptionModule [ "gtk" "catppuccin" "gnomeShellTheme" ] [ + "catppuccin" + "gtk" + "gnomeShellTheme" + ]) + + (mkRenamedOptionModule [ "gtk" "catppuccin" "icon" ] [ + "catppuccin" + "gtk" + "icon" + ]) + ]; config = mkMerge [ (mkIf (enable || cfg.gnomeShellTheme) { - warnings = [ - '' - `gtk.catppuccin.enable` and `gtk.catppuccin.gnomeShellTheme` are deprecated and will be removed in a future release. - - The upstream port has been archived and support will no longer be provided. - Please see https://github.com/catppuccin/gtk/issues/262 - '' - ]; + warnings = ['' + `gtk.catppuccin.enable` and `gtk.catppuccin.gnomeShellTheme` are deprecated and will be removed in a future release. + + The upstream port has been archived and support will no longer be provided. + Please see https://github.com/catppuccin/gtk/issues/262 + '']; }) (mkIf enable { - gtk.theme = - let - gtkTweaks = concatStringsSep "," cfg.tweaks; - in - { - name = - "catppuccin-${cfg.flavor}-${cfg.accent}-${cfg.size}+" - + (if (cfg.tweaks == [ ]) then "default" else gtkTweaks); - package = config.catppuccin.sources.gtk.override { - inherit (cfg) flavor size tweaks; - accents = [ cfg.accent ]; - }; + gtk.theme = let gtkTweaks = concatStringsSep "," cfg.tweaks; + in { + name = "catppuccin-${cfg.flavor}-${cfg.accent}-${cfg.size}+" + + (if (cfg.tweaks == [ ]) then "default" else gtkTweaks); + package = config.catppuccin.sources.gtk.override { + inherit (cfg) flavor size tweaks; + accents = [ cfg.accent ]; }; + }; - xdg.configFile = - let - gtk4Dir = "${config.gtk.theme.package}/share/themes/${config.gtk.theme.name}/gtk-4.0"; - in - { - "gtk-4.0/assets".source = "${gtk4Dir}/assets"; - "gtk-4.0/gtk.css".source = "${gtk4Dir}/gtk.css"; - "gtk-4.0/gtk-dark.css".source = "${gtk4Dir}/gtk-dark.css"; - }; + xdg.configFile = let + gtk4Dir = + "${config.gtk.theme.package}/share/themes/${config.gtk.theme.name}/gtk-4.0"; + in { + "gtk-4.0/assets".source = "${gtk4Dir}/assets"; + "gtk-4.0/gtk.css".source = "${gtk4Dir}/gtk.css"; + "gtk-4.0/gtk-dark.css".source = "${gtk4Dir}/gtk-dark.css"; + }; }) (mkIf cfg.icon.enable { - gtk.iconTheme = - let - # use the light icon theme for latte - polarity = if cfg.icon.flavor == "latte" then "Light" else "Dark"; - in - { - name = "Papirus-${polarity}"; - package = pkgs.catppuccin-papirus-folders.override { inherit (cfg.icon) accent flavor; }; + gtk.iconTheme = let + # use the light icon theme for latte + polarity = if cfg.icon.flavor == "latte" then "Light" else "Dark"; + in { + name = "Papirus-${polarity}"; + package = pkgs.catppuccin-papirus-folders.override { + inherit (cfg.icon) accent flavor; }; + }; }) (mkIf cfg.gnomeShellTheme { - assertions = [ - { - assertion = enable; - message = "`gtk.enable` and `gtk.catppuccin.enable` must be `true` to use the GNOME shell theme"; - } - ]; + assertions = [{ + assertion = enable; + message = + "`gtk.enable` and `gtk.catppuccin.enable` must be `true` to use the GNOME shell theme"; + }]; home.packages = [ pkgs.gnomeExtensions.user-themes ]; dconf.settings = { "org/gnome/shell" = { disable-user-extensions = false; - enabled-extensions = [ "user-theme@gnome-shell-extensions.gcampax.github.com" ]; + enabled-extensions = + [ "user-theme@gnome-shell-extensions.gcampax.github.com" ]; }; "org/gnome/shell/extensions/user-theme" = { inherit (config.gtk.theme) name; }; "org/gnome/desktop/interface" = { - color-scheme = if cfg.flavor == "latte" then "default" else "prefer-dark"; + color-scheme = + if cfg.flavor == "latte" then "default" else "prefer-dark"; }; }; }) diff --git a/modules/home-manager/helix.nix b/modules/home-manager/helix.nix index c0c02852..cff95813 100644 --- a/modules/home-manager/helix.nix +++ b/modules/home-manager/helix.nix @@ -7,37 +7,24 @@ let cfg = config.catppuccin.helix; enable = cfg.enable && config.programs.helix.enable; subdir = if cfg.useItalics then "default" else "no_italics"; -in -{ - options.catppuccin.helix = catppuccinLib.mkCatppuccinOption { name = "helix"; } // { - useItalics = lib.mkEnableOption "Italics in Catppuccin theme for Helix"; - }; +in { + options.catppuccin.helix = + catppuccinLib.mkCatppuccinOption { name = "helix"; } // { + useItalics = lib.mkEnableOption "Italics in Catppuccin theme for Helix"; + }; - imports = - (catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "helix" - "catppuccin" - ]; - to = "helix"; - }) - ++ [ - (lib.mkRenamedOptionModule - [ - "programs" - "helix" - "catppuccin" - "useItalics" - ] - [ - "catppuccin" - "helix" - "useItalics" - ] - ) - ]; + imports = (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ "programs" "helix" "catppuccin" ]; + to = "helix"; + }) ++ [ + (lib.mkRenamedOptionModule [ + "programs" + "helix" + "catppuccin" + "useItalics" + ] [ "catppuccin" "helix" "useItalics" ]) + ]; config = lib.mkIf enable { programs.helix = { diff --git a/modules/home-manager/hyprland.nix b/modules/home-manager/hyprland.nix index 84deb8f5..429fce25 100644 --- a/modules/home-manager/hyprland.nix +++ b/modules/home-manager/hyprland.nix @@ -1,30 +1,19 @@ { catppuccinLib }: -{ - config, - lib, - pkgs, - ... -}: +{ config, lib, pkgs, ... }: let inherit (config.catppuccin) sources cursors; cfg = config.catppuccin.hyprland; enable = cfg.enable && config.wayland.windowManager.hyprland.enable; -in -{ +in { options.catppuccin.hyprland = catppuccinLib.mkCatppuccinOption { name = "hyprland"; accentSupport = true; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "wayland" - "windowManager" - "hyprland" - "catppuccin" - ]; + from = [ "wayland" "windowManager" "hyprland" "catppuccin" ]; to = "hyprland"; accentSupport = true; }; @@ -32,7 +21,8 @@ in config = lib.mkIf enable { home.sessionVariables = lib.mkIf cursors.enable { HYPRCURSOR_SIZE = config.home.pointerCursor.size; - HYPRCURSOR_THEME = "catppuccin-${cursors.flavor}-${cursors.accent}-cursors"; + HYPRCURSOR_THEME = + "catppuccin-${cursors.flavor}-${cursors.accent}-cursors"; }; wayland.windowManager.hyprland = { diff --git a/modules/home-manager/hyprlock.nix b/modules/home-manager/hyprlock.nix index 356a0df8..bdad1cfb 100644 --- a/modules/home-manager/hyprlock.nix +++ b/modules/home-manager/hyprlock.nix @@ -1,29 +1,19 @@ { catppuccinLib }: -{ - config, - lib, - pkgs, - ... -}: +{ config, lib, pkgs, ... }: let inherit (config.catppuccin) sources; cfg = config.catppuccin.hyprlock; -in -{ +in { options.catppuccin.hyprlock = catppuccinLib.mkCatppuccinOption { name = "hyprlock"; accentSupport = true; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "hyprlock" - "catppuccin" - ]; + from = [ "programs" "hyprlock" "catppuccin" ]; to = "hyprlock"; accentSupport = true; }; diff --git a/modules/home-manager/imv.nix b/modules/home-manager/imv.nix index a2b9c0e1..4a7baf7b 100644 --- a/modules/home-manager/imv.nix +++ b/modules/home-manager/imv.nix @@ -5,23 +5,19 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.imv; -in -{ +in { options.catppuccin.imv = catppuccinLib.mkCatppuccinOption { name = "imv"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "imv" - "catppuccin" - ]; + from = [ "programs" "imv" "catppuccin" ]; to = "imv"; }; config = lib.mkIf cfg.enable { programs.imv = { - settings = catppuccinLib.importINI (sources.imv + "/${cfg.flavor}.config"); + settings = + catppuccinLib.importINI (sources.imv + "/${cfg.flavor}.config"); }; }; } diff --git a/modules/home-manager/k9s.nix b/modules/home-manager/k9s.nix index 67c4cd76..2de65a2b 100644 --- a/modules/home-manager/k9s.nix +++ b/modules/home-manager/k9s.nix @@ -1,10 +1,5 @@ { catppuccinLib }: -{ - config, - lib, - pkgs, - ... -}: +{ config, lib, pkgs, ... }: let inherit (config.catppuccin) sources; @@ -16,59 +11,38 @@ let # `~/Library/Application Support` when not using XDG enableXdgConfig = !pkgs.stdenv.hostPlatform.isDarwin || config.xdg.enable; - themeName = "catppuccin-${cfg.flavor}" + lib.optionalString cfg.transparent "-transparent"; + themeName = "catppuccin-${cfg.flavor}" + + lib.optionalString cfg.transparent "-transparent"; themeFile = "${themeName}.yaml"; themePath = "k9s/skins/${themeFile}"; theme = sources.k9s + "/${themeFile}"; -in -{ - options.catppuccin.k9s = catppuccinLib.mkCatppuccinOption { name = "k9s"; } // { - transparent = lib.mkEnableOption "transparent version of flavor"; - }; - - imports = - (catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "k9s" - "catppuccin" - ]; - to = "k9s"; +in { + options.catppuccin.k9s = catppuccinLib.mkCatppuccinOption { name = "k9s"; } + // { + transparent = lib.mkEnableOption "transparent version of flavor"; + }; + + imports = (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ "programs" "k9s" "catppuccin" ]; + to = "k9s"; + }) ++ [ + (lib.mkRenamedOptionModule [ "programs" "k9s" "catppuccin" "transparent" ] [ + "catppuccin" + "k9s" + "transparent" + ]) + ]; + + config = lib.mkIf enable (lib.mkMerge [ + (lib.mkIf (!enableXdgConfig) { + home.file = { + "Library/Application Support/${themePath}".source = theme; + }; }) - ++ [ - (lib.mkRenamedOptionModule - [ - "programs" - "k9s" - "catppuccin" - "transparent" - ] - [ - "catppuccin" - "k9s" - "transparent" - ] - ) - ]; - - config = lib.mkIf enable ( - lib.mkMerge [ - (lib.mkIf (!enableXdgConfig) { - home.file = { - "Library/Application Support/${themePath}".source = theme; - }; - }) - (lib.mkIf enableXdgConfig { xdg.configFile.${themePath}.source = theme; }) + (lib.mkIf enableXdgConfig { xdg.configFile.${themePath}.source = theme; }) - { - programs.k9s = { - settings = { - k9s.ui.skin = themeName; - }; - }; - } - ] - ); + { programs.k9s = { settings = { k9s.ui.skin = themeName; }; }; } + ]); } diff --git a/modules/home-manager/kitty.nix b/modules/home-manager/kitty.nix index 430f2e2e..15ab1085 100644 --- a/modules/home-manager/kitty.nix +++ b/modules/home-manager/kitty.nix @@ -1,19 +1,14 @@ { catppuccinLib }: { config, lib, ... }: -let - cfg = config.catppuccin.kitty; -in +let cfg = config.catppuccin.kitty; -{ - options.catppuccin.kitty = catppuccinLib.mkCatppuccinOption { name = "kitty"; }; +in { + options.catppuccin.kitty = + catppuccinLib.mkCatppuccinOption { name = "kitty"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "kitty" - "catppuccin" - ]; + from = [ "programs" "kitty" "catppuccin" ]; to = "kitty"; }; diff --git a/modules/home-manager/kvantum.nix b/modules/home-manager/kvantum.nix index 9a8de529..74216b06 100644 --- a/modules/home-manager/kvantum.nix +++ b/modules/home-manager/kvantum.nix @@ -1,77 +1,57 @@ { catppuccinLib }: -{ - config, - lib, - ... -}: +{ config, lib, ... }: let cfg = config.catppuccin.kvantum; enable = cfg.enable && config.qt.enable; themeName = "catppuccin-${cfg.flavor}-${cfg.accent}"; -in -{ - options.catppuccin.kvantum = - catppuccinLib.mkCatppuccinOption { - name = "Kvantum"; - accentSupport = true; - } - // { - apply = lib.mkOption { - type = lib.types.bool; - default = true; - description = '' - Applies the theme by overwriting `$XDG_CONFIG_HOME/Kvantum/kvantum.kvconfig`. - If this is disabled, you must manually set the theme (e.g. by using `kvantummanager`). - ''; - }; +in { + options.catppuccin.kvantum = catppuccinLib.mkCatppuccinOption { + name = "Kvantum"; + accentSupport = true; + } // { + apply = lib.mkOption { + type = lib.types.bool; + default = true; + description = '' + Applies the theme by overwriting `$XDG_CONFIG_HOME/Kvantum/kvantum.kvconfig`. + If this is disabled, you must manually set the theme (e.g. by using `kvantummanager`). + ''; }; + }; - imports = - (catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "qt" - "style" - "catppuccin" - ]; - to = "kvantum"; - accentSupport = true; - }) - ++ [ - (lib.mkRenamedOptionModule - [ - "qt" - "style" - "catppuccin" - "apply" - ] - [ - "catppuccin" - "kvantum" - "apply" - ] - ) - ]; + imports = (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ "qt" "style" "catppuccin" ]; + to = "kvantum"; + accentSupport = true; + }) ++ [ + (lib.mkRenamedOptionModule [ "qt" "style" "catppuccin" "apply" ] [ + "catppuccin" + "kvantum" + "apply" + ]) + ]; config = lib.mkIf enable { assertions = [ { - assertion = lib.elem config.qt.style.name [ - "kvantum" - "Kvantum" - ]; - message = ''`qt.style.name` must be `"kvantum"` to use `qt.style.catppuccin`''; + assertion = lib.elem config.qt.style.name [ "kvantum" "Kvantum" ]; + message = + ''`qt.style.name` must be `"kvantum"` to use `qt.style.catppuccin`''; } { - assertion = lib.elem (config.qt.platformTheme.name or null) [ "kvantum" ]; - message = ''`qt.platformTheme.name` must be set to `"kvantum"` to use `qt.style.catppuccin`''; + assertion = + lib.elem (config.qt.platformTheme.name or null) [ "kvantum" ]; + message = '' + `qt.platformTheme.name` must be set to `"kvantum"` to use `qt.style.catppuccin`''; } ]; xdg.configFile = { - "Kvantum/${themeName}".source = "${config.catppuccin.sources.kvantum}/share/Kvantum/${themeName}"; + "Kvantum/${themeName}".source = + "${config.catppuccin.sources.kvantum}/share/Kvantum/${themeName}"; "Kvantum/kvantum.kvconfig" = lib.mkIf cfg.apply { text = '' [General] diff --git a/modules/home-manager/lazygit.nix b/modules/home-manager/lazygit.nix index e9cbceeb..1a851053 100644 --- a/modules/home-manager/lazygit.nix +++ b/modules/home-manager/lazygit.nix @@ -1,10 +1,5 @@ { catppuccinLib }: -{ - config, - lib, - pkgs, - ... -}: +{ config, lib, pkgs, ... }: let inherit (config.catppuccin) sources; @@ -16,26 +11,20 @@ let # `~/Library/Application Support` when not using XDG enableXdgConfig = !pkgs.stdenv.hostPlatform.isDarwin || config.xdg.enable; - configDirectory = - if enableXdgConfig then - config.xdg.configHome - else - "${config.home.homeDirectory}/Library/Application Support"; + configDirectory = if enableXdgConfig then + config.xdg.configHome + else + "${config.home.homeDirectory}/Library/Application Support"; configFile = "${configDirectory}/lazygit/config.yml"; -in -{ +in { options.catppuccin.lazygit = catppuccinLib.mkCatppuccinOption { name = "lazygit"; accentSupport = true; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "lazygit" - "catppuccin" - ]; + from = [ "programs" "lazygit" "catppuccin" ]; to = "lazygit"; accentSupport = true; }; @@ -43,7 +32,8 @@ in config = lib.mkIf enable { home.sessionVariables = { # Ensure that the default config file is still sourced - LG_CONFIG_FILE = "${sources.lazygit}/${cfg.flavor}/${cfg.accent}.yml,${configFile}"; + LG_CONFIG_FILE = + "${sources.lazygit}/${cfg.flavor}/${cfg.accent}.yml,${configFile}"; }; }; } diff --git a/modules/home-manager/lsd.nix b/modules/home-manager/lsd.nix index 74748415..00009859 100644 --- a/modules/home-manager/lsd.nix +++ b/modules/home-manager/lsd.nix @@ -6,14 +6,14 @@ let cfg = config.catppuccin.lsd; enable = cfg.enable && config.programs.lsd.enable; -in -{ +in { options.catppuccin.lsd = catppuccinLib.mkCatppuccinOption { name = "lsd"; }; config = lib.mkIf enable { xdg.configFile = { - "lsd/colors.yaml".source = "${sources.lsd}/catppuccin-${cfg.flavor}/colors.yaml"; + "lsd/colors.yaml".source = + "${sources.lsd}/catppuccin-${cfg.flavor}/colors.yaml"; }; programs.lsd.settings.color.theme = "custom"; }; diff --git a/modules/home-manager/mako.nix b/modules/home-manager/mako.nix index 36762d81..b0660409 100644 --- a/modules/home-manager/mako.nix +++ b/modules/home-manager/mako.nix @@ -1,35 +1,24 @@ { catppuccinLib }: -{ - config, - pkgs, - lib, - ... -}: +{ config, pkgs, lib, ... }: let inherit (config.catppuccin) sources; cfg = config.catppuccin.mako; - theme = catppuccinLib.importINI ( - sources.mako + "/catppuccin-${cfg.flavor}/catppuccin-${cfg.flavor}-${cfg.accent}" - ); + theme = catppuccinLib.importINI (sources.mako + + "/catppuccin-${cfg.flavor}/catppuccin-${cfg.flavor}-${cfg.accent}"); # Settings that need to be extracted and put in extraConfig extraConfigAttrs = lib.attrsets.getAttrs [ "urgency=high" ] theme; -in -{ +in { options.catppuccin.mako = catppuccinLib.mkCatppuccinOption { name = "mako"; accentSupport = true; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "services" - "mako" - "catppuccin" - ]; + from = [ "services" "mako" "catppuccin" ]; to = "mako"; accentSupport = true; }; @@ -40,8 +29,7 @@ in textColor = theme.text-color; borderColor = theme.border-color; progressColor = theme.progress-color; - extraConfig = lib.fileContents ( - (pkgs.formats.ini { }).generate "mako-extra-config" extraConfigAttrs - ); + extraConfig = lib.fileContents + ((pkgs.formats.ini { }).generate "mako-extra-config" extraConfigAttrs); }; } diff --git a/modules/home-manager/micro.nix b/modules/home-manager/micro.nix index 285a8d4c..248653c1 100644 --- a/modules/home-manager/micro.nix +++ b/modules/home-manager/micro.nix @@ -7,33 +7,28 @@ let cfg = config.catppuccin.micro; enable = cfg.enable && config.programs.micro.enable; - themePath = - "catppuccin-${cfg.flavor}" + lib.optionalString cfg.transparent "-transparent" + ".micro"; -in + themePath = "catppuccin-${cfg.flavor}" + + lib.optionalString cfg.transparent "-transparent" + ".micro"; -{ - options.catppuccin.micro = catppuccinLib.mkCatppuccinOption { name = "micro"; } // { - transparent = lib.mkEnableOption "transparent version of flavor"; - }; +in { + options.catppuccin.micro = + catppuccinLib.mkCatppuccinOption { name = "micro"; } // { + transparent = lib.mkEnableOption "transparent version of flavor"; + }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "micro" - "catppuccin" - ]; + from = [ "programs" "micro" "catppuccin" ]; to = "micro"; }; config = lib.mkIf enable { programs.micro = { - settings = { - colorscheme = lib.removeSuffix ".micro" themePath; - }; + settings = { colorscheme = lib.removeSuffix ".micro" themePath; }; }; xdg.configFile = { - "micro/colorschemes/${themePath}".source = "${sources.micro}/${themePath}"; + "micro/colorschemes/${themePath}".source = + "${sources.micro}/${themePath}"; }; }; } diff --git a/modules/home-manager/mpv.nix b/modules/home-manager/mpv.nix index 32b9d8d1..c5364999 100644 --- a/modules/home-manager/mpv.nix +++ b/modules/home-manager/mpv.nix @@ -5,29 +5,22 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.mpv; -in -{ +in { options.catppuccin.mpv = catppuccinLib.mkCatppuccinOption { name = "mpv"; accentSupport = true; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "mpv" - "catppuccin" - ]; + from = [ "programs" "mpv" "catppuccin" ]; to = "mpv"; accentSupport = true; }; config = lib.mkIf cfg.enable { programs.mpv = { - config = { - include = sources.mpv + "/${cfg.flavor}/${cfg.accent}.conf"; - }; + config = { include = sources.mpv + "/${cfg.flavor}/${cfg.accent}.conf"; }; }; }; } diff --git a/modules/home-manager/neovim.nix b/modules/home-manager/neovim.nix index 390b8d80..51bd6856 100644 --- a/modules/home-manager/neovim.nix +++ b/modules/home-manager/neovim.nix @@ -1,47 +1,36 @@ { catppuccinLib }: -{ - config, - lib, - ... -}: +{ config, lib, ... }: -let - cfg = config.catppuccin.nvim; -in +let cfg = config.catppuccin.nvim; -{ - options.catppuccin.nvim = catppuccinLib.mkCatppuccinOption { name = "neovim"; }; +in { + options.catppuccin.nvim = + catppuccinLib.mkCatppuccinOption { name = "neovim"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "neovim" - "catppuccin" - ]; + from = [ "programs" "neovim" "catppuccin" ]; to = "nvim"; }; config = lib.mkIf cfg.enable { programs.neovim = { - plugins = [ - { - plugin = config.catppuccin.sources.nvim; - config = '' - lua << EOF - local compile_path = vim.fn.stdpath("cache") .. "/catppuccin-nvim" - vim.fn.mkdir(compile_path, "p") - vim.opt.runtimepath:append(compile_path) + plugins = [{ + plugin = config.catppuccin.sources.nvim; + config = '' + lua << EOF + local compile_path = vim.fn.stdpath("cache") .. "/catppuccin-nvim" + vim.fn.mkdir(compile_path, "p") + vim.opt.runtimepath:append(compile_path) - require("catppuccin").setup({ - compile_path = compile_path, - flavour = "${cfg.flavor}", - }) + require("catppuccin").setup({ + compile_path = compile_path, + flavour = "${cfg.flavor}", + }) - vim.api.nvim_command("colorscheme catppuccin") - EOF - ''; - } - ]; + vim.api.nvim_command("colorscheme catppuccin") + EOF + ''; + }]; }; }; } diff --git a/modules/home-manager/newsboat.nix b/modules/home-manager/newsboat.nix index 7b014c43..51c0967e 100644 --- a/modules/home-manager/newsboat.nix +++ b/modules/home-manager/newsboat.nix @@ -6,17 +6,13 @@ let cfg = config.catppuccin.newsboat; theme = if cfg.flavor == "latte" then "latte" else "dark"; -in -{ - options.catppuccin.newsboat = catppuccinLib.mkCatppuccinOption { name = "newsboat"; }; +in { + options.catppuccin.newsboat = + catppuccinLib.mkCatppuccinOption { name = "newsboat"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "newsboat" - "catppuccin" - ]; + from = [ "programs" "newsboat" "catppuccin" ]; to = "newsboat"; }; diff --git a/modules/home-manager/obs.nix b/modules/home-manager/obs.nix index 7f55c046..6480ef9a 100644 --- a/modules/home-manager/obs.nix +++ b/modules/home-manager/obs.nix @@ -8,23 +8,20 @@ let enable = cfg.enable && config.programs.obs-studio.enable; themeName = "Catppuccin_${catppuccinLib.mkUpper cfg.flavor}.ovt"; -in -{ - options.catppuccin.obs = catppuccinLib.mkCatppuccinOption { name = "obs-studio"; }; +in { + options.catppuccin.obs = + catppuccinLib.mkCatppuccinOption { name = "obs-studio"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "obs-studio" - "catppuccin" - ]; + from = [ "programs" "obs-studio" "catppuccin" ]; to = "obs"; }; config = lib.mkIf enable { xdg.configFile = { - "obs-studio/themes/Catppuccin.obt".source = "${sources.obs}/Catppuccin.obt"; + "obs-studio/themes/Catppuccin.obt".source = + "${sources.obs}/Catppuccin.obt"; "obs-studio/themes/${themeName}".source = "${sources.obs}/${themeName}"; }; }; diff --git a/modules/home-manager/polybar.nix b/modules/home-manager/polybar.nix index 87dd5ef2..277b3a4a 100644 --- a/modules/home-manager/polybar.nix +++ b/modules/home-manager/polybar.nix @@ -5,17 +5,13 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.polybar; -in -{ - options.catppuccin.polybar = catppuccinLib.mkCatppuccinOption { name = "polybar"; }; +in { + options.catppuccin.polybar = + catppuccinLib.mkCatppuccinOption { name = "polybar"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "services" - "polybar" - "catppuccin" - ]; + from = [ "services" "polybar" "catppuccin" ]; to = "polybar"; }; diff --git a/modules/home-manager/rio.nix b/modules/home-manager/rio.nix index f7f1508f..afe2b103 100644 --- a/modules/home-manager/rio.nix +++ b/modules/home-manager/rio.nix @@ -5,17 +5,12 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.rio; -in -{ +in { options.catppuccin.rio = catppuccinLib.mkCatppuccinOption { name = "rio"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "rio" - "catppuccin" - ]; + from = [ "programs" "rio" "catppuccin" ]; to = "rio"; }; diff --git a/modules/home-manager/rofi.nix b/modules/home-manager/rofi.nix index d2ebb77e..be016ded 100644 --- a/modules/home-manager/rofi.nix +++ b/modules/home-manager/rofi.nix @@ -5,17 +5,12 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.rofi; -in -{ +in { options.catppuccin.rofi = catppuccinLib.mkCatppuccinOption { name = "rofi"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "rofi" - "catppuccin" - ]; + from = [ "programs" "rofi" "catppuccin" ]; to = "rofi"; }; diff --git a/modules/home-manager/skim.nix b/modules/home-manager/skim.nix index 63345ffb..a1d8219a 100644 --- a/modules/home-manager/skim.nix +++ b/modules/home-manager/skim.nix @@ -5,18 +5,14 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.skim; - palette = (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors; -in + palette = + (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors; -{ +in { options.catppuccin.skim = catppuccinLib.mkCatppuccinOption { name = "skim"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "skim" - "catppuccin" - ]; + from = [ "programs" "skim" "catppuccin" ]; to = "skim"; }; diff --git a/modules/home-manager/spotify-player.nix b/modules/home-manager/spotify-player.nix index bd43c20b..a79c218b 100644 --- a/modules/home-manager/spotify-player.nix +++ b/modules/home-manager/spotify-player.nix @@ -5,19 +5,13 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.spotify-player; -in -{ - options.catppuccin.spotify-player = catppuccinLib.mkCatppuccinOption { - name = "spotify-player"; - }; +in { + options.catppuccin.spotify-player = + catppuccinLib.mkCatppuccinOption { name = "spotify-player"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "spotify-player" - "catppuccin" - ]; + from = [ "programs" "spotify-player" "catppuccin" ]; to = "spotify-player"; }; diff --git a/modules/home-manager/starship.nix b/modules/home-manager/starship.nix index 36ed7ecc..d4f8e651 100644 --- a/modules/home-manager/starship.nix +++ b/modules/home-manager/starship.nix @@ -5,17 +5,13 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.starship; -in -{ - options.catppuccin.starship = catppuccinLib.mkCatppuccinOption { name = "starship"; }; +in { + options.catppuccin.starship = + catppuccinLib.mkCatppuccinOption { name = "starship"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "starship" - "catppuccin" - ]; + from = [ "programs" "starship" "catppuccin" ]; to = "starship"; }; diff --git a/modules/home-manager/sway.nix b/modules/home-manager/sway.nix index 969fc451..97b2cf02 100644 --- a/modules/home-manager/sway.nix +++ b/modules/home-manager/sway.nix @@ -6,18 +6,12 @@ let cfg = config.catppuccin.sway; theme = "${sources.sway}/catppuccin-${cfg.flavor}"; -in -{ +in { options.catppuccin.sway = catppuccinLib.mkCatppuccinOption { name = "sway"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "wayland" - "windowManager" - "sway" - "catppuccin" - ]; + from = [ "wayland" "windowManager" "sway" "catppuccin" ]; to = "sway"; }; diff --git a/modules/home-manager/swaylock.nix b/modules/home-manager/swaylock.nix index 288e4b24..31c360f2 100644 --- a/modules/home-manager/swaylock.nix +++ b/modules/home-manager/swaylock.nix @@ -5,26 +5,25 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.swaylock; -in -{ +in { options.catppuccin.swaylock = catppuccinLib.mkCatppuccinOption { name = "swaylock"; - /* - global `catppuccin.enable` purposefully doesn't work here in configurations with a `home.stateVersion` - that is >= 23.05 - this is because the upstream module will automatically enable itself if `programs.swaylock.settings` - is set in configurations with a `home.stateVersion` that is < 23.05. so, we can't use the - `programs.swaylock.enable` option to guard against defining this like we usually do, as when the - upstream `enable` option is unset on these systems it checks that same `settings` option we would be - defining if *our* and the upstream's `enable` option is `true` ...leading to a case of infinite - recursion where `programs.swaylock.settings` is only being defined if `programs.swaylock.settings` is - defined - debugging this was the most confusing and horrifying thing i've had to deal with throughout working on - this project. - - @getchoo + /* global `catppuccin.enable` purposefully doesn't work here in configurations with a `home.stateVersion` + that is >= 23.05 + this is because the upstream module will automatically enable itself if `programs.swaylock.settings` + is set in configurations with a `home.stateVersion` that is < 23.05. so, we can't use the + `programs.swaylock.enable` option to guard against defining this like we usually do, as when the + upstream `enable` option is unset on these systems it checks that same `settings` option we would be + defining if *our* and the upstream's `enable` option is `true` ...leading to a case of infinite + recursion where `programs.swaylock.settings` is only being defined if `programs.swaylock.settings` is + defined + debugging this was the most confusing and horrifying thing i've had to deal with throughout working on + this project. + - @getchoo */ - default = lib.versionAtLeast config.home.stateVersion "23.05" && config.catppuccin.enable; + default = lib.versionAtLeast config.home.stateVersion "23.05" + && config.catppuccin.enable; defaultText = lib.literalExpression '' `catppuccin.enable` if `home.stateVersion` is >= 23.05, false otherwise Yes this is weird, and there's a funny story about it in the code comments @@ -32,17 +31,14 @@ in }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "swaylock" - "catppuccin" - ]; + from = [ "programs" "swaylock" "catppuccin" ]; to = "swaylock"; }; config = lib.mkIf cfg.enable { programs.swaylock = { - settings = catppuccinLib.importINI (sources.swaylock + "/${cfg.flavor}.conf"); + settings = + catppuccinLib.importINI (sources.swaylock + "/${cfg.flavor}.conf"); }; }; } diff --git a/modules/home-manager/tmux.nix b/modules/home-manager/tmux.nix index e3b592e5..a58c6bf9 100644 --- a/modules/home-manager/tmux.nix +++ b/modules/home-manager/tmux.nix @@ -1,64 +1,44 @@ { catppuccinLib }: -{ - config, - lib, - ... -}: +{ config, lib, ... }: -let - cfg = config.catppuccin.tmux; -in +let cfg = config.catppuccin.tmux; -{ - options.catppuccin.tmux = catppuccinLib.mkCatppuccinOption { name = "tmux"; } // { - extraConfig = lib.mkOption { - type = lib.types.lines; - description = "Additional configuration for the catppuccin plugin."; - default = ""; - example = '' - set -g @catppuccin_status_modules_right "application session user host date_time" - ''; +in { + options.catppuccin.tmux = catppuccinLib.mkCatppuccinOption { name = "tmux"; } + // { + extraConfig = lib.mkOption { + type = lib.types.lines; + description = "Additional configuration for the catppuccin plugin."; + default = ""; + example = '' + set -g @catppuccin_status_modules_right "application session user host date_time" + ''; + }; }; - }; - imports = - (catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "tmux" - "catppuccin" - ]; - to = "tmux"; - }) - ++ [ - (lib.mkRenamedOptionModule - [ - "programs" - "tmux" - "catppuccin" - "extraConfig" - ] - [ - "catppuccin" - "tmux" - "extraConfig" - ] - ) - ]; + imports = (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ "programs" "tmux" "catppuccin" ]; + to = "tmux"; + }) ++ [ + (lib.mkRenamedOptionModule [ + "programs" + "tmux" + "catppuccin" + "extraConfig" + ] [ "catppuccin" "tmux" "extraConfig" ]) + ]; config = lib.mkIf cfg.enable { programs.tmux = { - plugins = [ - { - plugin = config.catppuccin.sources.tmux; - extraConfig = lib.concatStrings [ - '' - set -g @catppuccin_flavor '${cfg.flavor}' - '' - cfg.extraConfig - ]; - } - ]; + plugins = [{ + plugin = config.catppuccin.sources.tmux; + extraConfig = lib.concatStrings [ + '' + set -g @catppuccin_flavor '${cfg.flavor}' + '' + cfg.extraConfig + ]; + }]; }; }; } diff --git a/modules/home-manager/tofi.nix b/modules/home-manager/tofi.nix index d3ab6567..0c193f09 100644 --- a/modules/home-manager/tofi.nix +++ b/modules/home-manager/tofi.nix @@ -5,25 +5,18 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.tofi; -in -{ +in { options.catppuccin.tofi = catppuccinLib.mkCatppuccinOption { name = "tofi"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "tofi" - "catppuccin" - ]; + from = [ "programs" "tofi" "catppuccin" ]; to = "tofi"; }; config = lib.mkIf cfg.enable { programs.tofi = { - settings = { - include = sources.tofi + "/catppuccin-${cfg.flavor}"; - }; + settings = { include = sources.tofi + "/catppuccin-${cfg.flavor}"; }; }; }; } diff --git a/modules/home-manager/waybar.nix b/modules/home-manager/waybar.nix index 25818f3b..e826d6a1 100644 --- a/modules/home-manager/waybar.nix +++ b/modules/home-manager/waybar.nix @@ -8,65 +8,44 @@ let enable = cfg.enable && config.programs.waybar.enable; styleFile = "${sources.waybar}/${cfg.flavor}.css"; -in -{ - options.catppuccin.waybar = catppuccinLib.mkCatppuccinOption { name = "waybar"; } // { - mode = lib.mkOption { - type = lib.types.enum [ - "prependImport" - "createLink" - ]; - default = "prependImport"; - description = '' - Defines how to include the catppuccin theme css file: - - - `prependImport`: Prepends the import statement, if `programs.waybar.style` is a string (with default override priority). - - `createLink`: Creates a symbolic link `~/.config/waybar/catppuccin.css`, which needs to be included in the waybar stylesheet. - ''; +in { + options.catppuccin.waybar = + catppuccinLib.mkCatppuccinOption { name = "waybar"; } // { + mode = lib.mkOption { + type = lib.types.enum [ "prependImport" "createLink" ]; + default = "prependImport"; + description = '' + Defines how to include the catppuccin theme css file: + + - `prependImport`: Prepends the import statement, if `programs.waybar.style` is a string (with default override priority). + - `createLink`: Creates a symbolic link `~/.config/waybar/catppuccin.css`, which needs to be included in the waybar stylesheet. + ''; + }; }; - }; - imports = - (catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "waybar" - "catppuccin" - ]; - to = "waybar"; + imports = (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ "programs" "waybar" "catppuccin" ]; + to = "waybar"; + }) ++ [ + (lib.mkRenamedOptionModule [ "programs" "waybar" "catppuccin" "mode" ] [ + "catppuccin" + "waybar" + "mode" + ]) + ]; + + config = lib.mkIf enable (lib.mkMerge [ + (lib.mkIf (cfg.mode == "prependImport") { + programs.waybar = { + style = lib.mkBefore '' + @import "${styleFile}"; + ''; + }; }) - ++ [ - (lib.mkRenamedOptionModule - [ - "programs" - "waybar" - "catppuccin" - "mode" - ] - [ - "catppuccin" - "waybar" - "mode" - ] - ) - ]; - - config = lib.mkIf enable ( - lib.mkMerge [ - (lib.mkIf (cfg.mode == "prependImport") { - programs.waybar = { - style = lib.mkBefore '' - @import "${styleFile}"; - ''; - }; - }) - (lib.mkIf (cfg.mode == "createLink") { - xdg.configFile = { - "waybar/catppuccin.css".source = styleFile; - }; - }) - ] - ); + (lib.mkIf (cfg.mode == "createLink") { + xdg.configFile = { "waybar/catppuccin.css".source = styleFile; }; + }) + ]); } diff --git a/modules/home-manager/wlogout.nix b/modules/home-manager/wlogout.nix index 52e666aa..c43c4d62 100644 --- a/modules/home-manager/wlogout.nix +++ b/modules/home-manager/wlogout.nix @@ -5,60 +5,44 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.wlogout; -in -{ - options.catppuccin.wlogout = - catppuccinLib.mkCatppuccinOption { - name = "wlogout"; - accentSupport = true; - } - // { - iconStyle = lib.mkOption { - type = lib.types.enum [ - "wlogout" - "wleave" - ]; - description = "Icon style to set in ~/.config/wlogout/style.css"; - default = "wlogout"; - example = lib.literalExpression "wleave"; - }; - extraStyle = lib.mkOption { - type = lib.types.lines; - description = "Additional CSS to put in ~/.config/wlogout/style.css"; - default = ""; - example = lib.literalExpression '' - button { - border-radius: 2px; - } +in { + options.catppuccin.wlogout = catppuccinLib.mkCatppuccinOption { + name = "wlogout"; + accentSupport = true; + } // { + iconStyle = lib.mkOption { + type = lib.types.enum [ "wlogout" "wleave" ]; + description = "Icon style to set in ~/.config/wlogout/style.css"; + default = "wlogout"; + example = lib.literalExpression "wleave"; + }; + extraStyle = lib.mkOption { + type = lib.types.lines; + description = "Additional CSS to put in ~/.config/wlogout/style.css"; + default = ""; + example = lib.literalExpression '' + button { + border-radius: 2px; + } - #lock { - background-image: url("''${config.gtk.iconTheme.package}/share/icons/''${config.gtk.iconTheme.name}/apps/scalable/system-lock-screen.svg"); - } - ''; - }; + #lock { + background-image: url("''${config.gtk.iconTheme.package}/share/icons/''${config.gtk.iconTheme.name}/apps/scalable/system-lock-screen.svg"); + } + ''; }; + }; config = lib.mkIf cfg.enable { programs.wlogout.style = lib.concatStrings [ '' @import url("${sources.wlogout}/themes/${cfg.flavor}/${cfg.accent}.css"); '' - (lib.concatMapStrings - (icon: '' - #${icon} { - background-image: url("${sources.wlogout}/icons/${cfg.iconStyle}/${cfg.flavor}/${cfg.accent}/${icon}.svg"); - } - '') - [ - "hibernate" - "lock" - "logout" - "reboot" - "shutdown" - "suspend" - ] - ) + (lib.concatMapStrings (icon: '' + #${icon} { + background-image: url("${sources.wlogout}/icons/${cfg.iconStyle}/${cfg.flavor}/${cfg.accent}/${icon}.svg"); + } + '') [ "hibernate" "lock" "logout" "reboot" "shutdown" "suspend" ]) cfg.extraStyle ]; }; diff --git a/modules/home-manager/yazi.nix b/modules/home-manager/yazi.nix index f877c6c4..d7686a1a 100644 --- a/modules/home-manager/yazi.nix +++ b/modules/home-manager/yazi.nix @@ -6,20 +6,15 @@ let cfg = config.catppuccin.yazi; enable = cfg.enable && config.programs.yazi.enable; -in -{ +in { options.catppuccin.yazi = catppuccinLib.mkCatppuccinOption { name = "yazi"; accentSupport = true; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "yazi" - "catppuccin" - ]; + from = [ "programs" "yazi" "catppuccin" ]; to = "yazi"; accentSupport = true; }; diff --git a/modules/home-manager/zathura.nix b/modules/home-manager/zathura.nix index 277f733a..94405d61 100644 --- a/modules/home-manager/zathura.nix +++ b/modules/home-manager/zathura.nix @@ -5,17 +5,13 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.zathura; -in -{ - options.catppuccin.zathura = catppuccinLib.mkCatppuccinOption { name = "zathura"; }; +in { + options.catppuccin.zathura = + catppuccinLib.mkCatppuccinOption { name = "zathura"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "zathura" - "catppuccin" - ]; + from = [ "programs" "zathura" "catppuccin" ]; to = "zathura"; }; diff --git a/modules/home-manager/zed-editor.nix b/modules/home-manager/zed-editor.nix index 63f9a6da..e217694b 100644 --- a/modules/home-manager/zed-editor.nix +++ b/modules/home-manager/zed-editor.nix @@ -8,40 +8,31 @@ let enable = cfg.enable && config.programs.zed-editor.enable; accent = if cfg.accent == "mauve" then "" else " (${cfg.accent})"; -in -{ - options.catppuccin.zed = - catppuccinLib.mkCatppuccinOption { - name = "zed"; - accentSupport = true; - } - // { - italics = lib.mkEnableOption "the italicized version of theme" // { - default = true; - }; +in { + options.catppuccin.zed = catppuccinLib.mkCatppuccinOption { + name = "zed"; + accentSupport = true; + } // { + italics = lib.mkEnableOption "the italicized version of theme" // { + default = true; }; + }; config = lib.mkIf enable { programs.zed-editor = { userSettings.theme = { - light = - "Catppuccin " - + catppuccinLib.mkUpper cfg.flavor - + accent + light = "Catppuccin " + catppuccinLib.mkUpper cfg.flavor + accent + lib.optionalString (!cfg.italics) " - No Italics"; - dark = - "Catppuccin " - + catppuccinLib.mkUpper cfg.flavor - + accent + dark = "Catppuccin " + catppuccinLib.mkUpper cfg.flavor + accent + lib.optionalString (!cfg.italics) " - No Italics"; }; }; xdg.configFile = { "zed/themes/catppuccin.json".source = "${sources.zed}/catppuccin-${ - lib.optionalString (!cfg.italics) "no-italics-" - }${cfg.accent}.json"; + lib.optionalString (!cfg.italics) "no-italics-" + }${cfg.accent}.json"; }; }; } diff --git a/modules/home-manager/zellij.nix b/modules/home-manager/zellij.nix index 7cf0d166..70ca66e2 100644 --- a/modules/home-manager/zellij.nix +++ b/modules/home-manager/zellij.nix @@ -4,25 +4,17 @@ let cfg = config.catppuccin.zellij; themeName = "catppuccin-${cfg.flavor}"; -in -{ - options.catppuccin.zellij = catppuccinLib.mkCatppuccinOption { name = "zellij"; }; +in { + options.catppuccin.zellij = + catppuccinLib.mkCatppuccinOption { name = "zellij"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "programs" - "zellij" - "catppuccin" - ]; + from = [ "programs" "zellij" "catppuccin" ]; to = "zellij"; }; config = lib.mkIf cfg.enable { - programs.zellij = { - settings = { - theme = themeName; - }; - }; + programs.zellij = { settings = { theme = themeName; }; }; }; } diff --git a/modules/home-manager/zsh-syntax-highlighting.nix b/modules/home-manager/zsh-syntax-highlighting.nix index 06a21b0c..eeb58d36 100644 --- a/modules/home-manager/zsh-syntax-highlighting.nix +++ b/modules/home-manager/zsh-syntax-highlighting.nix @@ -8,13 +8,11 @@ let oldCfg = config.programs.zsh.syntaxHighlighting.catppuccin; isSubmoduleOptionDefined = value: (builtins.tryEval value).success; -in -{ +in { options = { - catppuccin.zsh-syntax-highlighting = catppuccinLib.mkCatppuccinOption { - name = "Zsh Syntax Highlighting"; - }; + catppuccin.zsh-syntax-highlighting = + catppuccinLib.mkCatppuccinOption { name = "Zsh Syntax Highlighting"; }; # `mkRenamedOptionModule` can't rename submodule options to top-level ones # Enter this nonsense diff --git a/modules/lib/default.nix b/modules/lib/default.nix index 84249be3..529dad91 100644 --- a/modules/lib/default.nix +++ b/modules/lib/default.nix @@ -1,42 +1,18 @@ -{ - config, - lib, - pkgs, - ... -}: +{ config, lib, pkgs, ... }: let inherit (lib) - flip - importJSON - mkEnableOption - mkOption - mkRenamedOptionModule - mkSinkUndeclaredOptions - optional - optionalAttrs - stringLength - substring - toUpper - types - versionAtLeast - ; + flip importJSON mkEnableOption mkOption mkRenamedOptionModule + mkSinkUndeclaredOptions optional optionalAttrs stringLength substring + toUpper types versionAtLeast; inherit (lib.modules) importApply; - inherit (pkgs) - runCommand - ; -in + inherit (pkgs) runCommand; -lib.makeExtensible (ctp: { +in lib.makeExtensible (ctp: { types = { - flavor = types.enum [ - "latte" - "frappe" - "macchiato" - "mocha" - ]; + flavor = types.enum [ "latte" "frappe" "macchiato" "mocha" ]; accent = types.enum [ "blue" @@ -56,158 +32,143 @@ lib.makeExtensible (ctp: { ]; }; - /** - Capitalize the first letter in a string + /* * + Capitalize the first letter in a string - # Example + # Example - ```nix - mkUpper "foo" - => "Foo" - ``` + ```nix + mkUpper "foo" + => "Foo" + ``` - # Type + # Type - ``` - mkUpper :: String -> String - ``` + ``` + mkUpper :: String -> String + ``` - # Arguments + # Arguments - - [str] String to capitalize + - [str] String to capitalize */ - mkUpper = str: (toUpper (substring 0 1 str)) + (substring 1 (stringLength str) str); + mkUpper = str: + (toUpper (substring 0 1 str)) + (substring 1 (stringLength str) str); - /** - Reads a YAML file + /* * + Reads a YAML file - # Example + # Example - ```nix - importYAML ./file.yaml - ``` + ```nix + importYAML ./file.yaml + ``` - # Type + # Type - ``` - importYAML :: Path -> Any - ``` + ``` + importYAML :: Path -> Any + ``` - # Arguments + # Arguments - - [path] Path to YAML file + - [path] Path to YAML file */ - importYAML = - path: - importJSON ( - runCommand "converted.json" { nativeBuildInputs = [ pkgs.yj ]; } '' - yj < ${path} > $out - '' - ); + importYAML = path: + importJSON + (runCommand "converted.json" { nativeBuildInputs = [ pkgs.yj ]; } '' + yj < ${path} > $out + ''); - /** - Reads an INI file + /* * + Reads an INI file - # Example + # Example - ```nix - importINI ./file.ini - ``` + ```nix + importINI ./file.ini + ``` - # Type + # Type - ``` - importINI :: Path -> Any - ``` + ``` + importINI :: Path -> Any + ``` - # Arguments + # Arguments - - [path] Path to INI file + - [path] Path to INI file */ - importINI = - path: - importJSON ( - runCommand "converted.json" { nativeBuildInputs = [ pkgs.jc ]; } '' - jc --ini < ${path} > $out - '' - ); + importINI = path: + importJSON + (runCommand "converted.json" { nativeBuildInputs = [ pkgs.jc ]; } '' + jc --ini < ${path} > $out + ''); - /** - Reads a raw INI file + /* * + Reads a raw INI file - # Example + # Example - ```nix - importINIRaw ./file.ini - ``` + ```nix + importINIRaw ./file.ini + ``` - # Type + # Type - ``` - importINIRaw :: Path -> Any - ``` + ``` + importINIRaw :: Path -> Any + ``` - # Arguments + # Arguments - - [path] Path to INI file + - [path] Path to INI file */ - importINIRaw = - path: - importJSON ( - runCommand "converted.json" { nativeBuildInputs = [ pkgs.jc ]; } '' - jc --ini -r < ${path} > $out - '' - ); + importINIRaw = path: + importJSON + (runCommand "converted.json" { nativeBuildInputs = [ pkgs.jc ]; } '' + jc --ini -r < ${path} > $out + ''); - /** - Creates an attribute set of standard Catppuccin module options + /* * + Creates an attribute set of standard Catppuccin module options - # Example + # Example - ``` - mkCatppuccinOption { name = "myProgram"; } - ``` + ``` + mkCatppuccinOption { name = "myProgram"; } + ``` - # Type + # Type - ``` - mkCatppuccinOption :: AttrSet -> AttrSet - ``` + ``` + mkCatppuccinOption :: AttrSet -> AttrSet + ``` - # Arguments + # Arguments - - [name] Name of the module - - [useGlobalEnable] Whether to enable the module by default when `catppuccin.enable` is set (recommended, defaults to `true`) - - [default] Default `enable` option value (defaults to `if useGlobalEnable then config.catppuccin.enable else false`) - - [defaultText] Default `enable` option text (automatic if `null`, defaults to `if useGlobalEnable then "config.catppuccin.enable" else null`) - - [accentSupport] Add an `accent` option (defaults to `false`) + - [name] Name of the module + - [useGlobalEnable] Whether to enable the module by default when `catppuccin.enable` is set (recommended, defaults to `true`) + - [default] Default `enable` option value (defaults to `if useGlobalEnable then config.catppuccin.enable else false`) + - [defaultText] Default `enable` option text (automatic if `null`, defaults to `if useGlobalEnable then "config.catppuccin.enable" else null`) + - [accentSupport] Add an `accent` option (defaults to `false`) */ - mkCatppuccinOption = - { - name, - useGlobalEnable ? true, - default ? if useGlobalEnable then config.catppuccin.enable else false, - defaultText ? if useGlobalEnable then "catppuccin.enable" else null, - accentSupport ? false, - }: + mkCatppuccinOption = { name, useGlobalEnable ? true + , default ? if useGlobalEnable then config.catppuccin.enable else false + , defaultText ? if useGlobalEnable then "catppuccin.enable" else null + , accentSupport ? false, }: { - enable = - mkEnableOption "Catppuccin theme for ${name}" - // ( - { - inherit default; - } - // optionalAttrs (defaultText != null) { inherit defaultText; } - ); + enable = mkEnableOption "Catppuccin theme for ${name}" // ({ + inherit default; + } // optionalAttrs (defaultText != null) { inherit defaultText; }); flavor = mkOption { type = ctp.types.flavor; default = config.catppuccin.flavor; description = "Catppuccin flavor for ${name}"; }; - } - // optionalAttrs accentSupport { + } // optionalAttrs accentSupport { accent = mkOption { type = ctp.types.accent; default = config.catppuccin.accent; @@ -215,190 +176,159 @@ lib.makeExtensible (ctp: { }; }; - /** - Merge the given enum types - See https://nixos.org/manual/nixos/stable/#sec-option-types-custom & https://github.com/NixOS/nixpkgs/pull/363565#issuecomment-2532950341 + /* * + Merge the given enum types + See https://nixos.org/manual/nixos/stable/#sec-option-types-custom & https://github.com/NixOS/nixpkgs/pull/363565#issuecomment-2532950341 - # Example + # Example - ```nix - mergeEnums (lib.types.enum [ 1 2 ]) (lib.types.enum [ 3 4 ]) - => lib.types.enum [ 1 2 3 4 ] - ``` + ```nix + mergeEnums (lib.types.enum [ 1 2 ]) (lib.types.enum [ 3 4 ]) + => lib.types.enum [ 1 2 3 4 ] + ``` - # Type + # Type - ``` - mergeEnums :: Enum -> Enum -> Enum - ``` + ``` + mergeEnums :: Enum -> Enum -> Enum + ``` */ mergeEnums = a: b: a.typeMerge b.functor; - /** - Returns the current release version of nixos or home-manager. - Throws an evaluation error if neither are found + /* * + Returns the current release version of nixos or home-manager. + Throws an evaluation error if neither are found - # Example + # Example - ```nix - getModuleRelease - => "24.11" - ``` + ```nix + getModuleRelease + => "24.11" + ``` - # Type + # Type - ``` - getModuleRelease :: String - ``` + ``` + getModuleRelease :: String + ``` */ getModuleRelease = - config.home.version.release or config.system.nixos.release - or (throw "Couldn't determine release version!"); + config.home.version.release or config.system.nixos.release or (throw + "Couldn't determine release version!"); - /** - Create options only if the current module release is more than a given version + /* * + Create options only if the current module release is more than a given version - # Example + # Example - ```nix - mkVersionedOpts "24.11" { myOption = lib.mkOption { ... }; } - => { myOption = { ... }; } - ``` + ```nix + mkVersionedOpts "24.11" { myOption = lib.mkOption { ... }; } + => { myOption = { ... }; } + ``` - # Type + # Type - ``` - mkVersionedOpts :: String -> AttrSet -> AttrSet - ``` + ``` + mkVersionedOpts :: String -> AttrSet -> AttrSet + ``` - # Arguments + # Arguments - - [minVersion] Minimum module release to create options for - - [options] Conditional options + - [minVersion] Minimum module release to create options for + - [options] Conditional options */ - mkVersionedOpts = - minVersion: options: - if versionAtLeast ctp.getModuleRelease minVersion then options else mkSinkUndeclaredOptions { }; + mkVersionedOpts = minVersion: options: + if versionAtLeast ctp.getModuleRelease minVersion then + options + else + mkSinkUndeclaredOptions { }; - /** - Assert the current module release is >= the given version + /* * + Assert the current module release is >= the given version - # Example + # Example - ```nix - assertMinimumVersion "24.11"; - => { ... } - ``` + ```nix + assertMinimumVersion "24.11"; + => { ... } + ``` - # Type + # Type - ``` - getModuleRelease :: String -> AttrSet - ``` + ``` + getModuleRelease :: String -> AttrSet + ``` - # Arguments + # Arguments - - [version] Minimum version required - ``` + - [version] Minimum version required + ``` */ assertMinimumVersion = version: { assertion = versionAtLeast ctp.getModuleRelease version; - message = "`catppuccin/nix` requires at least version ${version} of NixOS/home-manager"; + message = + "`catppuccin/nix` requires at least version ${version} of NixOS/home-manager"; }; - /** - Imports the given modules with the current library + /* * + Imports the given modules with the current library - # Example + # Example - ```nix - applyToModules [ ./module.nix ] - => [ { ... } ] - ``` + ```nix + applyToModules [ ./module.nix ] + => [ { ... } ] + ``` - # Type + # Type - ``` - applyToModules :: [ Module ] -> [ Module ] - ``` + ``` + applyToModules :: [ Module ] -> [ Module ] + ``` - # Arguments + # Arguments - - [modules] Modules to import - ``` + - [modules] Modules to import + ``` */ applyToModules = map (flip importApply { catppuccinLib = ctp; }); - /** - Apply `mkRenamedOptionModule` to a set of standard Catppuccin module options (like those created by `mkCatppuccinOption`) + /* * + Apply `mkRenamedOptionModule` to a set of standard Catppuccin module options (like those created by `mkCatppuccinOption`) - # Example + # Example - ```nix - mkRenamedCatppuccinOptions { from = [ "myProgram" "catppuccin" ]; to = [ "myProgram" ]; } - => [ { ... } ] - ``` + ```nix + mkRenamedCatppuccinOptions { from = [ "myProgram" "catppuccin" ]; to = [ "myProgram" ]; } + => [ { ... } ] + ``` - # Type + # Type - ``` - mkRenamedCatppuccinOptions :: AttrSet -> [ Module ] - ``` + ``` + mkRenamedCatppuccinOptions :: AttrSet -> [ Module ] + ``` - # Arguments + # Arguments - - [from] Path to original option - - [to] Path to new option (relative to the root `catppuccin` namespace) - - [accentSupport] Whether to alias `accent` options (defaults to false) - ``` + - [from] Path to original option + - [to] Path to new option (relative to the root `catppuccin` namespace) + - [accentSupport] Whether to alias `accent` options (defaults to false) + ``` */ - mkRenamedCatppuccinOptions = - { - from, - to, - accentSupport ? false, - }: + mkRenamedCatppuccinOptions = { from, to, accentSupport ? false, }: [ - (mkRenamedOptionModule - ( - from - ++ [ - "enable" - ] - ) - [ - "catppuccin" - to - "enable" - ] - ) - - (mkRenamedOptionModule - ( - from - ++ [ - "flavor" - ] - ) - [ - "catppuccin" - to - "flavor" - ] - ) - ] - ++ optional accentSupport ( - mkRenamedOptionModule - ( - from - ++ [ - "accent" - ] - ) - [ - "catppuccin" - to - "accent" - ] - ); + (mkRenamedOptionModule (from ++ [ "enable" ]) [ + "catppuccin" + to + "enable" + ]) + + (mkRenamedOptionModule (from ++ [ "flavor" ]) [ + "catppuccin" + to + "flavor" + ]) + ] ++ optional accentSupport + (mkRenamedOptionModule (from ++ [ "accent" ]) [ "catppuccin" to "accent" ]); }) diff --git a/modules/nixos/all-modules.nix b/modules/nixos/all-modules.nix index 5fd61fce..ba71c73a 100644 --- a/modules/nixos/all-modules.nix +++ b/modules/nixos/all-modules.nix @@ -1,7 +1 @@ -[ - ./fcitx5.nix - ./grub.nix - ./plymouth.nix - ./sddm.nix - ./tty.nix -] +[ ./fcitx5.nix ./grub.nix ./plymouth.nix ./sddm.nix ./tty.nix ] diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index a67b800b..e118d1d5 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -2,6 +2,8 @@ { imports = [ - (lib.modules.importApply ../global.nix { catppuccinModules = import ./all-modules.nix; }) + (lib.modules.importApply ../global.nix { + catppuccinModules = import ./all-modules.nix; + }) ]; } diff --git a/modules/nixos/fcitx5.nix b/modules/nixos/fcitx5.nix index 5e589937..b34585c1 100644 --- a/modules/nixos/fcitx5.nix +++ b/modules/nixos/fcitx5.nix @@ -1,27 +1,16 @@ { catppuccinLib }: -{ - config, - lib, - ... -}: +{ config, lib, ... }: -let - cfg = config.catppuccin.fcitx5; -in +let cfg = config.catppuccin.fcitx5; -{ +in { options.catppuccin.fcitx5 = catppuccinLib.mkCatppuccinOption { name = "Fcitx5"; accentSupport = true; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "i18n" - "inputMethod" - "fcitx5" - "catppuccin" - ]; + from = [ "i18n" "inputMethod" "fcitx5" "catppuccin" ]; to = "fcitx5"; accentSupport = true; }; @@ -29,7 +18,8 @@ in config = lib.mkIf cfg.enable { i18n.inputMethod.fcitx5 = { addons = [ config.catppuccin.sources.fcitx5 ]; - settings.addons.classicui.globalSection.Theme = "catppuccin-${cfg.flavor}-${cfg.accent}"; + settings.addons.classicui.globalSection.Theme = + "catppuccin-${cfg.flavor}-${cfg.accent}"; }; }; } diff --git a/modules/nixos/grub.nix b/modules/nixos/grub.nix index 96aacf13..e40a35e0 100644 --- a/modules/nixos/grub.nix +++ b/modules/nixos/grub.nix @@ -1,9 +1,5 @@ { catppuccinLib }: -{ - config, - lib, - ... -}: +{ config, lib, ... }: let inherit (config.catppuccin) sources; @@ -11,19 +7,14 @@ let cfg = config.catppuccin.grub; # TODO @getchoo: upstream this in nixpkgs maybe? idk if they have grub themes - theme = sources.grub + "/share/grub/themes/catppuccin-${cfg.flavor}-grub-theme"; -in + theme = sources.grub + + "/share/grub/themes/catppuccin-${cfg.flavor}-grub-theme"; -{ +in { options.catppuccin.grub = catppuccinLib.mkCatppuccinOption { name = "grub"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "boot" - "loader" - "grub" - "catppuccin" - ]; + from = [ "boot" "loader" "grub" "catppuccin" ]; to = "grub"; }; diff --git a/modules/nixos/plymouth.nix b/modules/nixos/plymouth.nix index 2b1625f6..963b79bf 100644 --- a/modules/nixos/plymouth.nix +++ b/modules/nixos/plymouth.nix @@ -1,23 +1,14 @@ { catppuccinLib }: -{ - config, - lib, - ... -}: +{ config, lib, ... }: -let - cfg = config.catppuccin.plymouth; -in +let cfg = config.catppuccin.plymouth; -{ - options.catppuccin.plymouth = catppuccinLib.mkCatppuccinOption { name = "plymouth"; }; +in { + options.catppuccin.plymouth = + catppuccinLib.mkCatppuccinOption { name = "plymouth"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "boot" - "plymouth" - "catppuccin" - ]; + from = [ "boot" "plymouth" "catppuccin" ]; to = "plymouth"; }; diff --git a/modules/nixos/sddm.nix b/modules/nixos/sddm.nix index 535651d1..10167c3e 100644 --- a/modules/nixos/sddm.nix +++ b/modules/nixos/sddm.nix @@ -1,148 +1,97 @@ { catppuccinLib }: -{ - lib, - pkgs, - config, - ... -}: +{ lib, pkgs, config, ... }: let - inherit (lib) - mkOption - types - ; + inherit (lib) mkOption types; cfg = config.catppuccin.sddm; enable = cfg.enable && config.services.displayManager.sddm.enable; -in - -{ - options.catppuccin.sddm = catppuccinLib.mkCatppuccinOption { name = "sddm"; } // { - font = mkOption { - type = types.str; - default = "Noto Sans"; - description = "Font to use for the login screen"; - }; - fontSize = mkOption { - type = types.str; - default = "9"; - description = "Font size to use for the login screen"; - }; +in { + options.catppuccin.sddm = catppuccinLib.mkCatppuccinOption { name = "sddm"; } + // { + font = mkOption { + type = types.str; + default = "Noto Sans"; + description = "Font to use for the login screen"; + }; - background = mkOption { - type = with types; (either path str); - default = ""; - description = "Background image to use for the login screen"; - }; + fontSize = mkOption { + type = types.str; + default = "9"; + description = "Font size to use for the login screen"; + }; - loginBackground = mkOption { - type = types.bool; - default = true; - description = "Add an additional background layer to the login panel"; - }; + background = mkOption { + type = with types; (either path str); + default = ""; + description = "Background image to use for the login screen"; + }; - assertQt6Sddm = - lib.mkEnableOption '' + loginBackground = mkOption { + type = types.bool; + default = true; + description = "Add an additional background layer to the login panel"; + }; + + assertQt6Sddm = lib.mkEnableOption '' checking if `services.displayManager.sddm.package` is the Qt 6 version. This is to ensure the theme is applied properly, but may have false positives in the case of overridden packages for example - '' - // { + '' // { default = true; }; - }; + }; - imports = - (catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "services" - "displayManager" - "sddm" - "catppuccin" - ]; - to = "sddm"; - }) - ++ [ - (lib.mkRenamedOptionModule - [ - "services" - "displayManager" - "sddm" - "catppuccin" - "font" - ] - [ - "catppuccin" - "sddm" - "font" - ] - ) - - (lib.mkRenamedOptionModule - [ - "services" - "displayManager" - "sddm" - "catppuccin" - "fontSize" - ] - [ - "catppuccin" - "sddm" - "fontSize" - ] - ) - - (lib.mkRenamedOptionModule - [ - "services" - "displayManager" - "sddm" - "catppuccin" - "background" - ] - [ - "catppuccin" - "sddm" - "background" - ] - ) - - (lib.mkRenamedOptionModule - [ - "services" - "displayManager" - "sddm" - "catppuccin" - "loginBackground" - ] - [ - "catppuccin" - "sddm" - "loginBackground" - ] - ) - - (lib.mkRenamedOptionModule - [ - "services" - "displayManager" - "sddm" - "catppuccin" - "assertQt6Sddm" - ] - [ - "catppuccin" - "sddm" - "assertQt6Sddm" - ] - ) - ]; + imports = (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ "services" "displayManager" "sddm" "catppuccin" ]; + to = "sddm"; + }) ++ [ + (lib.mkRenamedOptionModule [ + "services" + "displayManager" + "sddm" + "catppuccin" + "font" + ] [ "catppuccin" "sddm" "font" ]) + + (lib.mkRenamedOptionModule [ + "services" + "displayManager" + "sddm" + "catppuccin" + "fontSize" + ] [ "catppuccin" "sddm" "fontSize" ]) + + (lib.mkRenamedOptionModule [ + "services" + "displayManager" + "sddm" + "catppuccin" + "background" + ] [ "catppuccin" "sddm" "background" ]) + + (lib.mkRenamedOptionModule [ + "services" + "displayManager" + "sddm" + "catppuccin" + "loginBackground" + ] [ "catppuccin" "sddm" "loginBackground" ]) + + (lib.mkRenamedOptionModule [ + "services" + "displayManager" + "sddm" + "catppuccin" + "assertQt6Sddm" + ] [ "catppuccin" "sddm" "assertQt6Sddm" ]) + ]; config = lib.mkIf enable { assertions = lib.optional cfg.assertQt6Sddm { - assertion = config.services.displayManager.sddm.package == pkgs.kdePackages.sddm; + assertion = config.services.displayManager.sddm.package + == pkgs.kdePackages.sddm; message = '' Only the Qt 6 version of SDDM is supported by this port! @@ -153,19 +102,12 @@ in }; services.displayManager = { - sddm = { - theme = "catppuccin-${cfg.flavor}"; - }; + sddm = { theme = "catppuccin-${cfg.flavor}"; }; }; environment.systemPackages = [ (config.catppuccin.sources.sddm.override { - inherit (cfg) - font - fontSize - background - loginBackground - ; + inherit (cfg) font fontSize background loginBackground; }) ]; }; diff --git a/modules/nixos/tty.nix b/modules/nixos/tty.nix index ae3dea96..e707f9f1 100644 --- a/modules/nixos/tty.nix +++ b/modules/nixos/tty.nix @@ -6,17 +6,15 @@ let cfg = config.catppuccin.tty; enable = cfg.enable && config.console.enable; - palette = (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors; -in + palette = + (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors; -{ - options.catppuccin.tty = catppuccinLib.mkCatppuccinOption { name = "console"; }; +in { + options.catppuccin.tty = + catppuccinLib.mkCatppuccinOption { name = "console"; }; imports = catppuccinLib.mkRenamedCatppuccinOptions { - from = [ - "console" - "catppuccin" - ]; + from = [ "console" "catppuccin" ]; to = "tty"; }; diff --git a/modules/tests/darwin.nix b/modules/tests/darwin.nix index b9917868..84cb5319 100644 --- a/modules/tests/darwin.nix +++ b/modules/tests/darwin.nix @@ -1,8 +1,4 @@ -{ - lib, - pkgs, - home-manager, -}: +{ lib, pkgs, home-manager, }: (home-manager.lib.homeManagerConfiguration { inherit pkgs; @@ -10,26 +6,27 @@ modules = [ ./home.nix - ( - { config, ... }: + ({ config, ... }: { - home = { - homeDirectory = "/Users/${config.home.username}"; - }; + home = { homeDirectory = "/Users/${config.home.username}"; }; i18n.inputMethod.enabled = lib.mkVMOverride null; programs = { - cava.enable = lib.mkVMOverride false; # NOTE: this may actually work on darwin, but the package is currently not supported + cava.enable = lib.mkVMOverride + false; # NOTE: this may actually work on darwin, but the package is currently not supported chromium.enable = lib.mkVMOverride false; foot.enable = lib.mkVMOverride false; - freetube.enable = lib.mkVMOverride false; # NOTE: currently fails to build + freetube.enable = + lib.mkVMOverride false; # NOTE: currently fails to build fuzzel.enable = lib.mkVMOverride false; - ghostty.enable = lib.mkVMOverride false; # TODO: Remove when Darwin support is added + ghostty.enable = + lib.mkVMOverride false; # TODO: Remove when Darwin support is added hyprlock.enable = lib.mkVMOverride false; imv.enable = lib.mkVMOverride false; - mpv.enable = lib.mkVMOverride false; # NOTE: same as cava, but `mpv` fails to build currently + mpv.enable = lib.mkVMOverride + false; # NOTE: same as cava, but `mpv` fails to build currently obs-studio.enable = lib.mkVMOverride false; rio.enable = lib.mkVMOverride false; # marked as broken rofi.enable = lib.mkVMOverride false; @@ -52,7 +49,6 @@ hyprland.enable = lib.mkVMOverride false; sway.enable = lib.mkVMOverride false; }; - } - ) + }) ]; }).activationPackage diff --git a/modules/tests/home.nix b/modules/tests/home.nix index fec30a98..a934bbc2 100644 --- a/modules/tests/home.nix +++ b/modules/tests/home.nix @@ -1,10 +1,7 @@ { lib, ... }: { - imports = [ - ../home-manager - ./common.nix - ]; + imports = [ ../home-manager ./common.nix ]; xdg.enable = true; diff --git a/modules/tests/nixos.nix b/modules/tests/nixos.nix index 9358d712..0126a777 100644 --- a/modules/tests/nixos.nix +++ b/modules/tests/nixos.nix @@ -1,25 +1,14 @@ -{ - lib, - testers, - home-manager, -}: +{ lib, testers, home-manager, }: -let - userName = lib.fileContents ./username.txt; -in +let userName = lib.fileContents ./username.txt; -testers.runNixOSTest { +in testers.runNixOSTest { name = "catppuccin-nix"; - nodes.machine = - { pkgs, ... }: + nodes.machine = { pkgs, ... }: { - imports = [ - home-manager.nixosModules.default - ../nixos - ./common.nix - ]; + imports = [ home-manager.nixosModules.default ../nixos ./common.nix ]; boot = { loader.grub.enable = true; @@ -29,7 +18,8 @@ testers.runNixOSTest { services = { displayManager.sddm = { enable = true; - package = pkgs.kdePackages.sddm; # our module/the upstream port requires the qt6 version + package = + pkgs.kdePackages.sddm; # our module/the upstream port requires the qt6 version }; xserver.enable = true; # required for sddm }; @@ -51,19 +41,14 @@ testers.runNixOSTest { writableStore = true; }; - home-manager.users.${userName} = { - imports = [ ./home.nix ]; - }; + home-manager.users.${userName} = { imports = [ ./home.nix ]; }; }; - testScript = - { nodes, ... }: + testScript = { nodes, ... }: - let - user = nodes.machine.users.users.${userName}; - in + let user = nodes.machine.users.users.${userName}; - '' + in '' start_all() with subtest("Wait for startup"): diff --git a/pkgs/buildCatppuccinPort/package.nix b/pkgs/buildCatppuccinPort/package.nix index a59cc245..1736d307 100644 --- a/pkgs/buildCatppuccinPort/package.nix +++ b/pkgs/buildCatppuccinPort/package.nix @@ -1,42 +1,28 @@ -{ - lib, - stdenvNoCC, - catppuccinInstallHook, - fetchCatppuccinPort, - sources, -}: +{ lib, stdenvNoCC, catppuccinInstallHook, fetchCatppuccinPort, sources, }: args: -stdenvNoCC.mkDerivation ( - finalAttrs: +stdenvNoCC.mkDerivation (finalAttrs: - let - args' = if lib.isFunction args then args finalAttrs else args; - in + let args' = if lib.isFunction args then args finalAttrs else args; - args' - // { + in args' // { version = args'.version or (builtins.substring 0 7 finalAttrs.src.rev); - src = - args'.src or sources.${finalAttrs.pname} or (fetchCatppuccinPort { - port = finalAttrs.pname; - inherit (finalAttrs) rev hash; - fetchSubmodules = finalAttrs.fetchSubmodules or false; - }); + src = args'.src or sources.${finalAttrs.pname} or (fetchCatppuccinPort { + port = finalAttrs.pname; + inherit (finalAttrs) rev hash; + fetchSubmodules = finalAttrs.fetchSubmodules or false; + }); - nativeBuildInputs = args'.nativeBuildInputs or [ ] ++ [ catppuccinInstallHook ]; + nativeBuildInputs = args'.nativeBuildInputs or [ ] + ++ [ catppuccinInstallHook ]; meta = { description = "Soothing pastel theme for ${finalAttrs.pname}"; homepage = "https://github.com/catppuccin/${finalAttrs.pname}"; license = lib.licenses.mit; - maintainers = with lib.maintainers; [ - getchoo - isabelroses - ]; + maintainers = with lib.maintainers; [ getchoo isabelroses ]; platform = lib.platforms.all; } // args'.meta or { }; - } -) + }) diff --git a/pkgs/catppuccinInstallHook/package.nix b/pkgs/catppuccinInstallHook/package.nix index c96bd20c..ba57bb51 100644 --- a/pkgs/catppuccinInstallHook/package.nix +++ b/pkgs/catppuccinInstallHook/package.nix @@ -1,5 +1,3 @@ { makeSetupHook }: -makeSetupHook { - name = "catppuccin-install-hook"; -} ./script.sh +makeSetupHook { name = "catppuccin-install-hook"; } ./script.sh diff --git a/pkgs/catwalk/package.nix b/pkgs/catwalk/package.nix index 178fe637..e85acb76 100644 --- a/pkgs/catwalk/package.nix +++ b/pkgs/catwalk/package.nix @@ -1,12 +1,5 @@ -{ - lib, - stdenv, - buildPackages, - fetchCatppuccinPort, - installShellFiles, - nix-update-script, - rustPlatform, -}: +{ lib, stdenv, buildPackages, fetchCatppuccinPort, installShellFiles +, nix-update-script, rustPlatform, }: rustPlatform.buildRustPackage rec { pname = "catwalk"; @@ -22,20 +15,16 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ installShellFiles ]; - postInstall = - let - catwalk = stdenv.hostPlatform.emulator buildPackages + " $out/bin/catwalk"; - in - lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) '' - installShellCompletion --cmd catwalk \ - --bash <(${catwalk} completion bash) \ - --fish <(${catwalk} completion fish) \ - --zsh <(${catwalk} completion zsh) - ''; + postInstall = let + catwalk = stdenv.hostPlatform.emulator buildPackages + " $out/bin/catwalk"; + in lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) '' + installShellCompletion --cmd catwalk \ + --bash <(${catwalk} completion bash) \ + --fish <(${catwalk} completion fish) \ + --zsh <(${catwalk} completion zsh) + ''; - passthru = { - updateScript = nix-update-script { }; - }; + passthru = { updateScript = nix-update-script { }; }; meta = { description = "Soothing pastel previews for the high-spirited!"; diff --git a/pkgs/cursors/package.nix b/pkgs/cursors/package.nix index 11785107..0f1c4e66 100644 --- a/pkgs/cursors/package.nix +++ b/pkgs/cursors/package.nix @@ -1,15 +1,5 @@ -{ - lib, - buildCatppuccinPort, - hyprcursor, - inkscape, - just, - python3, - whiskers, - xcur2png, - xorg, - zip, -}: +{ lib, buildCatppuccinPort, hyprcursor, inkscape, just, python3, whiskers +, xcur2png, xorg, zip, }: buildCatppuccinPort (finalAttrs: { pname = "cursors"; diff --git a/pkgs/delta/package.nix b/pkgs/delta/package.nix index b45d2c29..3e5c754b 100644 --- a/pkgs/delta/package.nix +++ b/pkgs/delta/package.nix @@ -3,8 +3,5 @@ buildCatppuccinPort { pname = "delta"; - installTargets = [ - "catppuccin.gitconfig" - "README.md" - ]; + installTargets = [ "catppuccin.gitconfig" "README.md" ]; } diff --git a/pkgs/fetchCatppuccinPort/package.nix b/pkgs/fetchCatppuccinPort/package.nix index 3743ab5b..296c47eb 100644 --- a/pkgs/fetchCatppuccinPort/package.nix +++ b/pkgs/fetchCatppuccinPort/package.nix @@ -1,23 +1,11 @@ { lib, fetchFromGitHub }: -lib.makeOverridable ( - { - port, - rev, - hash, - ... - }@args: +lib.makeOverridable ({ port, rev, hash, ... }@args: - let - arguments = [ "port" ]; - in + let arguments = [ "port" ]; - fetchFromGitHub ( - { - owner = "catppuccin"; - repo = port; - inherit rev hash; - } - // lib.removeAttrs args arguments - ) -) + in fetchFromGitHub ({ + owner = "catppuccin"; + repo = port; + inherit rev hash; + } // lib.removeAttrs args arguments)) diff --git a/pkgs/gtk/package.nix b/pkgs/gtk/package.nix index ba74a90a..9efb07d9 100644 --- a/pkgs/gtk/package.nix +++ b/pkgs/gtk/package.nix @@ -1,17 +1,6 @@ -{ - lib, - buildCatppuccinPort, - fetchFromGitHub, - git, - gtk3, - python3, - sassc, - accents ? [ "mauve" ], - allAccents ? true, - flavor ? "frappe", - size ? "standard", - tweaks ? [ ], -}: +{ lib, buildCatppuccinPort, fetchFromGitHub, git, gtk3, python3, sassc +, accents ? [ "mauve" ], allAccents ? true, flavor ? "frappe", size ? "standard" +, tweaks ? [ ], }: buildCatppuccinPort (finalAttrs: { pname = "gtk"; @@ -40,25 +29,11 @@ buildCatppuccinPort (finalAttrs: { dontConfigure = true; dontCatppuccinInstall = true; - buildFlags = - [ - flavor - "--dest" - "dist" - ] + buildFlags = [ flavor "--dest" "dist" ] ++ lib.optional allAccents "--all-accents" - ++ lib.optionals (accents != [ ]) [ - "--accent" - (toString accents) - ] - ++ lib.optionals (size != [ ]) [ - "--size" - size - ] - ++ lib.optionals (tweaks != [ ]) [ - "--tweaks" - (toString tweaks) - ]; + ++ lib.optionals (accents != [ ]) [ "--accent" (toString accents) ] + ++ lib.optionals (size != [ ]) [ "--size" size ] + ++ lib.optionals (tweaks != [ ]) [ "--tweaks" (toString tweaks) ]; postBuild = '' python3 build.py $buildFlags diff --git a/pkgs/kvantum/package.nix b/pkgs/kvantum/package.nix index 6e349d3e..06ce53b8 100644 --- a/pkgs/kvantum/package.nix +++ b/pkgs/kvantum/package.nix @@ -1,7 +1,4 @@ -{ - lib, - buildCatppuccinPort, -}: +{ lib, buildCatppuccinPort, }: buildCatppuccinPort (finalAttrs: { pname = "kvantum"; @@ -13,7 +10,5 @@ buildCatppuccinPort (finalAttrs: { mv themes $out/share/Kvantum/ ''; - meta = { - platforms = lib.platforms.linux; - }; + meta = { platforms = lib.platforms.linux; }; }) diff --git a/pkgs/nvim/package.nix b/pkgs/nvim/package.nix index 4ffc55d6..a3c36814 100644 --- a/pkgs/nvim/package.nix +++ b/pkgs/nvim/package.nix @@ -1,14 +1,8 @@ -{ - lib, - vimUtils, - sources, -}: +{ lib, vimUtils, sources, }: -let - portName = "nvim"; -in +let portName = "nvim"; -vimUtils.buildVimPlugin rec { +in vimUtils.buildVimPlugin rec { pname = "catppuccin-nvim"; version = builtins.substring 0 7 src.rev; diff --git a/pkgs/palette/package.nix b/pkgs/palette/package.nix index 36f6b578..3bc30a06 100644 --- a/pkgs/palette/package.nix +++ b/pkgs/palette/package.nix @@ -3,8 +3,5 @@ buildCatppuccinPort { pname = "palette"; - installTargets = [ - "README.md" - "palette.json" - ]; + installTargets = [ "README.md" "palette.json" ]; } diff --git a/pkgs/plymouth/package.nix b/pkgs/plymouth/package.nix index a0d218a5..a1f1fa21 100644 --- a/pkgs/plymouth/package.nix +++ b/pkgs/plymouth/package.nix @@ -1,7 +1,4 @@ -{ - lib, - buildCatppuccinPort, -}: +{ lib, buildCatppuccinPort, }: buildCatppuccinPort (finalAttrs: { pname = "plymouth"; diff --git a/pkgs/sddm/package.nix b/pkgs/sddm/package.nix index daa49e1b..5a36ed99 100644 --- a/pkgs/sddm/package.nix +++ b/pkgs/sddm/package.nix @@ -1,40 +1,25 @@ -{ - lib, - buildCatppuccinPort, - just, - kdePackages, - background ? null, - font ? "Noto Sans", - fontSize ? "9", - loginBackground ? false, -}: +{ lib, buildCatppuccinPort, just, kdePackages, background ? null +, font ? "Noto Sans", fontSize ? "9", loginBackground ? false, }: buildCatppuccinPort (finalAttrs: { pname = "sddm"; - postPatch = - '' - substituteInPlace pertheme/*.conf \ - --replace-fail 'Font="Noto Sans"' 'Font="${font}"' \ - --replace-fail 'FontSize=9' 'FontSize=${toString fontSize}' - '' - + lib.optionalString (background != null) '' - substituteInPlace pertheme/*.conf \ - --replace-fail 'Background="backgrounds/wall.jpg"' 'Background="${background}"' \ - --replace-fail 'CustomBackground="false"' 'CustomBackground="true"' - '' - + lib.optionalString loginBackground '' - substituteInPlace pertheme/*.conf \ - --replace-fail 'LoginBackground="false"' 'LoginBackground="true"' - ''; + postPatch = '' + substituteInPlace pertheme/*.conf \ + --replace-fail 'Font="Noto Sans"' 'Font="${font}"' \ + --replace-fail 'FontSize=9' 'FontSize=${toString fontSize}' + '' + lib.optionalString (background != null) '' + substituteInPlace pertheme/*.conf \ + --replace-fail 'Background="backgrounds/wall.jpg"' 'Background="${background}"' \ + --replace-fail 'CustomBackground="false"' 'CustomBackground="true"' + '' + lib.optionalString loginBackground '' + substituteInPlace pertheme/*.conf \ + --replace-fail 'LoginBackground="false"' 'LoginBackground="true"' + ''; - nativeBuildInputs = [ - just - ]; + nativeBuildInputs = [ just ]; - propagatedBuildInputs = [ - kdePackages.qtsvg - ]; + propagatedBuildInputs = [ kdePackages.qtsvg ]; dontCatppuccinInstall = true; @@ -60,7 +45,5 @@ buildCatppuccinPort (finalAttrs: { echo ${kdePackages.qtsvg} >> $out/nix-support/propagated-user-env-packages ''; - meta = { - platforms = lib.platforms.linux; - }; + meta = { platforms = lib.platforms.linux; }; }) diff --git a/pkgs/spotify-player/package.nix b/pkgs/spotify-player/package.nix index 8068451c..9fe3cd67 100644 --- a/pkgs/spotify-player/package.nix +++ b/pkgs/spotify-player/package.nix @@ -3,8 +3,5 @@ buildCatppuccinPort { pname = "spotify-player"; - installTargets = [ - "theme.toml" - "README.md" - ]; + installTargets = [ "theme.toml" "README.md" ]; } diff --git a/pkgs/tmux/package.nix b/pkgs/tmux/package.nix index 765f1c80..3f382d63 100644 --- a/pkgs/tmux/package.nix +++ b/pkgs/tmux/package.nix @@ -1,14 +1,8 @@ -{ - lib, - sources, - tmuxPlugins, -}: +{ lib, sources, tmuxPlugins, }: -let - portName = "tmux"; -in +let portName = "tmux"; -tmuxPlugins.mkTmuxPlugin rec { +in tmuxPlugins.mkTmuxPlugin rec { pluginName = "catppuccin"; version = builtins.substring 0 7 src.rev; diff --git a/pkgs/whiskers/package.nix b/pkgs/whiskers/package.nix index 2826e28f..11495223 100644 --- a/pkgs/whiskers/package.nix +++ b/pkgs/whiskers/package.nix @@ -1,9 +1,4 @@ -{ - lib, - fetchCatppuccinPort, - nix-update-script, - rustPlatform, -}: +{ lib, fetchCatppuccinPort, nix-update-script, rustPlatform, }: rustPlatform.buildRustPackage rec { pname = "whiskers"; @@ -17,9 +12,7 @@ rustPlatform.buildRustPackage rec { cargoHash = "sha256-ol8qdC+Cf7vG/X/Q7q9UZmxMWL8i49AI8fQLQt5Vw0A="; - passthru = { - updateScript = nix-update-script { }; - }; + passthru = { updateScript = nix-update-script { }; }; meta = { description = "Soothing port creation tool for the high-spirited!"; diff --git a/pkgs/wlogout/package.nix b/pkgs/wlogout/package.nix index ff78365e..93068c8b 100644 --- a/pkgs/wlogout/package.nix +++ b/pkgs/wlogout/package.nix @@ -3,8 +3,5 @@ buildCatppuccinPort { pname = "wlogout"; - installTargets = [ - "themes" - "icons" - ]; + installTargets = [ "themes" "icons" ]; } diff --git a/shell.nix b/shell.nix index 9eb93c30..d38441bc 100644 --- a/shell.nix +++ b/shell.nix @@ -1,11 +1,8 @@ -{ - pkgs ? import { - inherit system; - config = { }; - overlays = [ ]; - }, - system ? builtins.currentSystem, -}: +{ pkgs ? import { + inherit system; + config = { }; + overlays = [ ]; +}, system ? builtins.currentSystem, }: pkgs.mkShellNoCC { packages = [