From 06f0ea19334bcc8112e6d671fd53e61f9e3ad63a Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Wed, 22 Jan 2025 15:54:34 -0500 Subject: [PATCH] fix: use correct nixfmt package (#461) * revert: "style: format 6c244e5" Refs: b5309c13e77b881e70d958108908042dbadc684b. * fix: use correct nixfmt package --- 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, 2012 insertions(+), 1132 deletions(-) diff --git a/default.nix b/default.nix index f5c11065..f76cb8ba 100644 --- a/default.nix +++ b/default.nix @@ -1,31 +1,40 @@ -{ 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; + collected = lib.packagesFromDirectoryRecursive { + callPackage = lib.callPackageWith (pkgs // catppuccinPackages); + directory = ./pkgs; + }; + in + generated // collected; +in -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; @@ -34,8 +43,9 @@ 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 90158d13..9c59b07c 100644 --- a/dev/flake.nix +++ b/dev/flake.nix @@ -43,7 +43,13 @@ }; }; - outputs = { self, nixpkgs, catppuccin, ... }@inputs: + outputs = + { + self, + nixpkgs, + catppuccin, + ... + }@inputs: let inherit (nixpkgs) lib; @@ -57,8 +63,10 @@ "v1.2" = inputs.catppuccin-v1_2; "rolling" = catppuccin; }; + in - in eachDefaultSystem (system: + eachDefaultSystem ( + system: let pkgs = nixpkgs.legacyPackages.${system}; @@ -68,36 +76,48 @@ callWith = pkgs: lib.flip pkgs.callPackage; callUnstable = callWith pkgs { inherit (inputs) home-manager; }; - callStable = - callWith pkgsStable { home-manager = inputs.home-manager-stable; }; + callStable = callWith pkgsStable { home-manager = inputs.home-manager-stable; }; + in - in { - apps = { serve = mkApp' self.packages.${system}.site.serve; }; + { + 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 5eeec72c..0f97bad0 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"}/"; + urlPrefix = "https://github.com/catppuccin/nix/tree/${catppuccin.rev or "main"}/"; +in -in mkMultiSearch { +mkMultiSearch { title = "catppuccin/nix Option Search"; baseHref = "/search/${versionName}/"; diff --git a/docs/mk-site.nix b/docs/mk-site.nix index d716cf50..87a85181 100644 --- a/docs/mk-site.nix +++ b/docs/mk-site.nix @@ -1,9 +1,17 @@ -{ 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; @@ -32,4 +40,5 @@ stdenvNoCC.mkDerivation (finalAttrs: ''; }; }; - }) + } +) diff --git a/docs/package.nix b/docs/package.nix index c79ed7e9..dd5e6fbf 100644 --- a/docs/package.nix +++ b/docs/package.nix @@ -1,57 +1,71 @@ -{ 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 -in mkSite { +mkSite { pname = "catppuccin-nix-site"; version = catppuccin.shortRev or catppuccin.dirtyShortRev or "unknown"; @@ -61,17 +75,19 @@ in 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 c5e441c7..4e30afb7 100644 --- a/flake.nix +++ b/flake.nix @@ -1,9 +1,12 @@ { 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; @@ -13,37 +16,50 @@ # 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 - in { - packages = forAllSystems (system: + { + 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-rfc-style); homeManagerModules.catppuccin = mkModule { type = "homeManager"; diff --git a/modules/global.nix b/modules/global.nix index 6e8339d1..6d72242d 100644 --- a/modules/global.nix +++ b/modules/global.nix @@ -1,10 +1,19 @@ { 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; @@ -24,8 +33,10 @@ 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 = "{ ... }"; @@ -41,9 +52,7 @@ 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 a426c159..83c11f0a 100644 --- a/modules/home-manager/aerc.nix +++ b/modules/home-manager/aerc.nix @@ -5,12 +5,17 @@ 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 9d3be3a9..299e99a9 100644 --- a/modules/home-manager/alacritty.nix +++ b/modules/home-manager/alacritty.nix @@ -4,20 +4,23 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.alacritty; +in -in { - options.catppuccin.alacritty = - catppuccinLib.mkCatppuccinOption { name = "alacritty"; }; +{ + 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 59b7e852..1cda6a17 100644 --- a/modules/home-manager/bat.nix +++ b/modules/home-manager/bat.nix @@ -5,12 +5,17 @@ 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 56a41b57..5089230d 100644 --- a/modules/home-manager/bottom.nix +++ b/modules/home-manager/bottom.nix @@ -4,13 +4,17 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.bottom; +in -in { - options.catppuccin.bottom = - catppuccinLib.mkCatppuccinOption { name = "bottom"; }; +{ + 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 04c97e2e..ce59d9e3 100644 --- a/modules/home-manager/btop.nix +++ b/modules/home-manager/btop.nix @@ -9,18 +9,29 @@ 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 ff6bffb9..5130e12b 100644 --- a/modules/home-manager/cava.nix +++ b/modules/home-manager/cava.nix @@ -6,24 +6,37 @@ let cfg = config.catppuccin.cava; flavor = "${cfg.flavor}" + lib.optionalString cfg.transparent "-transparent"; +in -in { - options.catppuccin.cava = catppuccinLib.mkCatppuccinOption { name = "cava"; } - // { - transparent = lib.mkEnableOption "transparent version of flavor"; - }; +{ + 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 f5f6711a..9af34469 100644 --- a/modules/home-manager/chrome.nix +++ b/modules/home-manager/chrome.nix @@ -12,16 +12,22 @@ 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 f6823398..0994d01d 100644 --- a/modules/home-manager/cursors.nix +++ b/modules/home-manager/cursors.nix @@ -1,5 +1,9 @@ { catppuccinLib }: -{ config, lib, ... }: +{ + config, + lib, + ... +}: let inherit (config.catppuccin) sources; @@ -7,25 +11,35 @@ 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" ]); + cursorAccentType = catppuccinLib.mergeEnums catppuccinLib.types.accent ( + lib.types.enum [ + "dark" + "light" + ] + ); +in -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"; +{ + 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 e118d1d5..a67b800b 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -2,8 +2,6 @@ { 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 2a9d73d7..4ea9f323 100644 --- a/modules/home-manager/delta.nix +++ b/modules/home-manager/delta.nix @@ -6,19 +6,24 @@ let cfg = config.catppuccin.delta; enable = cfg.enable && config.programs.git.delta.enable; +in -in { - options.catppuccin.delta = - catppuccinLib.mkCatppuccinOption { name = "delta"; }; +{ + 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 0511cb67..ad5764bf 100644 --- a/modules/home-manager/dunst.nix +++ b/modules/home-manager/dunst.nix @@ -6,27 +6,41 @@ let cfg = config.catppuccin.dunst; enable = cfg.enable && config.services.dunst.enable; +in -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"; - }; +{ + 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 @@ -36,8 +50,7 @@ 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 b52908b9..5c048d17 100644 --- a/modules/home-manager/fcitx5.nix +++ b/modules/home-manager/fcitx5.nix @@ -6,41 +6,57 @@ let cfg = config.catppuccin.fcitx5; enable = cfg.enable && config.i18n.inputMethod.enabled == "fcitx5"; +in -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`). - ''; +{ + 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 224a860f..d3cc3843 100644 --- a/modules/home-manager/fish.nix +++ b/modules/home-manager/fish.nix @@ -8,18 +8,22 @@ 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 957394b9..16329e49 100644 --- a/modules/home-manager/foot.nix +++ b/modules/home-manager/foot.nix @@ -5,12 +5,17 @@ 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 9d5f6a4e..048c58ae 100644 --- a/modules/home-manager/freetube.nix +++ b/modules/home-manager/freetube.nix @@ -6,34 +6,50 @@ let inherit (config.programs.freetube.settings) baseTheme; cfg = config.catppuccin.freetube; +in -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"; +{ + 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 60279e31..8ed78af3 100644 --- a/modules/home-manager/fuzzel.nix +++ b/modules/home-manager/fuzzel.nix @@ -5,15 +5,20 @@ 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; }; @@ -21,8 +26,7 @@ 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 ab6e2802..88cfc1fc 100644 --- a/modules/home-manager/fzf.nix +++ b/modules/home-manager/fzf.nix @@ -5,8 +5,7 @@ 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 @@ -24,18 +23,27 @@ 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 2e953cdf..31b33b51 100644 --- a/modules/home-manager/gh-dash.nix +++ b/modules/home-manager/gh-dash.nix @@ -5,22 +5,28 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.gh-dash; - theme = - "${sources.gh-dash}/${cfg.flavor}/catppuccin-${cfg.flavor}-${cfg.accent}.yml"; + theme = "${sources.gh-dash}/${cfg.flavor}/catppuccin-${cfg.flavor}-${cfg.accent}.yml"; +in -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 e405d107..20612c14 100644 --- a/modules/home-manager/ghostty.nix +++ b/modules/home-manager/ghostty.nix @@ -7,18 +7,19 @@ 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 48bb1ac9..e16a6bfd 100644 --- a/modules/home-manager/gitui.nix +++ b/modules/home-manager/gitui.nix @@ -5,13 +5,17 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.gitui; +in -in { - options.catppuccin.gitui = - catppuccinLib.mkCatppuccinOption { name = "gitui"; }; +{ + 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 4098fc71..57f468da 100644 --- a/modules/home-manager/glamour.nix +++ b/modules/home-manager/glamour.nix @@ -5,13 +5,17 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.glamour; +in -in { - options.catppuccin.glamour = - catppuccinLib.mkCatppuccinOption { name = "glamour"; }; +{ + 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 a345c0d7..b1fa6ef4 100644 --- a/modules/home-manager/gtk.nix +++ b/modules/home-manager/gtk.nix @@ -1,143 +1,211 @@ { 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 -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"; - }; +{ + options.catppuccin.gtk = + catppuccinLib.mkCatppuccinOption { + name = "gtk"; + useGlobalEnable = false; - tweaks = mkOption { - type = types.listOf (types.enum [ "black" "rimless" "normal" "float" ]); - default = [ ]; - description = "Catppuccin tweaks for gtk"; - }; + 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"; + }; - gnomeShellTheme = mkEnableOption "Catppuccin gtk theme for GNOME Shell"; + gnomeShellTheme = mkEnableOption "Catppuccin gtk theme for GNOME Shell"; - 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; + 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; - accentSupport = true; + accentSupport = true; + }; }; - }; - - 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 cff95813..c0c02852 100644 --- a/modules/home-manager/helix.nix +++ b/modules/home-manager/helix.nix @@ -7,24 +7,37 @@ let cfg = config.catppuccin.helix; enable = cfg.enable && config.programs.helix.enable; subdir = if cfg.useItalics then "default" else "no_italics"; +in -in { - options.catppuccin.helix = - catppuccinLib.mkCatppuccinOption { name = "helix"; } // { - useItalics = lib.mkEnableOption "Italics in Catppuccin theme for Helix"; - }; +{ + 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 429fce25..84deb8f5 100644 --- a/modules/home-manager/hyprland.nix +++ b/modules/home-manager/hyprland.nix @@ -1,19 +1,30 @@ { 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; }; @@ -21,8 +32,7 @@ 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 bdad1cfb..356a0df8 100644 --- a/modules/home-manager/hyprlock.nix +++ b/modules/home-manager/hyprlock.nix @@ -1,19 +1,29 @@ { 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 4a7baf7b..a2b9c0e1 100644 --- a/modules/home-manager/imv.nix +++ b/modules/home-manager/imv.nix @@ -5,19 +5,23 @@ 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 2de65a2b..67c4cd76 100644 --- a/modules/home-manager/k9s.nix +++ b/modules/home-manager/k9s.nix @@ -1,5 +1,10 @@ { catppuccinLib }: -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (config.catppuccin) sources; @@ -11,38 +16,59 @@ 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 -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; - }; +{ + 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.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 15ab1085..430f2e2e 100644 --- a/modules/home-manager/kitty.nix +++ b/modules/home-manager/kitty.nix @@ -1,14 +1,19 @@ { catppuccinLib }: { config, lib, ... }: -let cfg = config.catppuccin.kitty; +let + cfg = config.catppuccin.kitty; +in -in { - options.catppuccin.kitty = - catppuccinLib.mkCatppuccinOption { name = "kitty"; }; +{ + 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 74216b06..9a8de529 100644 --- a/modules/home-manager/kvantum.nix +++ b/modules/home-manager/kvantum.nix @@ -1,57 +1,77 @@ { catppuccinLib }: -{ config, lib, ... }: +{ + config, + lib, + ... +}: let cfg = config.catppuccin.kvantum; enable = cfg.enable && config.qt.enable; themeName = "catppuccin-${cfg.flavor}-${cfg.accent}"; +in -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`). - ''; +{ + 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 1a851053..e9cbceeb 100644 --- a/modules/home-manager/lazygit.nix +++ b/modules/home-manager/lazygit.nix @@ -1,5 +1,10 @@ { catppuccinLib }: -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (config.catppuccin) sources; @@ -11,20 +16,26 @@ 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; }; @@ -32,8 +43,7 @@ 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 00009859..74748415 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 b0660409..36762d81 100644 --- a/modules/home-manager/mako.nix +++ b/modules/home-manager/mako.nix @@ -1,24 +1,35 @@ { 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; }; @@ -29,7 +40,8 @@ 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 248653c1..285a8d4c 100644 --- a/modules/home-manager/micro.nix +++ b/modules/home-manager/micro.nix @@ -7,28 +7,33 @@ let cfg = config.catppuccin.micro; enable = cfg.enable && config.programs.micro.enable; - themePath = "catppuccin-${cfg.flavor}" - + lib.optionalString cfg.transparent "-transparent" + ".micro"; + themePath = + "catppuccin-${cfg.flavor}" + lib.optionalString cfg.transparent "-transparent" + ".micro"; +in -in { - options.catppuccin.micro = - catppuccinLib.mkCatppuccinOption { name = "micro"; } // { - transparent = lib.mkEnableOption "transparent version of flavor"; - }; +{ + 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 c5364999..32b9d8d1 100644 --- a/modules/home-manager/mpv.nix +++ b/modules/home-manager/mpv.nix @@ -5,22 +5,29 @@ 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 51bd6856..390b8d80 100644 --- a/modules/home-manager/neovim.nix +++ b/modules/home-manager/neovim.nix @@ -1,36 +1,47 @@ { catppuccinLib }: -{ config, lib, ... }: +{ + config, + lib, + ... +}: -let cfg = config.catppuccin.nvim; +let + cfg = config.catppuccin.nvim; +in -in { - options.catppuccin.nvim = - catppuccinLib.mkCatppuccinOption { name = "neovim"; }; +{ + 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 51c0967e..7b014c43 100644 --- a/modules/home-manager/newsboat.nix +++ b/modules/home-manager/newsboat.nix @@ -6,13 +6,17 @@ let cfg = config.catppuccin.newsboat; theme = if cfg.flavor == "latte" then "latte" else "dark"; +in -in { - options.catppuccin.newsboat = - catppuccinLib.mkCatppuccinOption { name = "newsboat"; }; +{ + 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 6480ef9a..7f55c046 100644 --- a/modules/home-manager/obs.nix +++ b/modules/home-manager/obs.nix @@ -8,20 +8,23 @@ let enable = cfg.enable && config.programs.obs-studio.enable; themeName = "Catppuccin_${catppuccinLib.mkUpper cfg.flavor}.ovt"; +in -in { - options.catppuccin.obs = - catppuccinLib.mkCatppuccinOption { name = "obs-studio"; }; +{ + 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 277b3a4a..87dd5ef2 100644 --- a/modules/home-manager/polybar.nix +++ b/modules/home-manager/polybar.nix @@ -5,13 +5,17 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.polybar; +in -in { - options.catppuccin.polybar = - catppuccinLib.mkCatppuccinOption { name = "polybar"; }; +{ + 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 afe2b103..f7f1508f 100644 --- a/modules/home-manager/rio.nix +++ b/modules/home-manager/rio.nix @@ -5,12 +5,17 @@ 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 be016ded..d2ebb77e 100644 --- a/modules/home-manager/rofi.nix +++ b/modules/home-manager/rofi.nix @@ -5,12 +5,17 @@ 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 a1d8219a..63345ffb 100644 --- a/modules/home-manager/skim.nix +++ b/modules/home-manager/skim.nix @@ -5,14 +5,18 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.skim; - palette = - (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors; + palette = (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors; +in -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 a79c218b..bd43c20b 100644 --- a/modules/home-manager/spotify-player.nix +++ b/modules/home-manager/spotify-player.nix @@ -5,13 +5,19 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.spotify-player; +in -in { - options.catppuccin.spotify-player = - catppuccinLib.mkCatppuccinOption { name = "spotify-player"; }; +{ + 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 d4f8e651..36ed7ecc 100644 --- a/modules/home-manager/starship.nix +++ b/modules/home-manager/starship.nix @@ -5,13 +5,17 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.starship; +in -in { - options.catppuccin.starship = - catppuccinLib.mkCatppuccinOption { name = "starship"; }; +{ + 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 97b2cf02..969fc451 100644 --- a/modules/home-manager/sway.nix +++ b/modules/home-manager/sway.nix @@ -6,12 +6,18 @@ 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 31c360f2..288e4b24 100644 --- a/modules/home-manager/swaylock.nix +++ b/modules/home-manager/swaylock.nix @@ -5,25 +5,26 @@ 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 @@ -31,14 +32,17 @@ 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 a58c6bf9..e3b592e5 100644 --- a/modules/home-manager/tmux.nix +++ b/modules/home-manager/tmux.nix @@ -1,44 +1,64 @@ { catppuccinLib }: -{ config, lib, ... }: +{ + config, + lib, + ... +}: -let cfg = config.catppuccin.tmux; +let + cfg = config.catppuccin.tmux; +in -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" - ''; - }; +{ + 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 0c193f09..d3ab6567 100644 --- a/modules/home-manager/tofi.nix +++ b/modules/home-manager/tofi.nix @@ -5,18 +5,25 @@ 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 e826d6a1..25818f3b 100644 --- a/modules/home-manager/waybar.nix +++ b/modules/home-manager/waybar.nix @@ -8,44 +8,65 @@ let enable = cfg.enable && config.programs.waybar.enable; styleFile = "${sources.waybar}/${cfg.flavor}.css"; +in -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. - ''; - }; +{ + 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"; - }) ++ [ - (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}"; - ''; - }; + imports = + (catppuccinLib.mkRenamedCatppuccinOptions { + from = [ + "programs" + "waybar" + "catppuccin" + ]; + to = "waybar"; }) + ++ [ + (lib.mkRenamedOptionModule + [ + "programs" + "waybar" + "catppuccin" + "mode" + ] + [ + "catppuccin" + "waybar" + "mode" + ] + ) + ]; - (lib.mkIf (cfg.mode == "createLink") { - xdg.configFile = { "waybar/catppuccin.css".source = styleFile; }; - }) - ]); + 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; + }; + }) + ] + ); } diff --git a/modules/home-manager/wlogout.nix b/modules/home-manager/wlogout.nix index c43c4d62..52e666aa 100644 --- a/modules/home-manager/wlogout.nix +++ b/modules/home-manager/wlogout.nix @@ -5,44 +5,60 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.wlogout; +in -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; - } +{ + 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 d7686a1a..f877c6c4 100644 --- a/modules/home-manager/yazi.nix +++ b/modules/home-manager/yazi.nix @@ -6,15 +6,20 @@ 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 94405d61..277f733a 100644 --- a/modules/home-manager/zathura.nix +++ b/modules/home-manager/zathura.nix @@ -5,13 +5,17 @@ let inherit (config.catppuccin) sources; cfg = config.catppuccin.zathura; +in -in { - options.catppuccin.zathura = - catppuccinLib.mkCatppuccinOption { name = "zathura"; }; +{ + 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 e217694b..63f9a6da 100644 --- a/modules/home-manager/zed-editor.nix +++ b/modules/home-manager/zed-editor.nix @@ -8,31 +8,40 @@ let enable = cfg.enable && config.programs.zed-editor.enable; accent = if cfg.accent == "mauve" then "" else " (${cfg.accent})"; +in -in { - options.catppuccin.zed = catppuccinLib.mkCatppuccinOption { - name = "zed"; - accentSupport = true; - } // { - italics = lib.mkEnableOption "the italicized version of theme" // { - default = true; +{ + 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 70ca66e2..7cf0d166 100644 --- a/modules/home-manager/zellij.nix +++ b/modules/home-manager/zellij.nix @@ -4,17 +4,25 @@ let cfg = config.catppuccin.zellij; themeName = "catppuccin-${cfg.flavor}"; +in -in { - options.catppuccin.zellij = - catppuccinLib.mkCatppuccinOption { name = "zellij"; }; +{ + 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 eeb58d36..06a21b0c 100644 --- a/modules/home-manager/zsh-syntax-highlighting.nix +++ b/modules/home-manager/zsh-syntax-highlighting.nix @@ -8,11 +8,13 @@ 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 529dad91..84249be3 100644 --- a/modules/lib/default.nix +++ b/modules/lib/default.nix @@ -1,18 +1,42 @@ -{ 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; + inherit (pkgs) + runCommand + ; +in -in lib.makeExtensible (ctp: { +lib.makeExtensible (ctp: { types = { - flavor = types.enum [ "latte" "frappe" "macchiato" "mocha" ]; + flavor = types.enum [ + "latte" + "frappe" + "macchiato" + "mocha" + ]; accent = types.enum [ "blue" @@ -32,143 +56,158 @@ in 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; @@ -176,159 +215,190 @@ in 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 ba71c73a..5fd61fce 100644 --- a/modules/nixos/all-modules.nix +++ b/modules/nixos/all-modules.nix @@ -1 +1,7 @@ -[ ./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 e118d1d5..a67b800b 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -2,8 +2,6 @@ { 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 b34585c1..5e589937 100644 --- a/modules/nixos/fcitx5.nix +++ b/modules/nixos/fcitx5.nix @@ -1,16 +1,27 @@ { catppuccinLib }: -{ config, lib, ... }: +{ + config, + lib, + ... +}: -let cfg = config.catppuccin.fcitx5; +let + cfg = config.catppuccin.fcitx5; +in -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; }; @@ -18,8 +29,7 @@ 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 e40a35e0..96aacf13 100644 --- a/modules/nixos/grub.nix +++ b/modules/nixos/grub.nix @@ -1,5 +1,9 @@ { catppuccinLib }: -{ config, lib, ... }: +{ + config, + lib, + ... +}: let inherit (config.catppuccin) sources; @@ -7,14 +11,19 @@ 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"; + theme = sources.grub + "/share/grub/themes/catppuccin-${cfg.flavor}-grub-theme"; +in -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 963b79bf..2b1625f6 100644 --- a/modules/nixos/plymouth.nix +++ b/modules/nixos/plymouth.nix @@ -1,14 +1,23 @@ { catppuccinLib }: -{ config, lib, ... }: +{ + config, + lib, + ... +}: -let cfg = config.catppuccin.plymouth; +let + cfg = config.catppuccin.plymouth; +in -in { - options.catppuccin.plymouth = - catppuccinLib.mkCatppuccinOption { name = "plymouth"; }; +{ + 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 10167c3e..535651d1 100644 --- a/modules/nixos/sddm.nix +++ b/modules/nixos/sddm.nix @@ -1,97 +1,148 @@ { 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"; + }; -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"; - }; + fontSize = mkOption { + type = types.str; + default = "9"; + description = "Font size to use for the login screen"; + }; - background = mkOption { - type = with types; (either path str); - default = ""; - description = "Background image to use for the login screen"; - }; + background = mkOption { + type = with types; (either path str); + default = ""; + description = "Background image to use for the login screen"; + }; - loginBackground = mkOption { - type = types.bool; - default = true; - description = "Add an additional background layer to the login panel"; - }; + loginBackground = mkOption { + type = types.bool; + default = true; + description = "Add an additional background layer to the login panel"; + }; - assertQt6Sddm = lib.mkEnableOption '' + 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! @@ -102,12 +153,19 @@ 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 e707f9f1..ae3dea96 100644 --- a/modules/nixos/tty.nix +++ b/modules/nixos/tty.nix @@ -6,15 +6,17 @@ let cfg = config.catppuccin.tty; enable = cfg.enable && config.console.enable; - palette = - (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors; + palette = (lib.importJSON "${sources.palette}/palette.json").${cfg.flavor}.colors; +in -in { - options.catppuccin.tty = - catppuccinLib.mkCatppuccinOption { name = "console"; }; +{ + 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 84cb5319..b9917868 100644 --- a/modules/tests/darwin.nix +++ b/modules/tests/darwin.nix @@ -1,4 +1,8 @@ -{ lib, pkgs, home-manager, }: +{ + lib, + pkgs, + home-manager, +}: (home-manager.lib.homeManagerConfiguration { inherit pkgs; @@ -6,27 +10,26 @@ 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; @@ -49,6 +52,7 @@ hyprland.enable = lib.mkVMOverride false; sway.enable = lib.mkVMOverride false; }; - }) + } + ) ]; }).activationPackage diff --git a/modules/tests/home.nix b/modules/tests/home.nix index a934bbc2..fec30a98 100644 --- a/modules/tests/home.nix +++ b/modules/tests/home.nix @@ -1,7 +1,10 @@ { 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 0126a777..9358d712 100644 --- a/modules/tests/nixos.nix +++ b/modules/tests/nixos.nix @@ -1,14 +1,25 @@ -{ lib, testers, home-manager, }: +{ + lib, + testers, + home-manager, +}: -let userName = lib.fileContents ./username.txt; +let + userName = lib.fileContents ./username.txt; +in -in testers.runNixOSTest { +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; @@ -18,8 +29,7 @@ in 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 }; @@ -41,14 +51,19 @@ in 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}; + let + user = nodes.machine.users.users.${userName}; + in - in '' + '' start_all() with subtest("Wait for startup"): diff --git a/pkgs/buildCatppuccinPort/package.nix b/pkgs/buildCatppuccinPort/package.nix index 1736d307..a59cc245 100644 --- a/pkgs/buildCatppuccinPort/package.nix +++ b/pkgs/buildCatppuccinPort/package.nix @@ -1,28 +1,42 @@ -{ 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; + let + args' = if lib.isFunction args then args finalAttrs else args; + in - in args' // { + 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 ba57bb51..c96bd20c 100644 --- a/pkgs/catppuccinInstallHook/package.nix +++ b/pkgs/catppuccinInstallHook/package.nix @@ -1,3 +1,5 @@ { 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 e85acb76..178fe637 100644 --- a/pkgs/catwalk/package.nix +++ b/pkgs/catwalk/package.nix @@ -1,5 +1,12 @@ -{ lib, stdenv, buildPackages, fetchCatppuccinPort, installShellFiles -, nix-update-script, rustPlatform, }: +{ + lib, + stdenv, + buildPackages, + fetchCatppuccinPort, + installShellFiles, + nix-update-script, + rustPlatform, +}: rustPlatform.buildRustPackage rec { pname = "catwalk"; @@ -15,16 +22,20 @@ 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 0f1c4e66..11785107 100644 --- a/pkgs/cursors/package.nix +++ b/pkgs/cursors/package.nix @@ -1,5 +1,15 @@ -{ 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 3e5c754b..b45d2c29 100644 --- a/pkgs/delta/package.nix +++ b/pkgs/delta/package.nix @@ -3,5 +3,8 @@ 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 296c47eb..3743ab5b 100644 --- a/pkgs/fetchCatppuccinPort/package.nix +++ b/pkgs/fetchCatppuccinPort/package.nix @@ -1,11 +1,23 @@ { lib, fetchFromGitHub }: -lib.makeOverridable ({ port, rev, hash, ... }@args: +lib.makeOverridable ( + { + port, + rev, + hash, + ... + }@args: - let arguments = [ "port" ]; + let + arguments = [ "port" ]; + in - in fetchFromGitHub ({ - owner = "catppuccin"; - repo = port; - inherit rev hash; - } // lib.removeAttrs args arguments)) + 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 9efb07d9..ba74a90a 100644 --- a/pkgs/gtk/package.nix +++ b/pkgs/gtk/package.nix @@ -1,6 +1,17 @@ -{ 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"; @@ -29,11 +40,25 @@ 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 06ce53b8..6e349d3e 100644 --- a/pkgs/kvantum/package.nix +++ b/pkgs/kvantum/package.nix @@ -1,4 +1,7 @@ -{ lib, buildCatppuccinPort, }: +{ + lib, + buildCatppuccinPort, +}: buildCatppuccinPort (finalAttrs: { pname = "kvantum"; @@ -10,5 +13,7 @@ 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 a3c36814..4ffc55d6 100644 --- a/pkgs/nvim/package.nix +++ b/pkgs/nvim/package.nix @@ -1,8 +1,14 @@ -{ lib, vimUtils, sources, }: +{ + lib, + vimUtils, + sources, +}: -let portName = "nvim"; +let + portName = "nvim"; +in -in vimUtils.buildVimPlugin rec { +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 3bc30a06..36f6b578 100644 --- a/pkgs/palette/package.nix +++ b/pkgs/palette/package.nix @@ -3,5 +3,8 @@ 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 a1f1fa21..a0d218a5 100644 --- a/pkgs/plymouth/package.nix +++ b/pkgs/plymouth/package.nix @@ -1,4 +1,7 @@ -{ lib, buildCatppuccinPort, }: +{ + lib, + buildCatppuccinPort, +}: buildCatppuccinPort (finalAttrs: { pname = "plymouth"; diff --git a/pkgs/sddm/package.nix b/pkgs/sddm/package.nix index 5a36ed99..daa49e1b 100644 --- a/pkgs/sddm/package.nix +++ b/pkgs/sddm/package.nix @@ -1,25 +1,40 @@ -{ 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; @@ -45,5 +60,7 @@ 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 9fe3cd67..8068451c 100644 --- a/pkgs/spotify-player/package.nix +++ b/pkgs/spotify-player/package.nix @@ -3,5 +3,8 @@ 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 3f382d63..765f1c80 100644 --- a/pkgs/tmux/package.nix +++ b/pkgs/tmux/package.nix @@ -1,8 +1,14 @@ -{ lib, sources, tmuxPlugins, }: +{ + lib, + sources, + tmuxPlugins, +}: -let portName = "tmux"; +let + portName = "tmux"; +in -in tmuxPlugins.mkTmuxPlugin rec { +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 11495223..2826e28f 100644 --- a/pkgs/whiskers/package.nix +++ b/pkgs/whiskers/package.nix @@ -1,4 +1,9 @@ -{ lib, fetchCatppuccinPort, nix-update-script, rustPlatform, }: +{ + lib, + fetchCatppuccinPort, + nix-update-script, + rustPlatform, +}: rustPlatform.buildRustPackage rec { pname = "whiskers"; @@ -12,7 +17,9 @@ 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 93068c8b..ff78365e 100644 --- a/pkgs/wlogout/package.nix +++ b/pkgs/wlogout/package.nix @@ -3,5 +3,8 @@ buildCatppuccinPort { pname = "wlogout"; - installTargets = [ "themes" "icons" ]; + installTargets = [ + "themes" + "icons" + ]; } diff --git a/shell.nix b/shell.nix index d38441bc..9eb93c30 100644 --- a/shell.nix +++ b/shell.nix @@ -1,8 +1,11 @@ -{ pkgs ? import { - inherit system; - config = { }; - overlays = [ ]; -}, system ? builtins.currentSystem, }: +{ + pkgs ? import { + inherit system; + config = { }; + overlays = [ ]; + }, + system ? builtins.currentSystem, +}: pkgs.mkShellNoCC { packages = [