From 2017a7f7a988983047318a6a8781c5c05eb77635 Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 30 Jul 2023 00:29:25 -0400 Subject: [PATCH 01/17] feat(modules): remove unnecessary IFD by moving all upstream repos to our flake inputs, we no longer need to have [IFD](https://nixos.wiki/wiki/Import_From_Derivation) in most of our modules - making evaluation faster for all configurations. the only remaining instances of IFD are in `lib.ctp.toYAML` and the themes for kitty, which is due to it's use upstream in home-manager --- flake.lock | 172 ++++++++++++++++++++++++++++- flake.nix | 99 ++++++++--------- modules/home-manager/alacritty.nix | 11 +- modules/home-manager/bat.nix | 23 ++-- modules/home-manager/bottom.nix | 11 +- modules/home-manager/btop.nix | 15 +-- modules/home-manager/default.nix | 14 +-- modules/home-manager/glamour.nix | 2 +- modules/home-manager/helix.nix | 12 +- modules/home-manager/lazygit.nix | 11 +- modules/home-manager/polybar.nix | 12 +- modules/home-manager/starship.nix | 12 +- modules/home-manager/sway.nix | 12 +- modules/home-manager/tmux.nix | 11 +- modules/lib/default.nix | 4 +- modules/nixos/default.nix | 6 +- modules/nixos/grub.nix | 14 +-- outputs.nix | 55 +++++++++ 18 files changed, 321 insertions(+), 175 deletions(-) create mode 100644 outputs.nix diff --git a/flake.lock b/flake.lock index 9f825d3b..1f6e4c4a 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,69 @@ { "nodes": { + "alacritty": { + "flake": false, + "locked": { + "lastModified": 1664239314, + "narHash": "sha256-w9XVtEe7TqzxxGUCDUR9BFkzLZjG8XrplXJ3lX6f+x0=", + "owner": "catppuccin", + "repo": "alacritty", + "rev": "3c808cbb4f9c87be43ba5241bc57373c793d2f17", + "type": "github" + }, + "original": { + "owner": "catppuccin", + "repo": "alacritty", + "type": "github" + } + }, + "bat": { + "flake": false, + "locked": { + "lastModified": 1668065083, + "narHash": "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw=", + "owner": "catppuccin", + "repo": "bat", + "rev": "ba4d16880d63e656acced2b7d4e034e4a93f74b1", + "type": "github" + }, + "original": { + "owner": "catppuccin", + "repo": "bat", + "type": "github" + } + }, + "bottom": { + "flake": false, + "locked": { + "lastModified": 1672359880, + "narHash": "sha256-VaHX2I/Gn82wJWzybpWNqU3dPi3206xItOlt0iF6VVQ=", + "owner": "catppuccin", + "repo": "bottom", + "rev": "c0efe9025f62f618a407999d89b04a231ba99c92", + "type": "github" + }, + "original": { + "owner": "catppuccin", + "repo": "bottom", + "type": "github" + } + }, + "btop": { + "flake": false, + "locked": { + "lastModified": 1686163899, + "narHash": "sha256-J3UezOQMDdxpflGax0rGBF/XMiKqdqZXuX4KMVGTxFk=", + "owner": "catppuccin", + "repo": "btop", + "rev": "89ff712eb62747491a76a7902c475007244ff202", + "type": "github" + }, + "original": { + "owner": "catppuccin", + "repo": "btop", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -16,6 +80,54 @@ "type": "github" } }, + "grub": { + "flake": false, + "locked": { + "lastModified": 1672329233, + "narHash": "sha256-/bSolCta8GCZ4lP0u5NVqYQ9Y3ZooYCNdTwORNvR7M0=", + "owner": "catppuccin", + "repo": "grub", + "rev": "803c5df0e83aba61668777bb96d90ab8f6847106", + "type": "github" + }, + "original": { + "owner": "catppuccin", + "repo": "grub", + "type": "github" + } + }, + "helix": { + "flake": false, + "locked": { + "lastModified": 1680791535, + "narHash": "sha256-aa8KZ7/1TXcBqaV/TYOZ8rpusOf5QeQ9i2Upnncbziw=", + "owner": "catppuccin", + "repo": "helix", + "rev": "5677c16dc95297a804caea9161072ff174018fdd", + "type": "github" + }, + "original": { + "owner": "catppuccin", + "repo": "helix", + "type": "github" + } + }, + "lazygit": { + "flake": false, + "locked": { + "lastModified": 1683041570, + "narHash": "sha256-9BBmWRcjNaJE9T0RKVEJaSnkrbMom0CLYE8PzAT6yFw=", + "owner": "catppuccin", + "repo": "lazygit", + "rev": "b2ecb6d41b6f54a82104879573c538e8bdaeb0bf", + "type": "github" + }, + "original": { + "owner": "catppuccin", + "repo": "lazygit", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1685655444, @@ -31,10 +143,68 @@ "type": "indirect" } }, + "polybar": { + "flake": false, + "locked": { + "lastModified": 1664945864, + "narHash": "sha256-bUbSgMg/sa2faeEUZo80GNmhOX3wn2jLzfA9neF8ERA=", + "owner": "catppuccin", + "repo": "polybar", + "rev": "9ee66f83335404186ce979bac32fcf3cd047396a", + "type": "github" + }, + "original": { + "owner": "catppuccin", + "repo": "polybar", + "type": "github" + } + }, "root": { "inputs": { + "alacritty": "alacritty", + "bat": "bat", + "bottom": "bottom", + "btop": "btop", "flake-compat": "flake-compat", - "nixpkgs": "nixpkgs" + "grub": "grub", + "helix": "helix", + "lazygit": "lazygit", + "nixpkgs": "nixpkgs", + "polybar": "polybar", + "starship": "starship", + "sway": "sway" + } + }, + "starship": { + "flake": false, + "locked": { + "lastModified": 1689246850, + "narHash": "sha256-nsRuxQFKbQkyEI4TXgvAjcroVdG+heKX5Pauq/4Ota0=", + "owner": "catppuccin", + "repo": "starship", + "rev": "5629d2356f62a9f2f8efad3ff37476c19969bd4f", + "type": "github" + }, + "original": { + "owner": "catppuccin", + "repo": "starship", + "type": "github" + } + }, + "sway": { + "flake": false, + "locked": { + "lastModified": 1677157164, + "narHash": "sha256-6Cvsmdl3OILz1vZovyBIuuSpm207I3W0dmUGowR9Ugk=", + "owner": "catppuccin", + "repo": "sway", + "rev": "c89098fc3517b64f0422aaaccb98dcab6ae9348f", + "type": "github" + }, + "original": { + "owner": "catppuccin", + "repo": "sway", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 2e6fd98f..7660c190 100644 --- a/flake.nix +++ b/flake.nix @@ -6,62 +6,51 @@ url = "github:edolstra/flake-compat"; flake = false; }; - }; - - outputs = { self, nixpkgs, ... }: - let - systems = [ - "x86_64-linux" - "aarch64-linux" - "x86_64-darwin" - "aarch64-darwin" - ]; - - inherit (nixpkgs) lib; - - forAllSystems = fn: lib.genAttrs systems (s: fn nixpkgsFor.${s}); - nixpkgsFor = lib.genAttrs systems (system: import nixpkgs { inherit system; }); - in - { - formatter = forAllSystems (pkgs: pkgs.nixpkgs-fmt); - - homeManagerModules.catppuccin = import ./modules/home-manager nixpkgs; - - nixosModules.catppuccin = import ./modules/nixos nixpkgs; - - packages = forAllSystems (pkgs: - let - mkEval = module: lib.evalModules { - modules = [ - module - { - _module = { - check = false; - args.lib = import ./modules/lib/mkExtLib.nix lib; - }; - } - ]; - }; - mkDoc = name: options: - let - doc = pkgs.nixosOptionsDoc { - options = lib.filterAttrs (n: _: n != "_module") options; - documentType = "none"; - revision = if self ? rev then builtins.substring 0 7 self.rev else "dirty"; - }; - in - pkgs.runCommand "${name}-module-doc.md" { } '' - cat ${doc.optionsCommonMark} > $out - ''; + # home-manager + alacritty = { + url = "github:catppuccin/alacritty"; + flake = false; + }; + bat = { + url = "github:catppuccin/bat"; + flake = false; + }; + bottom = { + url = "github:catppuccin/bottom"; + flake = false; + }; + btop = { + url = "github:catppuccin/btop"; + flake = false; + }; + helix = { + url = "github:catppuccin/helix"; + flake = false; + }; + lazygit = { + url = "github:catppuccin/lazygit"; + flake = false; + }; + polybar = { + url = "github:catppuccin/polybar"; + flake = false; + }; + starship = { + url = "github:catppuccin/starship"; + flake = false; + }; + sway = { + url = "github:catppuccin/sway"; + flake = false; + }; - hmEval = mkEval self.homeManagerModules.catppuccin; - nixosEval = mkEval self.nixosModules.catppuccin; - in - rec { - nixos-doc = mkDoc "nixos" nixosEval.options; - home-manager-doc = mkDoc "home-manager" hmEval.options; - default = home-manager-doc; - }); + # nixos + grub = { + url = "github:catppuccin/grub"; + flake = false; }; + }; + + outputs = inputs: (import ./outputs.nix inputs); # yes these parantheseis are unneeded, but i wanted to get around a statix warning } diff --git a/modules/home-manager/alacritty.nix b/modules/home-manager/alacritty.nix index 25007567..aa007650 100644 --- a/modules/home-manager/alacritty.nix +++ b/modules/home-manager/alacritty.nix @@ -1,6 +1,7 @@ { config , pkgs , lib +, inputs , ... }: let @@ -14,15 +15,7 @@ in config.programs.alacritty.settings = let - file = - pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "alacritty"; - rev = "3c808cbb4f9c87be43ba5241bc57373c793d2f17"; - sha256 = "sha256-w9XVtEe7TqzxxGUCDUR9BFkzLZjG8XrplXJ3lX6f+x0="; - } - + "/catppuccin-${cfg.flavour}.yml"; + file = "${inputs.alacritty}/catppuccin-${cfg.flavour}.yml"; in lib.mkIf enable (ctp.fromYaml pkgs file); } diff --git a/modules/home-manager/bat.nix b/modules/home-manager/bat.nix index c775aa6e..17fa479c 100644 --- a/modules/home-manager/bat.nix +++ b/modules/home-manager/bat.nix @@ -1,29 +1,24 @@ { config -, pkgs , lib +, inputs , ... }: let cfg = config.programs.bat.catppuccin; enable = cfg.enable && config.programs.bat.enable; + themeName = "Catppuccin-${cfg.flavour}"; in { options.programs.bat.catppuccin = lib.ctp.mkCatppuccinOpt "bat" config; - config = { - programs.bat = lib.mkIf enable { - config.theme = "Catppuccin-${cfg.flavour}"; - themes."Catppuccin-${cfg.flavour}" = { - src = - pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "bat"; - rev = "ba4d16880d63e656acced2b7d4e034e4a93f74b1"; - hash = "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw="; - }; - file = "Catppuccin-${cfg.flavour}.tmTheme"; + config = lib.mkIf enable { + programs.bat = { + config.theme = themeName; + + themes.${themeName} = { + src = inputs.bat; + file = "${themeName}.tmTheme"; }; }; }; diff --git a/modules/home-manager/bottom.nix b/modules/home-manager/bottom.nix index db588806..fe01da56 100644 --- a/modules/home-manager/bottom.nix +++ b/modules/home-manager/bottom.nix @@ -1,6 +1,6 @@ { config -, pkgs , lib +, inputs , ... }: let @@ -12,12 +12,5 @@ in options.programs.bottom.catppuccin = lib.ctp.mkCatppuccinOpt "bottom" config; - config.programs.bottom.settings = lib.mkIf enable (fromTOML (readFile (pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "bottom"; - rev = "c0efe9025f62f618a407999d89b04a231ba99c92"; - sha256 = "sha256-VaHX2I/Gn82wJWzybpWNqU3dPi3206xItOlt0iF6VVQ="; - } - + "/themes/${cfg.flavour}.toml"))); + config.programs.bottom.settings = lib.mkIf enable (fromTOML (readFile "${inputs.bottom}/themes/${cfg.flavour}.toml")); } diff --git a/modules/home-manager/btop.nix b/modules/home-manager/btop.nix index 4c2fc440..3335cf21 100644 --- a/modules/home-manager/btop.nix +++ b/modules/home-manager/btop.nix @@ -1,30 +1,21 @@ { config -, pkgs , lib +, inputs , ... }: let - inherit (lib) mkIf; cfg = config.programs.btop.catppuccin; enable = cfg.enable && config.programs.btop.enable; themeFile = "catppuccin_${cfg.flavour}.theme"; themePath = "/themes/${themeFile}"; - theme = - pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "btop"; - rev = "7109eac2884e9ca1dae431c0d7b8bc2a7ce54e54"; - sha256 = "sha256-QoPPx4AzxJMYo/prqmWD/CM7e5vn/ueyx+XQ5+YfHF8="; - } - + themePath; + theme = inputs.btop + themePath; in { options.programs.btop.catppuccin = lib.ctp.mkCatppuccinOpt "btop" config; - config = mkIf enable + config = lib.mkIf enable { xdg = { # xdg is required for this to work diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 6b3241f8..396eb8f4 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -1,10 +1,10 @@ -nixpkgs: { config - , pkgs - , lib - , ... - }: +inputs: { config + , pkgs + , lib + , ... + }: let - extendedLib = import ../lib/mkExtLib.nix nixpkgs.lib; + extendedLib = import ../lib/mkExtLib.nix inputs.nixpkgs.lib; inherit (extendedLib) ctp; in { @@ -30,7 +30,7 @@ in ./tmux.nix ]; in - extendedLib.ctp.mapModules config pkgs extendedLib files; + extendedLib.ctp.mapModules config pkgs extendedLib inputs files; options.catppuccin = { flavour = lib.mkOption { diff --git a/modules/home-manager/glamour.nix b/modules/home-manager/glamour.nix index d0bc7a49..bdd961b4 100644 --- a/modules/home-manager/glamour.nix +++ b/modules/home-manager/glamour.nix @@ -1,7 +1,7 @@ { config , pkgs , lib -, +, ... }: let cfg = config.programs.glamour.catppuccin; diff --git a/modules/home-manager/helix.nix b/modules/home-manager/helix.nix index 846e859a..8df8d404 100644 --- a/modules/home-manager/helix.nix +++ b/modules/home-manager/helix.nix @@ -1,10 +1,10 @@ { config , pkgs , lib +, inputs , ... }: let - inherit (builtins) fromTOML readFile; cfg = config.programs.helix.catppuccin; enable = cfg.enable && config.programs.helix.enable; in @@ -28,13 +28,7 @@ in editor.color-modes = lib.mkDefault true; }; - themes."catppuccin-${cfg.flavour}" = fromTOML (readFile (pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "helix"; - rev = "5677c16dc95297a804caea9161072ff174018fdd"; - sha256 = "sha256-aa8KZ7/1TXcBqaV/TYOZ8rpusOf5QeQ9i2Upnncbziw="; - } - + "/themes/${subdir}/catppuccin_${cfg.flavour}.toml")); + themes."catppuccin-${cfg.flavour}" = builtins.fromTOML + "${inputs.helix}/themes/${subdir}/catppuccin_${cfg.flavour}.toml"; }; } diff --git a/modules/home-manager/lazygit.nix b/modules/home-manager/lazygit.nix index 300a2d6a..640faef8 100644 --- a/modules/home-manager/lazygit.nix +++ b/modules/home-manager/lazygit.nix @@ -1,6 +1,7 @@ { config , pkgs , lib +, inputs , ... }: let @@ -13,15 +14,7 @@ in config.programs.lazygit.settings = let - file = - pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "lazygit"; - rev = "f01edfd57fa2aa7cd69a92537a613bb3c91e65dd"; - sha256 = "sha256-zjzDtXcGtUon4QbrZnlAPzngEyH56yy8TCyFv0rIbOA="; - } - + "/themes/${cfg.flavour}.yml"; + file = "${inputs.lazygit}/themes/${cfg.flavour}.yml"; in lib.mkIf enable (lib.ctp.fromYaml pkgs file); } diff --git a/modules/home-manager/polybar.nix b/modules/home-manager/polybar.nix index 5669de46..9cb0bcc4 100644 --- a/modules/home-manager/polybar.nix +++ b/modules/home-manager/polybar.nix @@ -1,6 +1,6 @@ { config -, pkgs , lib +, inputs , ... }: let @@ -11,12 +11,6 @@ in options.services.polybar.catppuccin = lib.ctp.mkCatppuccinOpt "polybar" config; - config.services.polybar.extraConfig = lib.mkIf enable (builtins.readFile (pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "polybar"; - rev = "9ee66f83335404186ce979bac32fcf3cd047396a"; - sha256 = "sha256-bUbSgMg/sa2faeEUZo80GNmhOX3wn2jLzfA9neF8ERA="; - } - + "/themes/${cfg.flavour}.ini")); + config.services.polybar.extraConfig = lib.mkIf enable + (builtins.readFile "${inputs.polybar}/themes/${cfg.flavour}.ini"); } diff --git a/modules/home-manager/starship.nix b/modules/home-manager/starship.nix index 960ceb76..9741a8e1 100644 --- a/modules/home-manager/starship.nix +++ b/modules/home-manager/starship.nix @@ -1,6 +1,6 @@ { config -, pkgs , lib +, inputs , ... }: let @@ -18,13 +18,5 @@ in format = lib.mkDefault "$all"; palette = "catppuccin_${cfg.flavour}"; } - // fromTOML (readFile - (pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "starship"; - rev = "3e3e54410c3189053f4da7a7043261361a1ed1bc"; - sha256 = "sha256-soEBVlq3ULeiZFAdQYMRFuswIIhI9bclIU8WXjxd7oY="; - } - + "/palettes/${cfg.flavour}.toml"))); + // fromTOML (readFile "${inputs.starship}/palettes/${cfg.flavour}.toml")); } diff --git a/modules/home-manager/sway.nix b/modules/home-manager/sway.nix index b900330b..e679f28a 100644 --- a/modules/home-manager/sway.nix +++ b/modules/home-manager/sway.nix @@ -1,20 +1,12 @@ { config -, pkgs , lib +, inputs , ... }: let cfg = config.wayland.windowManager.sway.catppuccin; enable = cfg.enable && config.wayland.windowManager.sway.enable; - theme = - pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "sway"; - rev = "c89098fc3517b64f0422aaaccb98dcab6ae9348f"; - sha256 = "sha256-6Cvsmdl3OILz1vZovyBIuuSpm207I3W0dmUGowR9Ugk="; - } - + "/themes/catppuccin-${cfg.flavour}"; + theme = "${inputs.sway}/themes/catppuccin-${cfg.flavour}"; in { options.wayland.windowManager.sway.catppuccin = diff --git a/modules/home-manager/tmux.nix b/modules/home-manager/tmux.nix index a7377b9c..02f68d4b 100644 --- a/modules/home-manager/tmux.nix +++ b/modules/home-manager/tmux.nix @@ -7,14 +7,15 @@ let cfg = config.programs.tmux.catppuccin; enable = cfg.enable && config.programs.tmux.enable; - plugin = with builtins; - with pkgs; let + plugin = + let rev = "4e48b09a76829edc7b55fbb15467cf0411f07931"; in - tmuxPlugins.mkTmuxPlugin { + # TODO @getchoo: upstream this in nixpkgs + pkgs.tmuxPlugins.mkTmuxPlugin { pluginName = "catppuccin"; - version = substring 0 7 rev; - src = fetchFromGitHub { + version = builtins.substring 0 7 rev; + src = pkgs.fetchFromGitHub { owner = "catppuccin"; repo = "tmux"; inherit rev; diff --git a/modules/lib/default.nix b/modules/lib/default.nix index cae0c095..b7903a2c 100644 --- a/modules/lib/default.nix +++ b/modules/lib/default.nix @@ -83,9 +83,9 @@ in # a -> a -> [path] -> [path] # this imports a list of paths while inheriting # multiple attributes - mapModules = config: pkgs: extendedLib: + mapModules = config: pkgs: extendedLib: inputs: map (m: (import m { - inherit config pkgs; + inherit config pkgs inputs; lib = extendedLib; })); diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 0d4ff6a7..c5de46e1 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,6 +1,6 @@ -nixpkgs: { config, pkgs, lib, ... }: +inputs: { config, pkgs, lib, ... }: let - extendedLib = import ../lib/mkExtLib.nix nixpkgs.lib; + extendedLib = import ../lib/mkExtLib.nix inputs.nixpkgs.lib; in { imports = @@ -9,7 +9,7 @@ in ./grub.nix ]; in - extendedLib.ctp.mapModules config pkgs extendedLib files; + extendedLib.ctp.mapModules config pkgs extendedLib inputs files; options.catppuccin = with extendedLib; { diff --git a/modules/nixos/grub.nix b/modules/nixos/grub.nix index 6174404d..0d998223 100644 --- a/modules/nixos/grub.nix +++ b/modules/nixos/grub.nix @@ -1,23 +1,17 @@ { config , pkgs , lib +, inputs , ... }: let cfg = config.boot.loader.grub.catppuccin; enable = cfg.enable && config.boot.loader.grub.enable; - theme = with pkgs; let - src = fetchFromGitHub { - owner = "catppuccin"; - repo = "grub"; - rev = "803c5df0e83aba61668777bb96d90ab8f6847106"; - sha256 = "sha256-/bSolCta8GCZ4lP0u5NVqYQ9Y3ZooYCNdTwORNvR7M0="; - }; - in - runCommand "catppuccin-grub-theme" { } '' + # TODO @getchoo: upstream this in nixpkgs maybe? idk if they have grub themes + theme = pkgs.runCommand "catppuccin-grub-theme" { } '' mkdir -p "$out" - cp -r ${src}/src/catppuccin-${cfg.flavour}-grub-theme/* "$out"/ + cp -r ${inputs.grub}/src/catppuccin-${cfg.flavour}-grub-theme/* "$out"/ ''; in { diff --git a/outputs.nix b/outputs.nix new file mode 100644 index 00000000..5ea5b087 --- /dev/null +++ b/outputs.nix @@ -0,0 +1,55 @@ +{ self, nixpkgs, ... }@inputs: +let + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + + inherit (nixpkgs) lib; + + forAllSystems = fn: lib.genAttrs systems (s: fn nixpkgs.legacyPackages.${s}); +in +{ + formatter = forAllSystems (pkgs: pkgs.nixpkgs-fmt); + + homeManagerModules.catppuccin = import ./modules/home-manager inputs; + + nixosModules.catppuccin = import ./modules/nixos inputs; + + packages = forAllSystems (pkgs: + let + mkEval = module: lib.evalModules { + modules = [ + module + { + _module = { + check = false; + args.lib = import ./modules/lib/mkExtLib.nix lib; + }; + } + ]; + }; + + mkDoc = name: options: + let + doc = pkgs.nixosOptionsDoc { + options = lib.filterAttrs (n: _: n != "_module") options; + documentType = "none"; + revision = if self ? rev then builtins.substring 0 7 self.rev else "dirty"; + }; + in + pkgs.runCommand "${name}-module-doc.md" { } '' + cat ${doc.optionsCommonMark} > $out + ''; + + hmEval = mkEval self.homeManagerModules.catppuccin; + nixosEval = mkEval self.nixosModules.catppuccin; + in + rec { + nixos-doc = mkDoc "nixos" nixosEval.options; + home-manager-doc = mkDoc "home-manager" hmEval.options; + default = home-manager-doc; + }); +} From 6c1297f6a9673b869ac1d1d54bba9aab09c15f3e Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 30 Jul 2023 01:22:12 -0400 Subject: [PATCH 02/17] ci: start auto updating flake inputs --- .github/workflows/update-lock.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/update-lock.yml diff --git a/.github/workflows/update-lock.yml b/.github/workflows/update-lock.yml new file mode 100644 index 00000000..4e1d2edb --- /dev/null +++ b/.github/workflows/update-lock.yml @@ -0,0 +1,25 @@ +name: Update flake lockfile + +on: + schedule: + # run every friday + - cron: "0 0 * * 5" + workflow_dispatch: + +jobs: + update-lock: + runs-on: ubuntu-latest + + permissions: + contents: write + pull-requests: write + + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v22 + + - uses: DeterminateSystems/update-flake-lock@v20 + with: + commit-msg: "chore: update flake lockfile" + pr-title: "chore: update flake lockfile" + token: ${{ github.token }} From 7b3f1b791ef7cbde9cd32a9c97268fc1e88d393b Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 30 Jul 2023 03:14:37 -0400 Subject: [PATCH 03/17] ci: init basic vm tests --- .github/workflows/test-vm.yml | 26 ++++++++++ flake.lock | 27 ++++++++-- flake.nix | 5 ++ outputs.nix | 19 +++++++- test.nix | 92 +++++++++++++++++++++++++++++++++++ 5 files changed, 164 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/test-vm.yml create mode 100644 test.nix diff --git a/.github/workflows/test-vm.yml b/.github/workflows/test-vm.yml new file mode 100644 index 00000000..f23a982d --- /dev/null +++ b/.github/workflows/test-vm.yml @@ -0,0 +1,26 @@ +name: Test modules + +on: + push: + paths: + - 'modules/**' + - 'test.nix' + - 'flake.*' + pull_request: + paths: + - 'modules/**' + - 'test.nix' + - 'flake.*' + workflow_dispatch: + +jobs: + run-vm: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v20 + - uses: DeterminateSystems/magic-nix-cache-action@main + + - name: Run VM + run: nix build .#test.x86_64-linux.modules diff --git a/flake.lock b/flake.lock index 1f6e4c4a..1f8a80f9 100644 --- a/flake.lock +++ b/flake.lock @@ -112,6 +112,26 @@ "type": "github" } }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1690652600, + "narHash": "sha256-Dy09g7mezToVwtFPyY25fAx1hzqNXv73/QmY5/qyR44=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "f58889c07efa8e1328fdf93dc1796ec2a5c47f38", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "lazygit": { "flake": false, "locked": { @@ -130,11 +150,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1685655444, - "narHash": "sha256-6EujQNAeaUkWvpEZZcVF8qSfQrNVWFNNGbUJxv/A5a8=", + "lastModified": 1690548937, + "narHash": "sha256-x3ZOPGLvtC0/+iFAg9Kvqm/8hTAIkGjc634SqtgaXTA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e635192892f5abbc2289eaac3a73cdb249abaefd", + "rev": "2a9d660ff0f7ffde9d73be328ee6e6f10ef66b28", "type": "github" }, "original": { @@ -168,6 +188,7 @@ "flake-compat": "flake-compat", "grub": "grub", "helix": "helix", + "home-manager": "home-manager", "lazygit": "lazygit", "nixpkgs": "nixpkgs", "polybar": "polybar", diff --git a/flake.nix b/flake.nix index 7660c190..acad0a7d 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,12 @@ { description = "Soothing pastel theme for Nix"; + inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; flake-compat = { url = "github:edolstra/flake-compat"; flake = false; diff --git a/outputs.nix b/outputs.nix index 5ea5b087..dd1dc9b5 100644 --- a/outputs.nix +++ b/outputs.nix @@ -1,4 +1,4 @@ -{ self, nixpkgs, ... }@inputs: +{ self, nixpkgs, home-manager, ... }@inputs: let systems = [ "x86_64-linux" @@ -9,7 +9,20 @@ let inherit (nixpkgs) lib; - forAllSystems = fn: lib.genAttrs systems (s: fn nixpkgs.legacyPackages.${s}); + forAllSystems = fn: lib.genAttrs systems (s: fn nixpkgsFor.${s}); + nixpkgsFor = lib.genAttrs systems (system: import nixpkgs { inherit system; }); + + nixosLib = import (nixpkgs + "/nixos/lib") { }; + runTestFor = system: test: nixosLib.runTest { + imports = [ test ]; + + hostPkgs = nixpkgsFor.${system}; + + _module.args = { + catppuccin = self; + inherit nixpkgs home-manager; + }; + }; in { formatter = forAllSystems (pkgs: pkgs.nixpkgs-fmt); @@ -52,4 +65,6 @@ in home-manager-doc = mkDoc "home-manager" hmEval.options; default = home-manager-doc; }); + + tests.x86_64-linux.modules = runTestFor "x86_64-linux" ./test.nix; } diff --git a/test.nix b/test.nix new file mode 100644 index 00000000..16b3d144 --- /dev/null +++ b/test.nix @@ -0,0 +1,92 @@ +{ home-manager +, catppuccin +, ... +}: +let + common = { + catppuccin.flavour = "mocha"; + users.users.test = { + isNormalUser = true; + home = "/home/test"; + }; + }; + + ctpEnable = { + enable = true; + catppuccin.enable = true; + }; +in +{ + name = "module-test"; + + nodes.machine = { lib, ... }: { + imports = [ + catppuccin.nixosModules.catppuccin + home-manager.nixosModules.default + common + ]; + + boot.loader.grub = ctpEnable; + + programs.dconf.enable = true; # required for gtk + + virtualisation = { + memorySize = 4096; + writableStore = true; + }; + + home-manager.users.test = { + imports = [ + catppuccin.homeManagerModules.catppuccin + ]; + + inherit (common) catppuccin; + + home = { + username = "test"; + stateVersion = lib.mkDefault "23.11"; + }; + + manual.manpages.enable = lib.mkDefault false; + + programs = { + alacritty = ctpEnable; + bat = ctpEnable; + bottom = ctpEnable; + btop = ctpEnable; + fish = ctpEnable; + glamour.catppuccin.enable = true; + helix = ctpEnable; + home-manager.enable = false; + kitty = ctpEnable; + lazygit = ctpEnable; + micro = ctpEnable; + neovim = ctpEnable; + starship = ctpEnable; + tmux = ctpEnable; + }; + + gtk = ctpEnable; + + services = { + mako = ctpEnable; + polybar = + ctpEnable + // { + script = '' + polybar top & + ''; + }; + }; + + wayland.windowManager.sway = ctpEnable; + }; + }; + + testScript = _: '' + machine.start() + machine.wait_for_unit("home-manager-test.service") + machine.wait_until_succeeds("systemctl status home-manager-test.service") + machine.succeed("echo \"system started!\"") + ''; +} From d18bfde51dd7c9a6fa22b136ad1f51a15ef427ab Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 30 Jul 2023 03:18:30 -0400 Subject: [PATCH 04/17] ci: rename ci to format --- .github/workflows/{ci.yml => format.yml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{ci.yml => format.yml} (92%) diff --git a/.github/workflows/ci.yml b/.github/workflows/format.yml similarity index 92% rename from .github/workflows/ci.yml rename to .github/workflows/format.yml index fcef98f9..08874a11 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/format.yml @@ -1,11 +1,11 @@ -name: CI +name: Format on: - push - pull_request jobs: - Check: + format-check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From a0432b9ed1192f808b86599873eab0555bacf87c Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 30 Jul 2023 03:20:54 -0400 Subject: [PATCH 05/17] ci: use PAT for update-lock workflow this is required to run tests such as test-vm after the pull request is made --- .github/workflows/update-lock.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-lock.yml b/.github/workflows/update-lock.yml index 4e1d2edb..3d573edd 100644 --- a/.github/workflows/update-lock.yml +++ b/.github/workflows/update-lock.yml @@ -22,4 +22,4 @@ jobs: with: commit-msg: "chore: update flake lockfile" pr-title: "chore: update flake lockfile" - token: ${{ github.token }} + token: ${{ secrets.FLAKE_UPDATE_TOKEN }} From c06046ba2fcec4b6d89b207e06416673d0fa3883 Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 30 Jul 2023 03:29:29 -0400 Subject: [PATCH 06/17] fix(home-manager): make sure to use readFile in helix module --- modules/home-manager/helix.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/home-manager/helix.nix b/modules/home-manager/helix.nix index 8df8d404..3464d565 100644 --- a/modules/home-manager/helix.nix +++ b/modules/home-manager/helix.nix @@ -1,5 +1,4 @@ { config -, pkgs , lib , inputs , ... @@ -29,6 +28,6 @@ in }; themes."catppuccin-${cfg.flavour}" = builtins.fromTOML - "${inputs.helix}/themes/${subdir}/catppuccin_${cfg.flavour}.toml"; + (builtins.readFile "${inputs.helix}/themes/${subdir}/catppuccin_${cfg.flavour}.toml"); }; } From 463354a5e5263bd430604f730945e9dee21408e4 Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 30 Jul 2023 03:29:53 -0400 Subject: [PATCH 07/17] ci: fix typo in test-vm --- .github/workflows/test-vm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-vm.yml b/.github/workflows/test-vm.yml index f23a982d..d2abe127 100644 --- a/.github/workflows/test-vm.yml +++ b/.github/workflows/test-vm.yml @@ -23,4 +23,4 @@ jobs: - uses: DeterminateSystems/magic-nix-cache-action@main - name: Run VM - run: nix build .#test.x86_64-linux.modules + run: nix build .#tests.x86_64-linux.modules From 0e202f56d1132b3542dd0a8374b3fba573ee114c Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 30 Jul 2023 03:36:06 -0400 Subject: [PATCH 08/17] ci: use verbose logging in test-vm & enable kvm --- .github/workflows/test-vm.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-vm.yml b/.github/workflows/test-vm.yml index d2abe127..35051e61 100644 --- a/.github/workflows/test-vm.yml +++ b/.github/workflows/test-vm.yml @@ -20,7 +20,9 @@ jobs: steps: - uses: actions/checkout@v3 - uses: cachix/install-nix-action@v20 + with: + extra_nix_config: "system-features = benchmark big-parallel kvm nixos-test uid-range" - uses: DeterminateSystems/magic-nix-cache-action@main - name: Run VM - run: nix build .#tests.x86_64-linux.modules + run: nix build -Lv .#tests.x86_64-linux.modules From a6ff81cf06a3ba0e159b495a57b2e235c8d5482f Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 30 Jul 2023 08:02:01 +0000 Subject: [PATCH 09/17] docs: add flake inputs & vm testing to CONTRIBUTING.md --- CONTRIBUTING.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3a79d648..64096892 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,6 +7,14 @@ Create a file in `modules//` with the name of the port. Add the file to `catppuccin.enable` and `catppuccin.flavour` options, and optionally the `catppuccin.accent` option. `catppuccin.flavour` and `catppuccin.accent` should default to `config.catppuccin.flavour` and `config.catppuccin.accent`, respectively. +[Flake inputs](https://nixos.wiki/wiki/Flakes#Input_schema) should also be used over +`fetchFromGitHub` when themes are not avalible in nixpkgs - this in order to reduce +[IFD](https://nixos.wiki/wiki/Import_From_Derivation) and allow for auto-updating the +specified commits for repositories. + +After creating your module, add the options to enable it in `test.nix` under the +`nodes.machine` attrset. This will allow for your configuration to be tested along +with the other modules in a VM automatically. Commits that add ports should be of the format From a190462894b0c925d945650ea5c72d8c09a4b188 Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 30 Jul 2023 17:08:57 -0400 Subject: [PATCH 10/17] feat(modules)!: use nvfetcher for upstream sources --- .github/workflows/update-lock.yml | 36 +++- _sources/generated.json | 282 +++++++++++++++++++++++++++++ _sources/generated.nix | 172 ++++++++++++++++++ flake.lock | 172 +----------------- flake.nix | 122 ++++++++----- modules/home-manager/alacritty.nix | 4 +- modules/home-manager/bat.nix | 4 +- modules/home-manager/bottom.nix | 4 +- modules/home-manager/btop.nix | 4 +- modules/home-manager/default.nix | 12 +- modules/home-manager/fish.nix | 17 +- modules/home-manager/glamour.nix | 2 +- modules/home-manager/helix.nix | 4 +- modules/home-manager/lazygit.nix | 6 +- modules/home-manager/mako.nix | 9 +- modules/home-manager/micro.nix | 13 +- modules/home-manager/polybar.nix | 4 +- modules/home-manager/starship.nix | 4 +- modules/home-manager/sway.nix | 4 +- modules/home-manager/tmux.nix | 15 +- modules/lib/default.nix | 4 +- modules/nixos/default.nix | 4 +- modules/nixos/grub.nix | 6 +- nvfetcher.toml | 71 ++++++++ outputs.nix | 70 ------- 25 files changed, 678 insertions(+), 367 deletions(-) create mode 100644 _sources/generated.json create mode 100644 _sources/generated.nix create mode 100644 nvfetcher.toml delete mode 100644 outputs.nix diff --git a/.github/workflows/update-lock.yml b/.github/workflows/update-lock.yml index 3d573edd..57e9674c 100644 --- a/.github/workflows/update-lock.yml +++ b/.github/workflows/update-lock.yml @@ -1,4 +1,4 @@ -name: Update flake lockfile +name: Update lockfiles on: schedule: @@ -7,19 +7,35 @@ on: workflow_dispatch: jobs: - update-lock: + update-locks: runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - steps: - uses: actions/checkout@v4 - uses: cachix/install-nix-action@v22 - - uses: DeterminateSystems/update-flake-lock@v20 + - name: Set Git user info + run: | + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + + - name: Update flake inputs + run: | + nix flake update \ + --commit-lock-file --commit-lockfile-summary "chore: update flake inputs" + + - name: Update upstream sources + run: | + nix run nixpkgs#nvfetcher + + - name: Create PR + uses: peter-evans/create-pull-request@v5 with: - commit-msg: "chore: update flake lockfile" - pr-title: "chore: update flake lockfile" - token: ${{ secrets.FLAKE_UPDATE_TOKEN }} + token: ${{ secrets.LOCKFILE_TOKEN }} + base: "main" + branch: "update-lock" + delete-branch: true + committer: github-actions[bot] github-actions[bot]@users.noreply.github.com + commit-message: "chore: update nvfetcher sources" + title: "chore: update lockfiles" + body: "Automated pull request updating flake inputs and nvfetcher sources" diff --git a/_sources/generated.json b/_sources/generated.json new file mode 100644 index 00000000..c43e2a0e --- /dev/null +++ b/_sources/generated.json @@ -0,0 +1,282 @@ +{ + "alacritty": { + "cargoLocks": null, + "date": "2022-09-27", + "extract": null, + "name": "alacritty", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "alacritty", + "rev": "3c808cbb4f9c87be43ba5241bc57373c793d2f17", + "sha256": "sha256-w9XVtEe7TqzxxGUCDUR9BFkzLZjG8XrplXJ3lX6f+x0=", + "type": "github" + }, + "version": "3c808cbb4f9c87be43ba5241bc57373c793d2f17" + }, + "bat": { + "cargoLocks": null, + "date": "2022-11-10", + "extract": null, + "name": "bat", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "bat", + "rev": "ba4d16880d63e656acced2b7d4e034e4a93f74b1", + "sha256": "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw=", + "type": "github" + }, + "version": "ba4d16880d63e656acced2b7d4e034e4a93f74b1" + }, + "bottom": { + "cargoLocks": null, + "date": "2022-12-30", + "extract": null, + "name": "bottom", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "bottom", + "rev": "c0efe9025f62f618a407999d89b04a231ba99c92", + "sha256": "sha256-VaHX2I/Gn82wJWzybpWNqU3dPi3206xItOlt0iF6VVQ=", + "type": "github" + }, + "version": "c0efe9025f62f618a407999d89b04a231ba99c92" + }, + "btop": { + "cargoLocks": null, + "date": "2023-06-07", + "extract": null, + "name": "btop", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "btop", + "rev": "89ff712eb62747491a76a7902c475007244ff202", + "sha256": "sha256-J3UezOQMDdxpflGax0rGBF/XMiKqdqZXuX4KMVGTxFk=", + "type": "github" + }, + "version": "89ff712eb62747491a76a7902c475007244ff202" + }, + "grub": { + "cargoLocks": null, + "date": "2022-12-29", + "extract": null, + "name": "grub", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "grub", + "rev": "803c5df0e83aba61668777bb96d90ab8f6847106", + "sha256": "sha256-/bSolCta8GCZ4lP0u5NVqYQ9Y3ZooYCNdTwORNvR7M0=", + "type": "github" + }, + "version": "803c5df0e83aba61668777bb96d90ab8f6847106" + }, + "gtk": { + "cargoLocks": null, + "date": "2023-07-04", + "extract": null, + "name": "gtk", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "gtk", + "rev": "d6d1e951e48fdadb61838aa5238c59db40f4d38e", + "sha256": "sha256-wgZF8mQhUvWNds0zlWFoefRnBk7lqy2dfAbDxcMPHl0=", + "type": "github" + }, + "version": "d6d1e951e48fdadb61838aa5238c59db40f4d38e" + }, + "helix": { + "cargoLocks": null, + "date": "2023-04-06", + "extract": null, + "name": "helix", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "helix", + "rev": "5677c16dc95297a804caea9161072ff174018fdd", + "sha256": "sha256-aa8KZ7/1TXcBqaV/TYOZ8rpusOf5QeQ9i2Upnncbziw=", + "type": "github" + }, + "version": "5677c16dc95297a804caea9161072ff174018fdd" + }, + "kitty": { + "cargoLocks": null, + "date": "2023-06-09", + "extract": null, + "name": "kitty", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "kitty", + "rev": "4820b3ef3f4968cf3084b2239ce7d1e99ea04dda", + "sha256": "sha256-uZSx+fuzcW//5/FtW98q7G4xRRjJjD5aQMbvJ4cs94U=", + "type": "github" + }, + "version": "4820b3ef3f4968cf3084b2239ce7d1e99ea04dda" + }, + "lazygit": { + "cargoLocks": null, + "date": "2023-05-02", + "extract": null, + "name": "lazygit", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "lazygit", + "rev": "b2ecb6d41b6f54a82104879573c538e8bdaeb0bf", + "sha256": "sha256-9BBmWRcjNaJE9T0RKVEJaSnkrbMom0CLYE8PzAT6yFw=", + "type": "github" + }, + "version": "b2ecb6d41b6f54a82104879573c538e8bdaeb0bf" + }, + "neovim": { + "cargoLocks": null, + "date": "2023-07-29", + "extract": null, + "name": "neovim", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "nvim", + "rev": "057c34f849cf21059487d849e2f3b3efcd4ee0eb", + "sha256": "sha256-MSZcIrV3vvgb5mlMpO5uRlAYoENm2pZyuZbV5Q9Vg58=", + "type": "github" + }, + "version": "057c34f849cf21059487d849e2f3b3efcd4ee0eb" + }, + "polybar": { + "cargoLocks": null, + "date": "2022-10-05", + "extract": null, + "name": "polybar", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "polybar", + "rev": "9ee66f83335404186ce979bac32fcf3cd047396a", + "sha256": "sha256-bUbSgMg/sa2faeEUZo80GNmhOX3wn2jLzfA9neF8ERA=", + "type": "github" + }, + "version": "9ee66f83335404186ce979bac32fcf3cd047396a" + }, + "starship": { + "cargoLocks": null, + "date": "2023-07-13", + "extract": null, + "name": "starship", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "starship", + "rev": "5629d2356f62a9f2f8efad3ff37476c19969bd4f", + "sha256": "sha256-nsRuxQFKbQkyEI4TXgvAjcroVdG+heKX5Pauq/4Ota0=", + "type": "github" + }, + "version": "5629d2356f62a9f2f8efad3ff37476c19969bd4f" + }, + "sway": { + "cargoLocks": null, + "date": "2023-02-23", + "extract": null, + "name": "sway", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "sway", + "rev": "c89098fc3517b64f0422aaaccb98dcab6ae9348f", + "sha256": "sha256-6Cvsmdl3OILz1vZovyBIuuSpm207I3W0dmUGowR9Ugk=", + "type": "github" + }, + "version": "c89098fc3517b64f0422aaaccb98dcab6ae9348f" + }, + "tmux": { + "cargoLocks": null, + "date": "2023-06-30", + "extract": null, + "name": "tmux", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "tmux", + "rev": "e7b50832f9bc59b0b5ef5316ba2cd6f61e4e22fc", + "sha256": "sha256-9ZfUqEKEexSh06QyR5C+tYd4tNfBi3PsA+STzUv4+/s=", + "type": "github" + }, + "version": "e7b50832f9bc59b0b5ef5316ba2cd6f61e4e22fc" + } +} \ No newline at end of file diff --git a/_sources/generated.nix b/_sources/generated.nix new file mode 100644 index 00000000..bcd2199b --- /dev/null +++ b/_sources/generated.nix @@ -0,0 +1,172 @@ +# This file was generated by nvfetcher, please do not modify it manually. +{ fetchgit, fetchurl, fetchFromGitHub, dockerTools }: +{ + alacritty = { + pname = "alacritty"; + version = "3c808cbb4f9c87be43ba5241bc57373c793d2f17"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "alacritty"; + rev = "3c808cbb4f9c87be43ba5241bc57373c793d2f17"; + fetchSubmodules = false; + sha256 = "sha256-w9XVtEe7TqzxxGUCDUR9BFkzLZjG8XrplXJ3lX6f+x0="; + }; + date = "2022-09-27"; + }; + bat = { + pname = "bat"; + version = "ba4d16880d63e656acced2b7d4e034e4a93f74b1"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "bat"; + rev = "ba4d16880d63e656acced2b7d4e034e4a93f74b1"; + fetchSubmodules = false; + sha256 = "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw="; + }; + date = "2022-11-10"; + }; + bottom = { + pname = "bottom"; + version = "c0efe9025f62f618a407999d89b04a231ba99c92"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "bottom"; + rev = "c0efe9025f62f618a407999d89b04a231ba99c92"; + fetchSubmodules = false; + sha256 = "sha256-VaHX2I/Gn82wJWzybpWNqU3dPi3206xItOlt0iF6VVQ="; + }; + date = "2022-12-30"; + }; + btop = { + pname = "btop"; + version = "89ff712eb62747491a76a7902c475007244ff202"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "btop"; + rev = "89ff712eb62747491a76a7902c475007244ff202"; + fetchSubmodules = false; + sha256 = "sha256-J3UezOQMDdxpflGax0rGBF/XMiKqdqZXuX4KMVGTxFk="; + }; + date = "2023-06-07"; + }; + grub = { + pname = "grub"; + version = "803c5df0e83aba61668777bb96d90ab8f6847106"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "grub"; + rev = "803c5df0e83aba61668777bb96d90ab8f6847106"; + fetchSubmodules = false; + sha256 = "sha256-/bSolCta8GCZ4lP0u5NVqYQ9Y3ZooYCNdTwORNvR7M0="; + }; + date = "2022-12-29"; + }; + gtk = { + pname = "gtk"; + version = "d6d1e951e48fdadb61838aa5238c59db40f4d38e"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "gtk"; + rev = "d6d1e951e48fdadb61838aa5238c59db40f4d38e"; + fetchSubmodules = false; + sha256 = "sha256-wgZF8mQhUvWNds0zlWFoefRnBk7lqy2dfAbDxcMPHl0="; + }; + date = "2023-07-04"; + }; + helix = { + pname = "helix"; + version = "5677c16dc95297a804caea9161072ff174018fdd"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "helix"; + rev = "5677c16dc95297a804caea9161072ff174018fdd"; + fetchSubmodules = false; + sha256 = "sha256-aa8KZ7/1TXcBqaV/TYOZ8rpusOf5QeQ9i2Upnncbziw="; + }; + date = "2023-04-06"; + }; + kitty = { + pname = "kitty"; + version = "4820b3ef3f4968cf3084b2239ce7d1e99ea04dda"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "kitty"; + rev = "4820b3ef3f4968cf3084b2239ce7d1e99ea04dda"; + fetchSubmodules = false; + sha256 = "sha256-uZSx+fuzcW//5/FtW98q7G4xRRjJjD5aQMbvJ4cs94U="; + }; + date = "2023-06-09"; + }; + lazygit = { + pname = "lazygit"; + version = "b2ecb6d41b6f54a82104879573c538e8bdaeb0bf"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "lazygit"; + rev = "b2ecb6d41b6f54a82104879573c538e8bdaeb0bf"; + fetchSubmodules = false; + sha256 = "sha256-9BBmWRcjNaJE9T0RKVEJaSnkrbMom0CLYE8PzAT6yFw="; + }; + date = "2023-05-02"; + }; + neovim = { + pname = "neovim"; + version = "057c34f849cf21059487d849e2f3b3efcd4ee0eb"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "nvim"; + rev = "057c34f849cf21059487d849e2f3b3efcd4ee0eb"; + fetchSubmodules = false; + sha256 = "sha256-MSZcIrV3vvgb5mlMpO5uRlAYoENm2pZyuZbV5Q9Vg58="; + }; + date = "2023-07-29"; + }; + polybar = { + pname = "polybar"; + version = "9ee66f83335404186ce979bac32fcf3cd047396a"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "polybar"; + rev = "9ee66f83335404186ce979bac32fcf3cd047396a"; + fetchSubmodules = false; + sha256 = "sha256-bUbSgMg/sa2faeEUZo80GNmhOX3wn2jLzfA9neF8ERA="; + }; + date = "2022-10-05"; + }; + starship = { + pname = "starship"; + version = "5629d2356f62a9f2f8efad3ff37476c19969bd4f"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "starship"; + rev = "5629d2356f62a9f2f8efad3ff37476c19969bd4f"; + fetchSubmodules = false; + sha256 = "sha256-nsRuxQFKbQkyEI4TXgvAjcroVdG+heKX5Pauq/4Ota0="; + }; + date = "2023-07-13"; + }; + sway = { + pname = "sway"; + version = "c89098fc3517b64f0422aaaccb98dcab6ae9348f"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "sway"; + rev = "c89098fc3517b64f0422aaaccb98dcab6ae9348f"; + fetchSubmodules = false; + sha256 = "sha256-6Cvsmdl3OILz1vZovyBIuuSpm207I3W0dmUGowR9Ugk="; + }; + date = "2023-02-23"; + }; + tmux = { + pname = "tmux"; + version = "e7b50832f9bc59b0b5ef5316ba2cd6f61e4e22fc"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "tmux"; + rev = "e7b50832f9bc59b0b5ef5316ba2cd6f61e4e22fc"; + fetchSubmodules = false; + sha256 = "sha256-9ZfUqEKEexSh06QyR5C+tYd4tNfBi3PsA+STzUv4+/s="; + }; + date = "2023-06-30"; + }; +} diff --git a/flake.lock b/flake.lock index 1f8a80f9..35456a61 100644 --- a/flake.lock +++ b/flake.lock @@ -1,69 +1,5 @@ { "nodes": { - "alacritty": { - "flake": false, - "locked": { - "lastModified": 1664239314, - "narHash": "sha256-w9XVtEe7TqzxxGUCDUR9BFkzLZjG8XrplXJ3lX6f+x0=", - "owner": "catppuccin", - "repo": "alacritty", - "rev": "3c808cbb4f9c87be43ba5241bc57373c793d2f17", - "type": "github" - }, - "original": { - "owner": "catppuccin", - "repo": "alacritty", - "type": "github" - } - }, - "bat": { - "flake": false, - "locked": { - "lastModified": 1668065083, - "narHash": "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw=", - "owner": "catppuccin", - "repo": "bat", - "rev": "ba4d16880d63e656acced2b7d4e034e4a93f74b1", - "type": "github" - }, - "original": { - "owner": "catppuccin", - "repo": "bat", - "type": "github" - } - }, - "bottom": { - "flake": false, - "locked": { - "lastModified": 1672359880, - "narHash": "sha256-VaHX2I/Gn82wJWzybpWNqU3dPi3206xItOlt0iF6VVQ=", - "owner": "catppuccin", - "repo": "bottom", - "rev": "c0efe9025f62f618a407999d89b04a231ba99c92", - "type": "github" - }, - "original": { - "owner": "catppuccin", - "repo": "bottom", - "type": "github" - } - }, - "btop": { - "flake": false, - "locked": { - "lastModified": 1686163899, - "narHash": "sha256-J3UezOQMDdxpflGax0rGBF/XMiKqdqZXuX4KMVGTxFk=", - "owner": "catppuccin", - "repo": "btop", - "rev": "89ff712eb62747491a76a7902c475007244ff202", - "type": "github" - }, - "original": { - "owner": "catppuccin", - "repo": "btop", - "type": "github" - } - }, "flake-compat": { "flake": false, "locked": { @@ -80,38 +16,6 @@ "type": "github" } }, - "grub": { - "flake": false, - "locked": { - "lastModified": 1672329233, - "narHash": "sha256-/bSolCta8GCZ4lP0u5NVqYQ9Y3ZooYCNdTwORNvR7M0=", - "owner": "catppuccin", - "repo": "grub", - "rev": "803c5df0e83aba61668777bb96d90ab8f6847106", - "type": "github" - }, - "original": { - "owner": "catppuccin", - "repo": "grub", - "type": "github" - } - }, - "helix": { - "flake": false, - "locked": { - "lastModified": 1680791535, - "narHash": "sha256-aa8KZ7/1TXcBqaV/TYOZ8rpusOf5QeQ9i2Upnncbziw=", - "owner": "catppuccin", - "repo": "helix", - "rev": "5677c16dc95297a804caea9161072ff174018fdd", - "type": "github" - }, - "original": { - "owner": "catppuccin", - "repo": "helix", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -132,22 +36,6 @@ "type": "github" } }, - "lazygit": { - "flake": false, - "locked": { - "lastModified": 1683041570, - "narHash": "sha256-9BBmWRcjNaJE9T0RKVEJaSnkrbMom0CLYE8PzAT6yFw=", - "owner": "catppuccin", - "repo": "lazygit", - "rev": "b2ecb6d41b6f54a82104879573c538e8bdaeb0bf", - "type": "github" - }, - "original": { - "owner": "catppuccin", - "repo": "lazygit", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1690548937, @@ -163,69 +51,11 @@ "type": "indirect" } }, - "polybar": { - "flake": false, - "locked": { - "lastModified": 1664945864, - "narHash": "sha256-bUbSgMg/sa2faeEUZo80GNmhOX3wn2jLzfA9neF8ERA=", - "owner": "catppuccin", - "repo": "polybar", - "rev": "9ee66f83335404186ce979bac32fcf3cd047396a", - "type": "github" - }, - "original": { - "owner": "catppuccin", - "repo": "polybar", - "type": "github" - } - }, "root": { "inputs": { - "alacritty": "alacritty", - "bat": "bat", - "bottom": "bottom", - "btop": "btop", "flake-compat": "flake-compat", - "grub": "grub", - "helix": "helix", "home-manager": "home-manager", - "lazygit": "lazygit", - "nixpkgs": "nixpkgs", - "polybar": "polybar", - "starship": "starship", - "sway": "sway" - } - }, - "starship": { - "flake": false, - "locked": { - "lastModified": 1689246850, - "narHash": "sha256-nsRuxQFKbQkyEI4TXgvAjcroVdG+heKX5Pauq/4Ota0=", - "owner": "catppuccin", - "repo": "starship", - "rev": "5629d2356f62a9f2f8efad3ff37476c19969bd4f", - "type": "github" - }, - "original": { - "owner": "catppuccin", - "repo": "starship", - "type": "github" - } - }, - "sway": { - "flake": false, - "locked": { - "lastModified": 1677157164, - "narHash": "sha256-6Cvsmdl3OILz1vZovyBIuuSpm207I3W0dmUGowR9Ugk=", - "owner": "catppuccin", - "repo": "sway", - "rev": "c89098fc3517b64f0422aaaccb98dcab6ae9348f", - "type": "github" - }, - "original": { - "owner": "catppuccin", - "repo": "sway", - "type": "github" + "nixpkgs": "nixpkgs" } } }, diff --git a/flake.nix b/flake.nix index acad0a7d..daeaf0bd 100644 --- a/flake.nix +++ b/flake.nix @@ -3,59 +3,93 @@ inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; + home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + flake-compat = { url = "github:edolstra/flake-compat"; flake = false; }; + }; - # home-manager - alacritty = { - url = "github:catppuccin/alacritty"; - flake = false; - }; - bat = { - url = "github:catppuccin/bat"; - flake = false; - }; - bottom = { - url = "github:catppuccin/bottom"; - flake = false; - }; - btop = { - url = "github:catppuccin/btop"; - flake = false; - }; - helix = { - url = "github:catppuccin/helix"; - flake = false; - }; - lazygit = { - url = "github:catppuccin/lazygit"; - flake = false; - }; - polybar = { - url = "github:catppuccin/polybar"; - flake = false; - }; - starship = { - url = "github:catppuccin/starship"; - flake = false; - }; - sway = { - url = "github:catppuccin/sway"; - flake = false; - }; + outputs = { self, nixpkgs, home-manager, ... }@inputs: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; - # nixos - grub = { - url = "github:catppuccin/grub"; - flake = false; - }; - }; + inherit (nixpkgs) lib; + + forAllSystems = fn: lib.genAttrs systems (s: fn nixpkgsFor.${s}); + nixpkgsFor = lib.genAttrs systems (system: import nixpkgs { inherit system; }); + + nixosLib = import (nixpkgs + "/nixos/lib") { }; + runTestFor = system: test: nixosLib.runTest { + imports = [ test ]; + + hostPkgs = nixpkgsFor.${system}; - outputs = inputs: (import ./outputs.nix inputs); # yes these parantheseis are unneeded, but i wanted to get around a statix warning + _module.args = { + catppuccin = self; + inherit nixpkgs home-manager; + }; + }; + + sources = pkgs: + let + s = + import ./_sources/generated.nix { inherit (pkgs) fetchgit fetchurl fetchFromGitHub dockerTools; }; + in + builtins.mapAttrs (_: p: p.src) s; + in + { + formatter = forAllSystems (pkgs: pkgs.nixpkgs-fmt); + + homeManagerModules.catppuccin = import ./modules/home-manager { inherit inputs sources; }; + + nixosModules.catppuccin = import ./modules/nixos { inherit inputs sources; }; + + packages = forAllSystems (pkgs: + let + mkEval = module: lib.evalModules { + modules = [ + module + { + _module = { + check = false; + args.lib = import ./modules/lib/mkExtLib.nix lib; + }; + } + ]; + }; + + mkDoc = name: options: + let + doc = pkgs.nixosOptionsDoc { + options = lib.filterAttrs (n: _: n != "_module") options; + documentType = "none"; + revision = if self ? rev then builtins.substring 0 7 self.rev else "dirty"; + }; + in + pkgs.runCommand "${name}-module-doc.md" { } '' + cat ${doc.optionsCommonMark} > $out + ''; + + hmEval = mkEval self.homeManagerModules.catppuccin; + nixosEval = mkEval self.nixosModules.catppuccin; + in + rec { + nixos-doc = mkDoc "nixos" nixosEval.options; + home-manager-doc = mkDoc "home-manager" hmEval.options; + default = home-manager-doc; + }); + + tests.x86_64-linux.modules = runTestFor "x86_64-linux" ./test.nix; + }; } diff --git a/modules/home-manager/alacritty.nix b/modules/home-manager/alacritty.nix index aa007650..2c0101c4 100644 --- a/modules/home-manager/alacritty.nix +++ b/modules/home-manager/alacritty.nix @@ -1,7 +1,7 @@ { config , pkgs , lib -, inputs +, sources , ... }: let @@ -15,7 +15,7 @@ in config.programs.alacritty.settings = let - file = "${inputs.alacritty}/catppuccin-${cfg.flavour}.yml"; + file = "${sources.alacritty}/catppuccin-${cfg.flavour}.yml"; in lib.mkIf enable (ctp.fromYaml pkgs file); } diff --git a/modules/home-manager/bat.nix b/modules/home-manager/bat.nix index 17fa479c..36e8e5aa 100644 --- a/modules/home-manager/bat.nix +++ b/modules/home-manager/bat.nix @@ -1,6 +1,6 @@ { config , lib -, inputs +, sources , ... }: let @@ -17,7 +17,7 @@ in config.theme = themeName; themes.${themeName} = { - src = inputs.bat; + src = sources.bat; file = "${themeName}.tmTheme"; }; }; diff --git a/modules/home-manager/bottom.nix b/modules/home-manager/bottom.nix index fe01da56..c58a7957 100644 --- a/modules/home-manager/bottom.nix +++ b/modules/home-manager/bottom.nix @@ -1,6 +1,6 @@ { config , lib -, inputs +, sources , ... }: let @@ -12,5 +12,5 @@ in options.programs.bottom.catppuccin = lib.ctp.mkCatppuccinOpt "bottom" config; - config.programs.bottom.settings = lib.mkIf enable (fromTOML (readFile "${inputs.bottom}/themes/${cfg.flavour}.toml")); + config.programs.bottom.settings = lib.mkIf enable (fromTOML (readFile "${sources.bottom}/themes/${cfg.flavour}.toml")); } diff --git a/modules/home-manager/btop.nix b/modules/home-manager/btop.nix index 3335cf21..f5a58e94 100644 --- a/modules/home-manager/btop.nix +++ b/modules/home-manager/btop.nix @@ -1,6 +1,6 @@ { config , lib -, inputs +, sources , ... }: let @@ -9,7 +9,7 @@ let themeFile = "catppuccin_${cfg.flavour}.theme"; themePath = "/themes/${themeFile}"; - theme = inputs.btop + themePath; + theme = sources.btop + themePath; in { options.programs.btop.catppuccin = diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 396eb8f4..b8521596 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -1,8 +1,8 @@ -inputs: { config - , pkgs - , lib - , ... - }: +{ inputs, sources }: { config + , pkgs + , lib + , ... + }: let extendedLib = import ../lib/mkExtLib.nix inputs.nixpkgs.lib; inherit (extendedLib) ctp; @@ -30,7 +30,7 @@ in ./tmux.nix ]; in - extendedLib.ctp.mapModules config pkgs extendedLib inputs files; + extendedLib.ctp.mapModules config pkgs extendedLib (sources pkgs) files; options.catppuccin = { flavour = lib.mkOption { diff --git a/modules/home-manager/fish.nix b/modules/home-manager/fish.nix index f851f222..d92e3bb0 100644 --- a/modules/home-manager/fish.nix +++ b/modules/home-manager/fish.nix @@ -1,6 +1,6 @@ { config -, pkgs , lib +, sources , ... }: let @@ -8,25 +8,22 @@ let cfg = config.programs.fish.catppuccin; enable = cfg.enable && config.programs.fish.enable; - theme = pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "fish"; - rev = "91e6d6721362be05a5c62e235ed8517d90c567c9"; - sha256 = "sha256-l9V7YMfJWhKDL65dNbxaddhaM6GJ0CFZ6z+4R6MJwBA="; - }; themeName = "Catppuccin ${ctp.mkUpper cfg.flavour}"; + themePath = "/themes/${themeName}.theme"; in { options.programs.fish.catppuccin = lib.ctp.mkCatppuccinOpt "fish" config; # xdg is required for this to work config = mkIf enable { - xdg.enable = lib.mkForce true; + xdg = { + enable = lib.mkForce true; + + configFile."fish${themePath}".source = "${sources.fish}${themePath}"; + }; programs.fish.shellInit = '' fish_config theme choose "${themeName}" ''; - xdg.configFile."fish/themes/${themeName}.theme".source = "${theme}/themes/${themeName}.theme"; }; } diff --git a/modules/home-manager/glamour.nix b/modules/home-manager/glamour.nix index bdd961b4..8729d59d 100644 --- a/modules/home-manager/glamour.nix +++ b/modules/home-manager/glamour.nix @@ -5,7 +5,7 @@ }: let cfg = config.programs.glamour.catppuccin; - enable = cfg.enable; + inherit (cfg) enable; version = "1.0.0"; diff --git a/modules/home-manager/helix.nix b/modules/home-manager/helix.nix index 3464d565..3811cdf6 100644 --- a/modules/home-manager/helix.nix +++ b/modules/home-manager/helix.nix @@ -1,6 +1,6 @@ { config , lib -, inputs +, sources , ... }: let @@ -28,6 +28,6 @@ in }; themes."catppuccin-${cfg.flavour}" = builtins.fromTOML - (builtins.readFile "${inputs.helix}/themes/${subdir}/catppuccin_${cfg.flavour}.toml"); + (builtins.readFile "${sources.helix}/themes/${subdir}/catppuccin_${cfg.flavour}.toml"); }; } diff --git a/modules/home-manager/lazygit.nix b/modules/home-manager/lazygit.nix index 640faef8..cbdc2531 100644 --- a/modules/home-manager/lazygit.nix +++ b/modules/home-manager/lazygit.nix @@ -1,7 +1,7 @@ { config -, pkgs , lib -, inputs +, pkgs +, sources , ... }: let @@ -14,7 +14,7 @@ in config.programs.lazygit.settings = let - file = "${inputs.lazygit}/themes/${cfg.flavour}.yml"; + file = "${sources.lazygit}/themes/${cfg.flavour}.yml"; in lib.mkIf enable (lib.ctp.fromYaml pkgs file); } diff --git a/modules/home-manager/mako.nix b/modules/home-manager/mako.nix index bb3ef393..2f1f6096 100644 --- a/modules/home-manager/mako.nix +++ b/modules/home-manager/mako.nix @@ -1,6 +1,7 @@ { config , pkgs , lib +, sources , ... }: let @@ -8,13 +9,7 @@ let cfg = config.services.mako.catppuccin; enable = cfg.enable && config.services.mako.enable; - theme = lib.ctp.fromINI pkgs (pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "mako"; - rev = "9dd088aa5f4529a3dd4d9760415e340664cb86df"; - hash = "sha256-nUzWkQVsIH4rrCFSP87mXAka6P+Td2ifNbTuP7NM/SQ="; - } + /src/${cfg.flavour}); + theme = lib.ctp.fromINI pkgs (sources.mako + /src/${cfg.flavour}); # Settings that need to be extracted and put in extraConfig extraConfigAttrs = lib.attrsets.getAttrs [ "urgency=high" ] theme; diff --git a/modules/home-manager/micro.nix b/modules/home-manager/micro.nix index 7efc2f12..e320774e 100644 --- a/modules/home-manager/micro.nix +++ b/modules/home-manager/micro.nix @@ -1,6 +1,6 @@ { config -, pkgs , lib +, sources , ... }: let @@ -8,15 +8,6 @@ let enable = cfg.enable && config.programs.micro.enable; themePath = "catppuccin-${cfg.flavour}.micro"; - theme = - pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "micro"; - rev = "ed8ef015f97c357575b5013e18042c9faa6c068a"; - sha256 = "/JwZ+5bLYjZWcV5vH22daLqVWbyJelqRyGa7V0b7EG8="; - } - + "/src/${themePath}"; in { options.programs.micro.catppuccin = @@ -28,7 +19,7 @@ in xdg = { # xdg is required for this to work enable = lib.mkForce true; - configFile."micro/colorschemes/${themePath}".source = theme; + configFile."micro/colorschemes/${themePath}".source = "${sources.micro}/src/${themePath}"; }; }; } diff --git a/modules/home-manager/polybar.nix b/modules/home-manager/polybar.nix index 9cb0bcc4..c740a03b 100644 --- a/modules/home-manager/polybar.nix +++ b/modules/home-manager/polybar.nix @@ -1,6 +1,6 @@ { config , lib -, inputs +, sources , ... }: let @@ -12,5 +12,5 @@ in lib.ctp.mkCatppuccinOpt "polybar" config; config.services.polybar.extraConfig = lib.mkIf enable - (builtins.readFile "${inputs.polybar}/themes/${cfg.flavour}.ini"); + (builtins.readFile "${sources.polybar}/themes/${cfg.flavour}.ini"); } diff --git a/modules/home-manager/starship.nix b/modules/home-manager/starship.nix index 9741a8e1..9cae070e 100644 --- a/modules/home-manager/starship.nix +++ b/modules/home-manager/starship.nix @@ -1,6 +1,6 @@ { config , lib -, inputs +, sources , ... }: let @@ -18,5 +18,5 @@ in format = lib.mkDefault "$all"; palette = "catppuccin_${cfg.flavour}"; } - // fromTOML (readFile "${inputs.starship}/palettes/${cfg.flavour}.toml")); + // fromTOML (readFile "${sources.starship}/palettes/${cfg.flavour}.toml")); } diff --git a/modules/home-manager/sway.nix b/modules/home-manager/sway.nix index e679f28a..f665776e 100644 --- a/modules/home-manager/sway.nix +++ b/modules/home-manager/sway.nix @@ -1,12 +1,12 @@ { config , lib -, inputs +, sources , ... }: let cfg = config.wayland.windowManager.sway.catppuccin; enable = cfg.enable && config.wayland.windowManager.sway.enable; - theme = "${inputs.sway}/themes/catppuccin-${cfg.flavour}"; + theme = "${sources.sway}/themes/catppuccin-${cfg.flavour}"; in { options.wayland.windowManager.sway.catppuccin = diff --git a/modules/home-manager/tmux.nix b/modules/home-manager/tmux.nix index 02f68d4b..3c6d323b 100644 --- a/modules/home-manager/tmux.nix +++ b/modules/home-manager/tmux.nix @@ -1,6 +1,7 @@ { config -, pkgs , lib +, pkgs +, sources , ... }: let @@ -8,19 +9,11 @@ let enable = cfg.enable && config.programs.tmux.enable; plugin = - let - rev = "4e48b09a76829edc7b55fbb15467cf0411f07931"; - in # TODO @getchoo: upstream this in nixpkgs pkgs.tmuxPlugins.mkTmuxPlugin { pluginName = "catppuccin"; - version = builtins.substring 0 7 rev; - src = pkgs.fetchFromGitHub { - owner = "catppuccin"; - repo = "tmux"; - inherit rev; - sha256 = "sha256-bXEsxt4ozl3cAzV3ZyvbPsnmy0RAdpLxHwN82gvjLdU="; - }; + version = builtins.substring 0 7 sources.tmux.rev; + src = sources.tmux; }; in { diff --git a/modules/lib/default.nix b/modules/lib/default.nix index b7903a2c..ee91c41d 100644 --- a/modules/lib/default.nix +++ b/modules/lib/default.nix @@ -83,9 +83,9 @@ in # a -> a -> [path] -> [path] # this imports a list of paths while inheriting # multiple attributes - mapModules = config: pkgs: extendedLib: inputs: + mapModules = config: pkgs: extendedLib: sources: map (m: (import m { - inherit config pkgs inputs; + inherit config pkgs sources; lib = extendedLib; })); diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index c5de46e1..16e7a40a 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,4 +1,4 @@ -inputs: { config, pkgs, lib, ... }: +{ inputs, sources }: { config, pkgs, lib, ... }: let extendedLib = import ../lib/mkExtLib.nix inputs.nixpkgs.lib; in @@ -9,7 +9,7 @@ in ./grub.nix ]; in - extendedLib.ctp.mapModules config pkgs extendedLib inputs files; + extendedLib.ctp.mapModules config pkgs extendedLib (sources pkgs) files; options.catppuccin = with extendedLib; { diff --git a/modules/nixos/grub.nix b/modules/nixos/grub.nix index 0d998223..296084fd 100644 --- a/modules/nixos/grub.nix +++ b/modules/nixos/grub.nix @@ -1,7 +1,7 @@ { config -, pkgs , lib -, inputs +, pkgs +, sources , ... }: let @@ -11,7 +11,7 @@ let # TODO @getchoo: upstream this in nixpkgs maybe? idk if they have grub themes theme = pkgs.runCommand "catppuccin-grub-theme" { } '' mkdir -p "$out" - cp -r ${inputs.grub}/src/catppuccin-${cfg.flavour}-grub-theme/* "$out"/ + cp -r ${sources.grub}/src/catppuccin-${cfg.flavour}-grub-theme/* "$out"/ ''; in { diff --git a/nvfetcher.toml b/nvfetcher.toml new file mode 100644 index 00000000..ce4ede59 --- /dev/null +++ b/nvfetcher.toml @@ -0,0 +1,71 @@ +[alacritty] +src.git = "https://github.com/catppuccin/alacritty.git" +fetch.github = "catppuccin/alacritty" + +[bat] +src.git = "https://github.com/catppuccin/bat.git" +fetch.github = "catppuccin/bat" + +[bottom] +src.git = "https://github.com/catppuccin/bottom.git" +fetch.github = "catppuccin/bottom" + +[btop] +src.git = "https://github.com/catppuccin/btop.git" +fetch.github = "catppuccin/btop" + +[fish] +src.git = "https://github.com/catppuccin/fish.git" +fetch.github = "catppuccin/fish" + +[glamour] +src.git = "https://github.com/catppuccin/glamour.git" +fetch.github = "catppuccin/glamour" + +[grub] +src.git = "https://github.com/catppuccin/grub.git" +fetch.github = "catppuccin/grub" + +[gtk] +src.git = "https://github.com/catppuccin/gtk.git" +fetch.github = "catppuccin/gtk" + +[helix] +src.git = "https://github.com/catppuccin/helix.git" +fetch.github = "catppuccin/helix" + +[kitty] +src.git = "https://github.com/catppuccin/kitty.git" +fetch.github = "catppuccin/kitty" + +[lazygit] +src.git = "https://github.com/catppuccin/lazygit.git" +fetch.github = "catppuccin/lazygit" + +[mako] +src.git = "https://github.com/catppuccin/mako.git" +fetch.github = "catppuccin/mako" + +[micro] +src.git = "https://github.com/catppuccin/micro.git" +fetch.github = "catppuccin/micro" + +[neovim] +src.git = "https://github.com/catppuccin/nvim.git" +fetch.github = "catppuccin/nvim" + +[polybar] +src.git = "https://github.com/catppuccin/polybar.git" +fetch.github = "catppuccin/polybar" + +[starship] +src.git = "https://github.com/catppuccin/starship.git" +fetch.github = "catppuccin/starship" + +[sway] +src.git = "https://github.com/catppuccin/sway.git" +fetch.github = "catppuccin/sway" + +[tmux] +src.git = "https://github.com/catppuccin/tmux.git" +fetch.github = "catppuccin/tmux" diff --git a/outputs.nix b/outputs.nix deleted file mode 100644 index dd1dc9b5..00000000 --- a/outputs.nix +++ /dev/null @@ -1,70 +0,0 @@ -{ self, nixpkgs, home-manager, ... }@inputs: -let - systems = [ - "x86_64-linux" - "aarch64-linux" - "x86_64-darwin" - "aarch64-darwin" - ]; - - inherit (nixpkgs) lib; - - forAllSystems = fn: lib.genAttrs systems (s: fn nixpkgsFor.${s}); - nixpkgsFor = lib.genAttrs systems (system: import nixpkgs { inherit system; }); - - nixosLib = import (nixpkgs + "/nixos/lib") { }; - runTestFor = system: test: nixosLib.runTest { - imports = [ test ]; - - hostPkgs = nixpkgsFor.${system}; - - _module.args = { - catppuccin = self; - inherit nixpkgs home-manager; - }; - }; -in -{ - formatter = forAllSystems (pkgs: pkgs.nixpkgs-fmt); - - homeManagerModules.catppuccin = import ./modules/home-manager inputs; - - nixosModules.catppuccin = import ./modules/nixos inputs; - - packages = forAllSystems (pkgs: - let - mkEval = module: lib.evalModules { - modules = [ - module - { - _module = { - check = false; - args.lib = import ./modules/lib/mkExtLib.nix lib; - }; - } - ]; - }; - - mkDoc = name: options: - let - doc = pkgs.nixosOptionsDoc { - options = lib.filterAttrs (n: _: n != "_module") options; - documentType = "none"; - revision = if self ? rev then builtins.substring 0 7 self.rev else "dirty"; - }; - in - pkgs.runCommand "${name}-module-doc.md" { } '' - cat ${doc.optionsCommonMark} > $out - ''; - - hmEval = mkEval self.homeManagerModules.catppuccin; - nixosEval = mkEval self.nixosModules.catppuccin; - in - rec { - nixos-doc = mkDoc "nixos" nixosEval.options; - home-manager-doc = mkDoc "home-manager" hmEval.options; - default = home-manager-doc; - }); - - tests.x86_64-linux.modules = runTestFor "x86_64-linux" ./test.nix; -} From 7eb41c99eefdae2623337ce4d3d2e4efc1a318d7 Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 30 Jul 2023 17:13:41 -0400 Subject: [PATCH 11/17] docs: add information about nvfetcher --- CONTRIBUTING.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 64096892..441441eb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,10 +7,16 @@ Create a file in `modules//` with the name of the port. Add the file to `catppuccin.enable` and `catppuccin.flavour` options, and optionally the `catppuccin.accent` option. `catppuccin.flavour` and `catppuccin.accent` should default to `config.catppuccin.flavour` and `config.catppuccin.accent`, respectively. -[Flake inputs](https://nixos.wiki/wiki/Flakes#Input_schema) should also be used over -`fetchFromGitHub` when themes are not avalible in nixpkgs - this in order to reduce -[IFD](https://nixos.wiki/wiki/Import_From_Derivation) and allow for auto-updating the -specified commits for repositories. + +[nvfetcher](https://github.com/berberman/nvfetcher) is used to track our upstream +sources to use in modules. This allows us to reduce [IFD](https://nixos.wiki/wiki/Import_From_Derivation) +and auto-update all themes. Most repositories can be specified like so: + +```toml +[program_name] +src.git = "https://github.com/catppuccin/program_name.git" +fetch.github = "catppuccin/program_name" +``` After creating your module, add the options to enable it in `test.nix` under the `nodes.machine` attrset. This will allow for your configuration to be tested along From e6447baf0c0af097ed28f75a526af6ded06b2870 Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 2 Nov 2023 13:03:19 -0400 Subject: [PATCH 12/17] chore: don't include flake-compat in flake inputs while this does make us lose out on easy updating, i think it's nice not have this as a required dependency for flake users --- default.nix | 5 ++--- flake.lock | 17 ----------------- flake.nix | 5 ----- 3 files changed, 2 insertions(+), 25 deletions(-) diff --git a/default.nix b/default.nix index 2cccff28..4393224e 100644 --- a/default.nix +++ b/default.nix @@ -1,9 +1,8 @@ (import ( - let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; - sha256 = lock.nodes.flake-compat.locked.narHash; + url = "https://github.com/edolstra/flake-compat/archive/0f9255e01c2351cc7d116c072cb317785dd33b33.tar.gz"; + sha256 = "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U="; } ) { src = ./.; } diff --git a/flake.lock b/flake.lock index 35456a61..fecae9c8 100644 --- a/flake.lock +++ b/flake.lock @@ -1,21 +1,5 @@ { "nodes": { - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -53,7 +37,6 @@ }, "root": { "inputs": { - "flake-compat": "flake-compat", "home-manager": "home-manager", "nixpkgs": "nixpkgs" } diff --git a/flake.nix b/flake.nix index daeaf0bd..01225116 100644 --- a/flake.nix +++ b/flake.nix @@ -8,11 +8,6 @@ url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; - - flake-compat = { - url = "github:edolstra/flake-compat"; - flake = false; - }; }; outputs = { self, nixpkgs, home-manager, ... }@inputs: From 5fe625d906a50bcbe2971b84255f0e4e0c9bba4b Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 2 Nov 2023 13:04:42 -0400 Subject: [PATCH 13/17] chore: update flake inputs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'home-manager': 'github:nix-community/home-manager/f58889c07efa8e1328fdf93dc1796ec2a5c47f38' (2023-07-29) → 'github:nix-community/home-manager/48b0a30202516e25d9885525fbb200a045f23f26' (2023-11-01) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/2a9d660ff0f7ffde9d73be328ee6e6f10ef66b28' (2023-07-28) → 'github:NixOS/nixpkgs/0cbe9f69c234a7700596e943bfae7ef27a31b735' (2023-10-29) --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index fecae9c8..7423a05a 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1690652600, - "narHash": "sha256-Dy09g7mezToVwtFPyY25fAx1hzqNXv73/QmY5/qyR44=", + "lastModified": 1698873617, + "narHash": "sha256-FfGFcfbULwbK1vD+H0rslIOfmy4g8f2hXiPkQG3ZCTk=", "owner": "nix-community", "repo": "home-manager", - "rev": "f58889c07efa8e1328fdf93dc1796ec2a5c47f38", + "rev": "48b0a30202516e25d9885525fbb200a045f23f26", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1690548937, - "narHash": "sha256-x3ZOPGLvtC0/+iFAg9Kvqm/8hTAIkGjc634SqtgaXTA=", + "lastModified": 1698611440, + "narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2a9d660ff0f7ffde9d73be328ee6e6f10ef66b28", + "rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735", "type": "github" }, "original": { From 6c10aecf53003c697083575265e9a0b18d78e44d Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 2 Nov 2023 13:07:01 -0400 Subject: [PATCH 14/17] chore: update nvfetcher sources --- _sources/generated.json | 136 +++++++++++++++++++++++++++++++--------- _sources/generated.nix | 104 +++++++++++++++++++++--------- 2 files changed, 184 insertions(+), 56 deletions(-) diff --git a/_sources/generated.json b/_sources/generated.json index c43e2a0e..cfb2acf1 100644 --- a/_sources/generated.json +++ b/_sources/generated.json @@ -61,7 +61,7 @@ }, "btop": { "cargoLocks": null, - "date": "2023-06-07", + "date": "2023-10-07", "extract": null, "name": "btop", "passthru": null, @@ -73,11 +73,51 @@ "name": null, "owner": "catppuccin", "repo": "btop", - "rev": "89ff712eb62747491a76a7902c475007244ff202", - "sha256": "sha256-J3UezOQMDdxpflGax0rGBF/XMiKqdqZXuX4KMVGTxFk=", + "rev": "c6469190f2ecf25f017d6120bf4e050e6b1d17af", + "sha256": "sha256-jodJl4f2T9ViNqsY9fk8IV62CrpC5hy7WK3aRpu70Cs=", "type": "github" }, - "version": "89ff712eb62747491a76a7902c475007244ff202" + "version": "c6469190f2ecf25f017d6120bf4e050e6b1d17af" + }, + "fish": { + "cargoLocks": null, + "date": "2023-11-02", + "extract": null, + "name": "fish", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "fish", + "rev": "0ce27b518e8ead555dec34dd8be3df5bd75cff8e", + "sha256": "sha256-Dc/zdxfzAUM5NX8PxzfljRbYvO9f9syuLO8yBr+R3qg=", + "type": "github" + }, + "version": "0ce27b518e8ead555dec34dd8be3df5bd75cff8e" + }, + "glamour": { + "cargoLocks": null, + "date": "2023-05-01", + "extract": null, + "name": "glamour", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "glamour", + "rev": "3ef2c9533b6d3c4d6309a850765500179cf32d1c", + "sha256": "sha256-HD7g9unpRYLIj00FOqLiiInMYgGgYujjvAeYOa+V76Y=", + "type": "github" + }, + "version": "3ef2c9533b6d3c4d6309a850765500179cf32d1c" }, "grub": { "cargoLocks": null, @@ -101,7 +141,7 @@ }, "gtk": { "cargoLocks": null, - "date": "2023-07-04", + "date": "2023-10-05", "extract": null, "name": "gtk", "passthru": null, @@ -113,15 +153,15 @@ "name": null, "owner": "catppuccin", "repo": "gtk", - "rev": "d6d1e951e48fdadb61838aa5238c59db40f4d38e", - "sha256": "sha256-wgZF8mQhUvWNds0zlWFoefRnBk7lqy2dfAbDxcMPHl0=", + "rev": "9082969c1c33b0dc8d8e9a8a241d029f2d864599", + "sha256": "sha256-95H/jWbaDYX+tdhLODMcKunh2EXelf5Wd/vG9ZKFdSc=", "type": "github" }, - "version": "d6d1e951e48fdadb61838aa5238c59db40f4d38e" + "version": "9082969c1c33b0dc8d8e9a8a241d029f2d864599" }, "helix": { "cargoLocks": null, - "date": "2023-04-06", + "date": "2023-10-20", "extract": null, "name": "helix", "passthru": null, @@ -133,11 +173,11 @@ "name": null, "owner": "catppuccin", "repo": "helix", - "rev": "5677c16dc95297a804caea9161072ff174018fdd", - "sha256": "sha256-aa8KZ7/1TXcBqaV/TYOZ8rpusOf5QeQ9i2Upnncbziw=", + "rev": "8313c7250fcbbb22c6680db332669073ec6b28c2", + "sha256": "sha256-qEXhj/Mpm+aqThqEq5DlPJD8nsbPov9CNMgG9s4E02g=", "type": "github" }, - "version": "5677c16dc95297a804caea9161072ff174018fdd" + "version": "8313c7250fcbbb22c6680db332669073ec6b28c2" }, "kitty": { "cargoLocks": null, @@ -161,7 +201,7 @@ }, "lazygit": { "cargoLocks": null, - "date": "2023-05-02", + "date": "2023-09-19", "extract": null, "name": "lazygit", "passthru": null, @@ -173,15 +213,55 @@ "name": null, "owner": "catppuccin", "repo": "lazygit", - "rev": "b2ecb6d41b6f54a82104879573c538e8bdaeb0bf", - "sha256": "sha256-9BBmWRcjNaJE9T0RKVEJaSnkrbMom0CLYE8PzAT6yFw=", + "rev": "0543c28e8af1a935f8c512ad9451facbcc17d8a8", + "sha256": "sha256-OVihY5E+elPKag2H4RyWiSv+MdIqHtfGNM3/1u2ik6U=", + "type": "github" + }, + "version": "0543c28e8af1a935f8c512ad9451facbcc17d8a8" + }, + "mako": { + "cargoLocks": null, + "date": "2023-08-12", + "extract": null, + "name": "mako", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "mako", + "rev": "9dd088aa5f4529a3dd4d9760415e340664cb86df", + "sha256": "sha256-nUzWkQVsIH4rrCFSP87mXAka6P+Td2ifNbTuP7NM/SQ=", + "type": "github" + }, + "version": "9dd088aa5f4529a3dd4d9760415e340664cb86df" + }, + "micro": { + "cargoLocks": null, + "date": "2022-09-27", + "extract": null, + "name": "micro", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "micro", + "rev": "ed8ef015f97c357575b5013e18042c9faa6c068a", + "sha256": "sha256-/JwZ+5bLYjZWcV5vH22daLqVWbyJelqRyGa7V0b7EG8=", "type": "github" }, - "version": "b2ecb6d41b6f54a82104879573c538e8bdaeb0bf" + "version": "ed8ef015f97c357575b5013e18042c9faa6c068a" }, "neovim": { "cargoLocks": null, - "date": "2023-07-29", + "date": "2023-11-01", "extract": null, "name": "neovim", "passthru": null, @@ -193,11 +273,11 @@ "name": null, "owner": "catppuccin", "repo": "nvim", - "rev": "057c34f849cf21059487d849e2f3b3efcd4ee0eb", - "sha256": "sha256-MSZcIrV3vvgb5mlMpO5uRlAYoENm2pZyuZbV5Q9Vg58=", + "rev": "40dc9f0621c55bd40da4ad0731fac44d15bb393a", + "sha256": "sha256-m1SYlSUVO9BbxUzPZ1VFkfCSHVTYSp65TX3mUm+kjeo=", "type": "github" }, - "version": "057c34f849cf21059487d849e2f3b3efcd4ee0eb" + "version": "40dc9f0621c55bd40da4ad0731fac44d15bb393a" }, "polybar": { "cargoLocks": null, @@ -241,7 +321,7 @@ }, "sway": { "cargoLocks": null, - "date": "2023-02-23", + "date": "2023-08-20", "extract": null, "name": "sway", "passthru": null, @@ -253,15 +333,15 @@ "name": null, "owner": "catppuccin", "repo": "sway", - "rev": "c89098fc3517b64f0422aaaccb98dcab6ae9348f", - "sha256": "sha256-6Cvsmdl3OILz1vZovyBIuuSpm207I3W0dmUGowR9Ugk=", + "rev": "c976222e5cacbba7946fb82163944924bd5fac12", + "sha256": "sha256-VEyjHFjNFQQB20NGciO8y2m/rWkASzQZQekzGZ88pLg=", "type": "github" }, - "version": "c89098fc3517b64f0422aaaccb98dcab6ae9348f" + "version": "c976222e5cacbba7946fb82163944924bd5fac12" }, "tmux": { "cargoLocks": null, - "date": "2023-06-30", + "date": "2023-11-01", "extract": null, "name": "tmux", "passthru": null, @@ -273,10 +353,10 @@ "name": null, "owner": "catppuccin", "repo": "tmux", - "rev": "e7b50832f9bc59b0b5ef5316ba2cd6f61e4e22fc", - "sha256": "sha256-9ZfUqEKEexSh06QyR5C+tYd4tNfBi3PsA+STzUv4+/s=", + "rev": "47e33044b4b47b1c1faca1e42508fc92be12131a", + "sha256": "sha256-kn3kf7eiiwXj57tgA7fs5N2+B2r441OtBlM8IBBLl4I=", "type": "github" }, - "version": "e7b50832f9bc59b0b5ef5316ba2cd6f61e4e22fc" + "version": "47e33044b4b47b1c1faca1e42508fc92be12131a" } } \ No newline at end of file diff --git a/_sources/generated.nix b/_sources/generated.nix index bcd2199b..7005e518 100644 --- a/_sources/generated.nix +++ b/_sources/generated.nix @@ -39,15 +39,39 @@ }; btop = { pname = "btop"; - version = "89ff712eb62747491a76a7902c475007244ff202"; + version = "c6469190f2ecf25f017d6120bf4e050e6b1d17af"; src = fetchFromGitHub { owner = "catppuccin"; repo = "btop"; - rev = "89ff712eb62747491a76a7902c475007244ff202"; + rev = "c6469190f2ecf25f017d6120bf4e050e6b1d17af"; fetchSubmodules = false; - sha256 = "sha256-J3UezOQMDdxpflGax0rGBF/XMiKqdqZXuX4KMVGTxFk="; + sha256 = "sha256-jodJl4f2T9ViNqsY9fk8IV62CrpC5hy7WK3aRpu70Cs="; }; - date = "2023-06-07"; + date = "2023-10-07"; + }; + fish = { + pname = "fish"; + version = "0ce27b518e8ead555dec34dd8be3df5bd75cff8e"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "fish"; + rev = "0ce27b518e8ead555dec34dd8be3df5bd75cff8e"; + fetchSubmodules = false; + sha256 = "sha256-Dc/zdxfzAUM5NX8PxzfljRbYvO9f9syuLO8yBr+R3qg="; + }; + date = "2023-11-02"; + }; + glamour = { + pname = "glamour"; + version = "3ef2c9533b6d3c4d6309a850765500179cf32d1c"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "glamour"; + rev = "3ef2c9533b6d3c4d6309a850765500179cf32d1c"; + fetchSubmodules = false; + sha256 = "sha256-HD7g9unpRYLIj00FOqLiiInMYgGgYujjvAeYOa+V76Y="; + }; + date = "2023-05-01"; }; grub = { pname = "grub"; @@ -63,27 +87,27 @@ }; gtk = { pname = "gtk"; - version = "d6d1e951e48fdadb61838aa5238c59db40f4d38e"; + version = "9082969c1c33b0dc8d8e9a8a241d029f2d864599"; src = fetchFromGitHub { owner = "catppuccin"; repo = "gtk"; - rev = "d6d1e951e48fdadb61838aa5238c59db40f4d38e"; + rev = "9082969c1c33b0dc8d8e9a8a241d029f2d864599"; fetchSubmodules = false; - sha256 = "sha256-wgZF8mQhUvWNds0zlWFoefRnBk7lqy2dfAbDxcMPHl0="; + sha256 = "sha256-95H/jWbaDYX+tdhLODMcKunh2EXelf5Wd/vG9ZKFdSc="; }; - date = "2023-07-04"; + date = "2023-10-05"; }; helix = { pname = "helix"; - version = "5677c16dc95297a804caea9161072ff174018fdd"; + version = "8313c7250fcbbb22c6680db332669073ec6b28c2"; src = fetchFromGitHub { owner = "catppuccin"; repo = "helix"; - rev = "5677c16dc95297a804caea9161072ff174018fdd"; + rev = "8313c7250fcbbb22c6680db332669073ec6b28c2"; fetchSubmodules = false; - sha256 = "sha256-aa8KZ7/1TXcBqaV/TYOZ8rpusOf5QeQ9i2Upnncbziw="; + sha256 = "sha256-qEXhj/Mpm+aqThqEq5DlPJD8nsbPov9CNMgG9s4E02g="; }; - date = "2023-04-06"; + date = "2023-10-20"; }; kitty = { pname = "kitty"; @@ -99,27 +123,51 @@ }; lazygit = { pname = "lazygit"; - version = "b2ecb6d41b6f54a82104879573c538e8bdaeb0bf"; + version = "0543c28e8af1a935f8c512ad9451facbcc17d8a8"; src = fetchFromGitHub { owner = "catppuccin"; repo = "lazygit"; - rev = "b2ecb6d41b6f54a82104879573c538e8bdaeb0bf"; + rev = "0543c28e8af1a935f8c512ad9451facbcc17d8a8"; fetchSubmodules = false; - sha256 = "sha256-9BBmWRcjNaJE9T0RKVEJaSnkrbMom0CLYE8PzAT6yFw="; + sha256 = "sha256-OVihY5E+elPKag2H4RyWiSv+MdIqHtfGNM3/1u2ik6U="; }; - date = "2023-05-02"; + date = "2023-09-19"; + }; + mako = { + pname = "mako"; + version = "9dd088aa5f4529a3dd4d9760415e340664cb86df"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "mako"; + rev = "9dd088aa5f4529a3dd4d9760415e340664cb86df"; + fetchSubmodules = false; + sha256 = "sha256-nUzWkQVsIH4rrCFSP87mXAka6P+Td2ifNbTuP7NM/SQ="; + }; + date = "2023-08-12"; + }; + micro = { + pname = "micro"; + version = "ed8ef015f97c357575b5013e18042c9faa6c068a"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "micro"; + rev = "ed8ef015f97c357575b5013e18042c9faa6c068a"; + fetchSubmodules = false; + sha256 = "sha256-/JwZ+5bLYjZWcV5vH22daLqVWbyJelqRyGa7V0b7EG8="; + }; + date = "2022-09-27"; }; neovim = { pname = "neovim"; - version = "057c34f849cf21059487d849e2f3b3efcd4ee0eb"; + version = "40dc9f0621c55bd40da4ad0731fac44d15bb393a"; src = fetchFromGitHub { owner = "catppuccin"; repo = "nvim"; - rev = "057c34f849cf21059487d849e2f3b3efcd4ee0eb"; + rev = "40dc9f0621c55bd40da4ad0731fac44d15bb393a"; fetchSubmodules = false; - sha256 = "sha256-MSZcIrV3vvgb5mlMpO5uRlAYoENm2pZyuZbV5Q9Vg58="; + sha256 = "sha256-m1SYlSUVO9BbxUzPZ1VFkfCSHVTYSp65TX3mUm+kjeo="; }; - date = "2023-07-29"; + date = "2023-11-01"; }; polybar = { pname = "polybar"; @@ -147,26 +195,26 @@ }; sway = { pname = "sway"; - version = "c89098fc3517b64f0422aaaccb98dcab6ae9348f"; + version = "c976222e5cacbba7946fb82163944924bd5fac12"; src = fetchFromGitHub { owner = "catppuccin"; repo = "sway"; - rev = "c89098fc3517b64f0422aaaccb98dcab6ae9348f"; + rev = "c976222e5cacbba7946fb82163944924bd5fac12"; fetchSubmodules = false; - sha256 = "sha256-6Cvsmdl3OILz1vZovyBIuuSpm207I3W0dmUGowR9Ugk="; + sha256 = "sha256-VEyjHFjNFQQB20NGciO8y2m/rWkASzQZQekzGZ88pLg="; }; - date = "2023-02-23"; + date = "2023-08-20"; }; tmux = { pname = "tmux"; - version = "e7b50832f9bc59b0b5ef5316ba2cd6f61e4e22fc"; + version = "47e33044b4b47b1c1faca1e42508fc92be12131a"; src = fetchFromGitHub { owner = "catppuccin"; repo = "tmux"; - rev = "e7b50832f9bc59b0b5ef5316ba2cd6f61e4e22fc"; + rev = "47e33044b4b47b1c1faca1e42508fc92be12131a"; fetchSubmodules = false; - sha256 = "sha256-9ZfUqEKEexSh06QyR5C+tYd4tNfBi3PsA+STzUv4+/s="; + sha256 = "sha256-kn3kf7eiiwXj57tgA7fs5N2+B2r441OtBlM8IBBLl4I="; }; - date = "2023-06-30"; + date = "2023-11-01"; }; } From d0c74e6f140bf01beab51d83e5aead8dc69252cc Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 2 Nov 2023 13:09:28 -0400 Subject: [PATCH 15/17] refactor: don't instantiate nixpkgs in flake + cleanup vm test --- .github/workflows/test-vm.yml | 2 +- flake.nix | 43 ++++++++++++----------------------- test.nix | 10 ++++---- 3 files changed, 21 insertions(+), 34 deletions(-) diff --git a/.github/workflows/test-vm.yml b/.github/workflows/test-vm.yml index 35051e61..11dfbece 100644 --- a/.github/workflows/test-vm.yml +++ b/.github/workflows/test-vm.yml @@ -25,4 +25,4 @@ jobs: - uses: DeterminateSystems/magic-nix-cache-action@main - name: Run VM - run: nix build -Lv .#tests.x86_64-linux.modules + run: nix build -Lv .#checks.x86_64-linux.module-vm-test diff --git a/flake.nix b/flake.nix index 01225116..30d09482 100644 --- a/flake.nix +++ b/flake.nix @@ -10,7 +10,7 @@ }; }; - outputs = { self, nixpkgs, home-manager, ... }@inputs: + outputs = { self, nixpkgs, ... }@inputs: let systems = [ "x86_64-linux" @@ -21,20 +21,7 @@ inherit (nixpkgs) lib; - forAllSystems = fn: lib.genAttrs systems (s: fn nixpkgsFor.${s}); - nixpkgsFor = lib.genAttrs systems (system: import nixpkgs { inherit system; }); - - nixosLib = import (nixpkgs + "/nixos/lib") { }; - runTestFor = system: test: nixosLib.runTest { - imports = [ test ]; - - hostPkgs = nixpkgsFor.${system}; - - _module.args = { - catppuccin = self; - inherit nixpkgs home-manager; - }; - }; + forAllSystems = fn: lib.genAttrs systems (s: fn nixpkgs.legacyPackages.${s}); sources = pkgs: let @@ -44,6 +31,10 @@ builtins.mapAttrs (_: p: p.src) s; in { + checks = forAllSystems (pkgs: lib.optionalAttrs pkgs.stdenv.isLinux { + module-vm-test = pkgs.nixosTest (import ./test.nix { inherit self inputs; }); + }); + formatter = forAllSystems (pkgs: pkgs.nixpkgs-fmt); homeManagerModules.catppuccin = import ./modules/home-manager { inherit inputs sources; }; @@ -52,7 +43,7 @@ packages = forAllSystems (pkgs: let - mkEval = module: lib.evalModules { + eval = module: lib.evalModules { modules = [ module { @@ -64,27 +55,23 @@ ]; }; - mkDoc = name: options: + mkDoc = name: module: let doc = pkgs.nixosOptionsDoc { - options = lib.filterAttrs (n: _: n != "_module") options; + options = lib.filterAttrs (n: _: n != "_module") (eval module).options; documentType = "none"; - revision = if self ? rev then builtins.substring 0 7 self.rev else "dirty"; + revision = builtins.substring 0 7 self.rev or "dirty"; }; in pkgs.runCommand "${name}-module-doc.md" { } '' cat ${doc.optionsCommonMark} > $out ''; - - hmEval = mkEval self.homeManagerModules.catppuccin; - nixosEval = mkEval self.nixosModules.catppuccin; in - rec { - nixos-doc = mkDoc "nixos" nixosEval.options; - home-manager-doc = mkDoc "home-manager" hmEval.options; - default = home-manager-doc; - }); + { + nixos-doc = mkDoc "nixos" self.nixosModules.catppuccin; + home-manager-doc = mkDoc "home-manager" self.homeManagerModules.catppuccin; - tests.x86_64-linux.modules = runTestFor "x86_64-linux" ./test.nix; + default = self.packages.${pkgs.system}.home-manager-doc; + }); }; } diff --git a/test.nix b/test.nix index 16b3d144..c23eb85f 100644 --- a/test.nix +++ b/test.nix @@ -1,5 +1,5 @@ -{ home-manager -, catppuccin +{ self +, inputs , ... }: let @@ -21,8 +21,8 @@ in nodes.machine = { lib, ... }: { imports = [ - catppuccin.nixosModules.catppuccin - home-manager.nixosModules.default + self.nixosModules.catppuccin + inputs.home-manager.nixosModules.default common ]; @@ -37,7 +37,7 @@ in home-manager.users.test = { imports = [ - catppuccin.homeManagerModules.catppuccin + self.homeManagerModules.catppuccin ]; inherit (common) catppuccin; From cecf37c9524c5cbffffc9cf171d36f95bc75a115 Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 2 Nov 2023 13:23:32 -0400 Subject: [PATCH 16/17] fix(home-manager): update paths from new lazygit theme revision --- modules/home-manager/lazygit.nix | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/modules/home-manager/lazygit.nix b/modules/home-manager/lazygit.nix index cbdc2531..400c8c72 100644 --- a/modules/home-manager/lazygit.nix +++ b/modules/home-manager/lazygit.nix @@ -5,16 +5,25 @@ , ... }: let + inherit (lib) ctp; cfg = config.programs.lazygit.catppuccin; enable = cfg.enable && config.programs.lazygit.enable; + + themePath = "/${cfg.flavour}/${cfg.accent}.yml"; in { options.programs.lazygit.catppuccin = - lib.ctp.mkCatppuccinOpt "lazygit" config; + lib.ctp.mkCatppuccinOpt "lazygit" config // { + accent = ctp.mkAccentOpt "lazygit" config; + + }; + + config = lib.mkIf enable { - config.programs.lazygit.settings = - let - file = "${sources.lazygit}/themes/${cfg.flavour}.yml"; - in - lib.mkIf enable (lib.ctp.fromYaml pkgs file); + programs.lazygit.settings = + let + file = "${sources.lazygit}/themes/${themePath}"; + in + lib.ctp.fromYaml pkgs file; + }; } From 1693e308e626c44a01081c4d9c6816c79f9702c9 Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 2 Nov 2023 13:36:17 -0400 Subject: [PATCH 17/17] feat(lib)!: use constant module arguments automatically --- modules/home-manager/alacritty.nix | 5 ++--- modules/home-manager/bat.nix | 2 +- modules/home-manager/bottom.nix | 13 ++++++++++--- modules/home-manager/btop.nix | 2 +- modules/home-manager/default.nix | 10 +++------- modules/home-manager/fish.nix | 2 +- modules/home-manager/glamour.nix | 2 +- modules/home-manager/gtk.nix | 4 ++-- modules/home-manager/helix.nix | 2 +- modules/home-manager/kitty.nix | 2 +- modules/home-manager/lazygit.nix | 11 +++-------- modules/home-manager/mako.nix | 4 ++-- modules/home-manager/micro.nix | 2 +- modules/home-manager/neovim.nix | 2 +- modules/home-manager/polybar.nix | 2 +- modules/home-manager/starship.nix | 2 +- modules/home-manager/sway.nix | 2 +- modules/home-manager/tmux.nix | 2 +- modules/lib/default.nix | 17 +++++++++-------- modules/lib/mkExtLib.nix | 2 +- modules/nixos/default.nix | 6 +++--- modules/nixos/grub.nix | 2 +- 22 files changed, 48 insertions(+), 50 deletions(-) diff --git a/modules/home-manager/alacritty.nix b/modules/home-manager/alacritty.nix index 2c0101c4..ba159daf 100644 --- a/modules/home-manager/alacritty.nix +++ b/modules/home-manager/alacritty.nix @@ -1,5 +1,4 @@ { config -, pkgs , lib , sources , ... @@ -11,11 +10,11 @@ let in { options.programs.alacritty.catppuccin = - ctp.mkCatppuccinOpt "alacritty" config; + ctp.mkCatppuccinOpt "alacritty"; config.programs.alacritty.settings = let file = "${sources.alacritty}/catppuccin-${cfg.flavour}.yml"; in - lib.mkIf enable (ctp.fromYaml pkgs file); + lib.mkIf enable (ctp.fromYaml file); } diff --git a/modules/home-manager/bat.nix b/modules/home-manager/bat.nix index 36e8e5aa..ac88fdd9 100644 --- a/modules/home-manager/bat.nix +++ b/modules/home-manager/bat.nix @@ -10,7 +10,7 @@ let in { options.programs.bat.catppuccin = - lib.ctp.mkCatppuccinOpt "bat" config; + lib.ctp.mkCatppuccinOpt "bat"; config = lib.mkIf enable { programs.bat = { diff --git a/modules/home-manager/bottom.nix b/modules/home-manager/bottom.nix index c58a7957..dbe990a5 100644 --- a/modules/home-manager/bottom.nix +++ b/modules/home-manager/bottom.nix @@ -4,13 +4,20 @@ , ... }: let - inherit (builtins) fromTOML readFile; cfg = config.programs.bottom.catppuccin; enable = cfg.enable && config.programs.bottom.enable; in { options.programs.bottom.catppuccin = - lib.ctp.mkCatppuccinOpt "bottom" config; + lib.ctp.mkCatppuccinOpt "bottom"; - config.programs.bottom.settings = lib.mkIf enable (fromTOML (readFile "${sources.bottom}/themes/${cfg.flavour}.toml")); + config = lib.mkIf enable { + + programs.bottom = { + + settings = builtins.fromTOML ( + builtins.readFile "${sources.bottom}/themes/${cfg.flavour}.toml" + ); + }; + }; } diff --git a/modules/home-manager/btop.nix b/modules/home-manager/btop.nix index f5a58e94..a6605f52 100644 --- a/modules/home-manager/btop.nix +++ b/modules/home-manager/btop.nix @@ -13,7 +13,7 @@ let in { options.programs.btop.catppuccin = - lib.ctp.mkCatppuccinOpt "btop" config; + lib.ctp.mkCatppuccinOpt "btop"; config = lib.mkIf enable { diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index b8521596..29c697a0 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -1,10 +1,6 @@ -{ inputs, sources }: { config - , pkgs - , lib - , ... - }: +{ inputs, ... }@flakeArgs: { lib, pkgs, ... }@systemArgs: let - extendedLib = import ../lib/mkExtLib.nix inputs.nixpkgs.lib; + extendedLib = import ../lib/mkExtLib.nix inputs.nixpkgs.lib (flakeArgs // systemArgs); inherit (extendedLib) ctp; in { @@ -30,7 +26,7 @@ in ./tmux.nix ]; in - extendedLib.ctp.mapModules config pkgs extendedLib (sources pkgs) files; + extendedLib.ctp.mapModules extendedLib files; options.catppuccin = { flavour = lib.mkOption { diff --git a/modules/home-manager/fish.nix b/modules/home-manager/fish.nix index d92e3bb0..95400f85 100644 --- a/modules/home-manager/fish.nix +++ b/modules/home-manager/fish.nix @@ -12,7 +12,7 @@ let themePath = "/themes/${themeName}.theme"; in { - options.programs.fish.catppuccin = lib.ctp.mkCatppuccinOpt "fish" config; + options.programs.fish.catppuccin = lib.ctp.mkCatppuccinOpt "fish"; # xdg is required for this to work config = mkIf enable { diff --git a/modules/home-manager/glamour.nix b/modules/home-manager/glamour.nix index 8729d59d..b2b286fc 100644 --- a/modules/home-manager/glamour.nix +++ b/modules/home-manager/glamour.nix @@ -18,7 +18,7 @@ let in { options.programs.glamour.catppuccin = - lib.ctp.mkCatppuccinOpt "glamour" config; + lib.ctp.mkCatppuccinOpt "glamour"; config = { home.sessionVariables = lib.mkIf enable { diff --git a/modules/home-manager/gtk.nix b/modules/home-manager/gtk.nix index 44879685..9c70c60e 100644 --- a/modules/home-manager/gtk.nix +++ b/modules/home-manager/gtk.nix @@ -10,9 +10,9 @@ let in { options.gtk.catppuccin = - ctp.mkCatppuccinOpt "gtk" config + ctp.mkCatppuccinOpt "gtk" // { - accent = ctp.mkAccentOpt "gtk" config; + accent = ctp.mkAccentOpt "gtk"; size = mkOption { type = types.enum [ "standard" "compact" ]; default = "standard"; diff --git a/modules/home-manager/helix.nix b/modules/home-manager/helix.nix index 3811cdf6..e01caf0b 100644 --- a/modules/home-manager/helix.nix +++ b/modules/home-manager/helix.nix @@ -9,7 +9,7 @@ let in { options.programs.helix.catppuccin = with lib; - ctp.mkCatppuccinOpt "helix" config + ctp.mkCatppuccinOpt "helix" // { useItalics = mkEnableOption "Italics in Catppuccin theme for Helix"; }; diff --git a/modules/home-manager/kitty.nix b/modules/home-manager/kitty.nix index 847d8068..7e2f1380 100644 --- a/modules/home-manager/kitty.nix +++ b/modules/home-manager/kitty.nix @@ -9,7 +9,7 @@ let in { options.programs.kitty.catppuccin = - ctp.mkCatppuccinOpt "kitty" config; + ctp.mkCatppuccinOpt "kitty"; config.programs.kitty = lib.mkIf enable { theme = "Catppuccin-${ctp.mkUpper cfg.flavour}"; }; diff --git a/modules/home-manager/lazygit.nix b/modules/home-manager/lazygit.nix index 400c8c72..7ec5bba9 100644 --- a/modules/home-manager/lazygit.nix +++ b/modules/home-manager/lazygit.nix @@ -1,6 +1,5 @@ { config , lib -, pkgs , sources , ... }: @@ -13,17 +12,13 @@ let in { options.programs.lazygit.catppuccin = - lib.ctp.mkCatppuccinOpt "lazygit" config // { - accent = ctp.mkAccentOpt "lazygit" config; + lib.ctp.mkCatppuccinOpt "lazygit" // { + accent = ctp.mkAccentOpt "lazygit"; }; config = lib.mkIf enable { - programs.lazygit.settings = - let - file = "${sources.lazygit}/themes/${themePath}"; - in - lib.ctp.fromYaml pkgs file; + programs.lazygit.settings = lib.ctp.fromYaml "${sources.lazygit}/themes/${themePath}"; }; } diff --git a/modules/home-manager/mako.nix b/modules/home-manager/mako.nix index 2f1f6096..e31c3ff4 100644 --- a/modules/home-manager/mako.nix +++ b/modules/home-manager/mako.nix @@ -9,14 +9,14 @@ let cfg = config.services.mako.catppuccin; enable = cfg.enable && config.services.mako.enable; - theme = lib.ctp.fromINI pkgs (sources.mako + /src/${cfg.flavour}); + theme = lib.ctp.fromINI (sources.mako + /src/${cfg.flavour}); # Settings that need to be extracted and put in extraConfig extraConfigAttrs = lib.attrsets.getAttrs [ "urgency=high" ] theme; in { options.services.mako.catppuccin = - lib.ctp.mkCatppuccinOpt "mako" config; + lib.ctp.mkCatppuccinOpt "mako"; # Will cause infinite recursion if config.services.mako is directly set as a whole config.services.mako = lib.mkIf enable { diff --git a/modules/home-manager/micro.nix b/modules/home-manager/micro.nix index e320774e..29085c38 100644 --- a/modules/home-manager/micro.nix +++ b/modules/home-manager/micro.nix @@ -11,7 +11,7 @@ let in { options.programs.micro.catppuccin = - lib.ctp.mkCatppuccinOpt "micro" config; + lib.ctp.mkCatppuccinOpt "micro"; config = lib.mkIf enable { programs.micro.settings.colorscheme = lib.removeSuffix ".micro" themePath; diff --git a/modules/home-manager/neovim.nix b/modules/home-manager/neovim.nix index 6e7231bc..c77bd3ff 100644 --- a/modules/home-manager/neovim.nix +++ b/modules/home-manager/neovim.nix @@ -8,7 +8,7 @@ let enable = cfg.enable && config.programs.neovim.enable; in { - options.programs.neovim.catppuccin = lib.ctp.mkCatppuccinOpt "neovim" config; + options.programs.neovim.catppuccin = lib.ctp.mkCatppuccinOpt "neovim"; config.programs.neovim = lib.mkIf enable { plugins = with pkgs.vimPlugins; [ diff --git a/modules/home-manager/polybar.nix b/modules/home-manager/polybar.nix index c740a03b..38d00ee4 100644 --- a/modules/home-manager/polybar.nix +++ b/modules/home-manager/polybar.nix @@ -9,7 +9,7 @@ let in { options.services.polybar.catppuccin = - lib.ctp.mkCatppuccinOpt "polybar" config; + lib.ctp.mkCatppuccinOpt "polybar"; config.services.polybar.extraConfig = lib.mkIf enable (builtins.readFile "${sources.polybar}/themes/${cfg.flavour}.ini"); diff --git a/modules/home-manager/starship.nix b/modules/home-manager/starship.nix index 9cae070e..cbf2b526 100644 --- a/modules/home-manager/starship.nix +++ b/modules/home-manager/starship.nix @@ -10,7 +10,7 @@ let in { options.programs.starship.catppuccin = - lib.ctp.mkCatppuccinOpt "starship" config; + lib.ctp.mkCatppuccinOpt "starship"; config.programs.starship.settings = lib.mkIf enable diff --git a/modules/home-manager/sway.nix b/modules/home-manager/sway.nix index f665776e..628f476e 100644 --- a/modules/home-manager/sway.nix +++ b/modules/home-manager/sway.nix @@ -10,7 +10,7 @@ let in { options.wayland.windowManager.sway.catppuccin = - lib.ctp.mkCatppuccinOpt "sway" config; + lib.ctp.mkCatppuccinOpt "sway"; config.wayland.windowManager.sway.extraConfigEarly = lib.mkIf enable '' diff --git a/modules/home-manager/tmux.nix b/modules/home-manager/tmux.nix index 3c6d323b..4cdd2ccc 100644 --- a/modules/home-manager/tmux.nix +++ b/modules/home-manager/tmux.nix @@ -18,7 +18,7 @@ let in { options.programs.tmux.catppuccin = - lib.ctp.mkCatppuccinOpt "tmux" config; + lib.ctp.mkCatppuccinOpt "tmux"; config.programs.tmux.plugins = lib.mkIf enable [ { diff --git a/modules/lib/default.nix b/modules/lib/default.nix index ee91c41d..db7d7f2c 100644 --- a/modules/lib/default.nix +++ b/modules/lib/default.nix @@ -1,4 +1,4 @@ -lib: +lib: { config, pkgs, sources, ... }: let # string -> type -> string -> a -> a # this is an internal function and shouldn't be @@ -6,7 +6,7 @@ let # a string (the name of the property, i.e., flavour # or accent), the type of the property, the name of # the module, followed by local config attrset - mkBasicOpt = attr: type: name: config: + mkBasicOpt = attr: type: name: lib.mkOption { inherit type; default = config.catppuccin.${attr}; @@ -53,7 +53,7 @@ in # a -> path -> a # fromJSON but for yaml (and without readFile) # a should be the local pkgs attrset - fromYaml = pkgs: file: + fromYaml = file: let inherit (builtins) fromJSON readFile; @@ -68,7 +68,7 @@ in # a -> path -> a # fromJSON but for ini (and without readFile) # a should be the local pkgs attrset - fromINI = pkgs: file: + fromINI = file: let inherit (builtins) fromJSON readFile; @@ -83,9 +83,10 @@ in # a -> a -> [path] -> [path] # this imports a list of paths while inheriting # multiple attributes - mapModules = config: pkgs: extendedLib: sources: + mapModules = extendedLib: map (m: (import m { - inherit config pkgs sources; + inherit config pkgs; + sources = sources pkgs; lib = extendedLib; })); @@ -94,9 +95,9 @@ in # enable and flavour option. the fist string should # be the name of the module, followed by the local config # attrset - mkCatppuccinOpt = name: config: { + mkCatppuccinOpt = name: { enable = lib.mkEnableOption "Catppuccin theme"; - flavour = mkFlavourOpt name config; + flavour = mkFlavourOpt name; }; # string -> a -> a diff --git a/modules/lib/mkExtLib.nix b/modules/lib/mkExtLib.nix index b7c45034..45ef539b 100644 --- a/modules/lib/mkExtLib.nix +++ b/modules/lib/mkExtLib.nix @@ -1 +1 @@ -lib: lib.extend (self: _: { ctp = import ./. self; }) +lib: args: lib.extend (self: _: { ctp = import ./. self args; }) diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 16e7a40a..07a17b2f 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,6 +1,6 @@ -{ inputs, sources }: { config, pkgs, lib, ... }: +{ inputs, ... }@flakeArgs: { lib, pkgs, ... }@systemArgs: let - extendedLib = import ../lib/mkExtLib.nix inputs.nixpkgs.lib; + extendedLib = import ../lib/mkExtLib.nix inputs.nixpkgs.lib (systemArgs // flakeArgs); in { imports = @@ -9,7 +9,7 @@ in ./grub.nix ]; in - extendedLib.ctp.mapModules config pkgs extendedLib (sources pkgs) files; + extendedLib.ctp.mapModules extendedLib files; options.catppuccin = with extendedLib; { diff --git a/modules/nixos/grub.nix b/modules/nixos/grub.nix index 296084fd..78b48ca0 100644 --- a/modules/nixos/grub.nix +++ b/modules/nixos/grub.nix @@ -16,7 +16,7 @@ let in { options.boot.loader.grub.catppuccin = - lib.ctp.mkCatppuccinOpt "grub" config; + lib.ctp.mkCatppuccinOpt "grub"; config.boot.loader.grub = lib.mkIf enable { font = "${theme}/font.pf2";