From b42555850bf4d866480d99480e2bc23ab4b13447 Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Date: Tue, 10 Oct 2023 05:44:54 -0400 Subject: [PATCH] Move all templates into flake inputs (#165) This reduces our reliance on import-from-derivation, so evaluation is faster. --- flake.lock | 136 ++++++++++++++++++++++++++++++++++++++ flake.nix | 40 ++++++++++- modules/alacritty/hm.nix | 7 +- modules/fish/prompt.nix | 7 +- modules/foot/hm.nix | 7 +- modules/helix/hm.nix | 7 +- modules/kitty/hm.nix | 7 +- modules/tmux/hm.nix | 7 +- modules/vim/hm.nix | 7 +- modules/xresources/hm.nix | 7 +- stylix/darwin/default.nix | 2 + stylix/hm/default.nix | 2 + stylix/nixos/default.nix | 2 + stylix/templates.nix | 15 +++++ 14 files changed, 202 insertions(+), 51 deletions(-) create mode 100644 stylix/templates.nix diff --git a/flake.lock b/flake.lock index 0e5e4732..d5bb857a 100644 --- a/flake.lock +++ b/flake.lock @@ -18,6 +18,134 @@ "type": "github" } }, + "base16-alacritty": { + "flake": false, + "locked": { + "lastModified": 1674275109, + "narHash": "sha256-Adwx9yP70I6mJrjjODOgZJjt4OPPe8gJu7UuBboXO4M=", + "owner": "aarowill", + "repo": "base16-alacritty", + "rev": "63d8ae5dfefe5db825dd4c699d0cdc2fc2c3eaf7", + "type": "github" + }, + "original": { + "owner": "aarowill", + "repo": "base16-alacritty", + "type": "github" + } + }, + "base16-fish": { + "flake": false, + "locked": { + "lastModified": 1622559957, + "narHash": "sha256-PebymhVYbL8trDVVXxCvZgc0S5VxI7I1Hv4RMSquTpA=", + "owner": "tomyun", + "repo": "base16-fish", + "rev": "2f6dd973a9075dabccd26f1cded09508180bf5fe", + "type": "github" + }, + "original": { + "owner": "tomyun", + "repo": "base16-fish", + "type": "github" + } + }, + "base16-foot": { + "flake": false, + "locked": { + "lastModified": 1696725948, + "narHash": "sha256-65bz2bUL/yzZ1c8/GQASnoiGwaF8DczlxJtzik1c0AU=", + "owner": "tinted-theming", + "repo": "base16-foot", + "rev": "eedbcfa30de0a4baa03e99f5e3ceb5535c2755ce", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-foot", + "type": "github" + } + }, + "base16-helix": { + "flake": false, + "locked": { + "lastModified": 1696727917, + "narHash": "sha256-FVrbPk+NtMra0jtlC5oxyNchbm8FosmvXIatkRbYy1g=", + "owner": "tinted-theming", + "repo": "base16-helix", + "rev": "dbe1480d99fe80f08df7970e471fac24c05f2ddb", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-helix", + "type": "github" + } + }, + "base16-kitty": { + "flake": false, + "locked": { + "lastModified": 1665001328, + "narHash": "sha256-aRaizTYPpuWEcvoYE9U+YRX+Wsc8+iG0guQJbvxEdJY=", + "owner": "kdrag0n", + "repo": "base16-kitty", + "rev": "06bb401fa9a0ffb84365905ffbb959ae5bf40805", + "type": "github" + }, + "original": { + "owner": "kdrag0n", + "repo": "base16-kitty", + "type": "github" + } + }, + "base16-tmux": { + "flake": false, + "locked": { + "lastModified": 1696725902, + "narHash": "sha256-wDPg5elZPcQpu7Df0lI5O8Jv4A3T6jUQIVg63KDU+3Q=", + "owner": "tinted-theming", + "repo": "base16-tmux", + "rev": "c02050bebb60dbb20cb433cd4d8ce668ecc11ba7", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-tmux", + "type": "github" + } + }, + "base16-vim": { + "flake": false, + "locked": { + "lastModified": 1663659192, + "narHash": "sha256-uJvaYYDMXvoo0fhBZUhN8WBXeJ87SRgof6GEK2efFT0=", + "owner": "chriskempson", + "repo": "base16-vim", + "rev": "3be3cd82cd31acfcab9a41bad853d9c68d30478d", + "type": "github" + }, + "original": { + "owner": "chriskempson", + "repo": "base16-vim", + "type": "github" + } + }, + "base16-xresources": { + "flake": false, + "locked": { + "lastModified": 1696726575, + "narHash": "sha256-btDlG5hF+CRM4NWJ7dRwQJYy0GTAYsg9B56kJ9uUeUk=", + "owner": "tinted-theming", + "repo": "base16-xresources", + "rev": "98d029dbb19fbc7e8c3e3b3fba0d4f946b5da760", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-xresources", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -89,6 +217,14 @@ "root": { "inputs": { "base16": "base16", + "base16-alacritty": "base16-alacritty", + "base16-fish": "base16-fish", + "base16-foot": "base16-foot", + "base16-helix": "base16-helix", + "base16-kitty": "base16-kitty", + "base16-tmux": "base16-tmux", + "base16-vim": "base16-vim", + "base16-xresources": "base16-xresources", "flake-compat": "flake-compat", "home-manager": "home-manager", "nixpkgs": "nixpkgs" diff --git a/flake.nix b/flake.nix index 96586693..10ac2938 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,40 @@ url = "github:edolstra/flake-compat"; flake = false; }; + + # Templates + base16-alacritty = { + url = "github:aarowill/base16-alacritty"; + flake = false; + }; + base16-fish = { + url = "github:tomyun/base16-fish"; + flake = false; + }; + base16-foot = { + url = "github:tinted-theming/base16-foot"; + flake = false; + }; + base16-helix = { + url = "github:tinted-theming/base16-helix"; + flake = false; + }; + base16-kitty = { + url = "github:kdrag0n/base16-kitty"; + flake = false; + }; + base16-tmux = { + url = "github:tinted-theming/base16-tmux"; + flake = false; + }; + base16-vim = { + url = "github:chriskempson/base16-vim"; + flake = false; + }; + base16-xresources = { + url = "github:tinted-theming/base16-xresources"; + flake = false; + }; }; outputs = @@ -39,7 +73,7 @@ nixosModules.stylix = { pkgs, ... }@args: { imports = [ - (import ./stylix/nixos { + (import ./stylix/nixos inputs { inherit (self.packages.${pkgs.system}) palette-generator; base16 = base16.lib args; homeManagerModule = self.homeManagerModules.stylix; @@ -49,7 +83,7 @@ homeManagerModules.stylix = { pkgs, ... }@args: { imports = [ - (import ./stylix/hm { + (import ./stylix/hm inputs { inherit (self.packages.${pkgs.system}) palette-generator; base16 = base16.lib args; }) @@ -58,7 +92,7 @@ darwinModules.stylix = { pkgs, ... }@args: { imports = [ - (import ./stylix/darwin { + (import ./stylix/darwin inputs { inherit (self.packages.${pkgs.system}) palette-generator; base16 = base16.lib args; homeManagerModule = self.homeManagerModules.stylix; diff --git a/modules/alacritty/hm.nix b/modules/alacritty/hm.nix index c40023ec..a9cd2780 100644 --- a/modules/alacritty/hm.nix +++ b/modules/alacritty/hm.nix @@ -4,12 +4,7 @@ with config.stylix.fonts; let themeFile = config.lib.stylix.colors { - templateRepo = pkgs.fetchFromGitHub { - owner = "aarowill"; - repo = "base16-alacritty"; - rev = "914727e48ebf3eab1574e23ca0db0ecd0e5fe9d0"; - sha256 = "sha256-oDsuiKx8gt+Ov7hZ9PibIQtE81IRSLO+n5N99WeiK34="; - }; + templateRepo = config.lib.stylix.templates.base16-alacritty; }; in { diff --git a/modules/fish/prompt.nix b/modules/fish/prompt.nix index 6198a49b..f6b4e2e0 100644 --- a/modules/fish/prompt.nix +++ b/modules/fish/prompt.nix @@ -2,12 +2,7 @@ let theme = config.lib.stylix.colors { - templateRepo = pkgs.fetchFromGitHub { - owner = "tomyun"; - repo = "base16-fish"; - rev = "7f647967fddedaf803191bc9113b13d2071dc3cf"; - sha256 = "IGUbLjsmmAvB9UKGkR7oqdpjeVEfzt83GpyBkrZf2O4="; - }; + templateRepo = config.lib.stylix.templates.base16-fish; }; in '' source ${theme} diff --git a/modules/foot/hm.nix b/modules/foot/hm.nix index 2aef65ca..8a4865f4 100644 --- a/modules/foot/hm.nix +++ b/modules/foot/hm.nix @@ -4,12 +4,7 @@ let cfg = config.stylix.targets.foot; theme = config.lib.stylix.colors { - templateRepo = pkgs.fetchFromGitHub { - owner = "tinted-theming"; - repo = "base16-foot"; - rev = "22579065fbe21361b64d80bae798666efaa85ce0"; - sha256 = "gb43UufuN6iRu6MfTZP+a3GUUQ+hKa5e6G4IiWEc68A="; - }; + templateRepo = config.lib.stylix.templates.base16-foot; }; in { diff --git a/modules/helix/hm.nix b/modules/helix/hm.nix index bb583a0f..5af016c1 100644 --- a/modules/helix/hm.nix +++ b/modules/helix/hm.nix @@ -2,12 +2,7 @@ let theme = config.lib.stylix.colors { - templateRepo = pkgs.fetchFromGitHub { - owner = "tinted-theming"; - repo = "base16-helix"; - rev = "3e391da3aaf2fa43dc9cfb67e4e6216c7ce163dc"; - sha256 = "elhPirlFx9UaZGTht9jFl8lLfT4Af38ITTPJT90yrHs="; - }; + templateRepo = config.lib.stylix.templates.base16-helix; }; # Removing the background exposes transparency from the terminal. The diff --git a/modules/kitty/hm.nix b/modules/kitty/hm.nix index bfe9526f..35d4d9a6 100644 --- a/modules/kitty/hm.nix +++ b/modules/kitty/hm.nix @@ -3,12 +3,7 @@ let cfg = config.stylix.targets.kitty; theme = config.lib.stylix.colors { - templateRepo = pkgs.fetchFromGitHub { - owner = "kdrag0n"; - repo = "base16-kitty"; - rev = "06bb401fa9a0ffb84365905ffbb959ae5bf40805"; - sha256 = "sha256-aRaizTYPpuWEcvoYE9U+YRX+Wsc8+iG0guQJbvxEdJY="; - }; + templateRepo = config.lib.stylix.templates.base16-kitty; target = if cfg.variant256Colors then "default-256" else "default"; }; in { diff --git a/modules/tmux/hm.nix b/modules/tmux/hm.nix index 027b11c9..6101dcc8 100644 --- a/modules/tmux/hm.nix +++ b/modules/tmux/hm.nix @@ -2,12 +2,7 @@ let theme = config.lib.stylix.colors { - templateRepo = pkgs.fetchFromGitHub { - owner = "tinted-theming"; - repo = "base16-tmux"; - rev = "30fc84afc723e027d4497a284fcae3cb75097441"; - sha256 = "JJ/eRqTayuEKrL9MBe943HpKy7yLyd2Dmes58KN1jdk="; - }; + templateRepo = config.lib.stylix.templates.base16-tmux; }; in { diff --git a/modules/vim/hm.nix b/modules/vim/hm.nix index 50ad62fa..b67211d9 100644 --- a/modules/vim/hm.nix +++ b/modules/vim/hm.nix @@ -4,12 +4,7 @@ with lib; let themeFile = config.lib.stylix.colors { - templateRepo = pkgs.fetchFromGitHub { - owner = "chriskempson"; - repo = "base16-vim"; - rev = "6191622d5806d4448fa2285047936bdcee57a098"; - sha256 = "6FsT87qcl9GBxgxrPx2bPULIMA/O8TRxHaN49qMM4uM="; - }; + templateRepo = config.lib.stylix.templates.base16-vim; }; themePlugin = pkgs.vimUtils.buildVimPlugin { diff --git a/modules/xresources/hm.nix b/modules/xresources/hm.nix index 4bde9be8..759b6e42 100644 --- a/modules/xresources/hm.nix +++ b/modules/xresources/hm.nix @@ -4,12 +4,7 @@ with config.stylix.fonts; let themeFile = config.lib.stylix.colors { - templateRepo = pkgs.fetchFromGitHub { - owner = "tinted-theming"; - repo = "base16-xresources"; - rev = "6711cf4fa61e903e52ef6eac186b83e04a0397d8"; - sha256 = "sha256-WazWviLhQRCyF9EBi2IDn9h8wrKc00PpqtltFDpUP5Q="; - }; + templateRepo = config.lib.stylix.templates.base16-xresources; }; in { diff --git a/stylix/darwin/default.nix b/stylix/darwin/default.nix index 4852492a..31e495a0 100644 --- a/stylix/darwin/default.nix +++ b/stylix/darwin/default.nix @@ -1,3 +1,4 @@ +inputs: { palette-generator, base16, homeManagerModule }: { options, config, lib, ... }: @@ -10,6 +11,7 @@ in { ../target.nix ./fonts.nix (import ./palette.nix { inherit palette-generator base16; }) + (import ../templates.nix inputs) ] ++ autoload; options.stylix.homeManagerIntegration = { diff --git a/stylix/hm/default.nix b/stylix/hm/default.nix index f000c891..4759035c 100644 --- a/stylix/hm/default.nix +++ b/stylix/hm/default.nix @@ -1,3 +1,4 @@ +inputs: { palette-generator, base16 }: { config, lib, ... }: @@ -10,5 +11,6 @@ in { ../opacity.nix ./fonts.nix (import ./palette.nix { inherit palette-generator base16; }) + (import ../templates.nix inputs) ] ++ autoload; } diff --git a/stylix/nixos/default.nix b/stylix/nixos/default.nix index 283616e3..50a0308d 100644 --- a/stylix/nixos/default.nix +++ b/stylix/nixos/default.nix @@ -1,3 +1,4 @@ +inputs: { palette-generator, base16, homeManagerModule }: { options, config, lib, ... }: @@ -11,6 +12,7 @@ in { ../opacity.nix ./fonts.nix (import ./palette.nix { inherit palette-generator base16; }) + (import ../templates.nix inputs) ] ++ autoload; options.stylix.homeManagerIntegration = { diff --git a/stylix/templates.nix b/stylix/templates.nix new file mode 100644 index 00000000..c74052ba --- /dev/null +++ b/stylix/templates.nix @@ -0,0 +1,15 @@ +inputs: +{ + config.lib.stylix.templates = { + inherit (inputs) + base16-alacritty + base16-fish + base16-foot + base16-helix + base16-kitty + base16-tmux + base16-vim + base16-xresources + ; + }; +}