From 18419d5a1153a87efa24834879fc54a5b3b27c5f Mon Sep 17 00:00:00 2001 From: Anomalocaridid <29845794+Anomalocaridid@users.noreply.github.com> Date: Wed, 13 Mar 2024 18:04:50 -0400 Subject: [PATCH] feat(nixos): init console module (#69) --- _sources/generated.json | 20 ++++++++++++++++++++ _sources/generated.nix | 12 ++++++++++++ modules/nixos/console.nix | 38 ++++++++++++++++++++++++++++++++++++++ nvfetcher.toml | 4 ++++ test.nix | 2 ++ 5 files changed, 76 insertions(+) create mode 100644 modules/nixos/console.nix diff --git a/_sources/generated.json b/_sources/generated.json index eec4b861..4ac64685 100644 --- a/_sources/generated.json +++ b/_sources/generated.json @@ -299,6 +299,26 @@ }, "version": "5e36ca599f4aa41bdd87fbf2c5aae4397ac55074" }, + "palette": { + "cargoLocks": null, + "date": "2024-01-02", + "extract": null, + "name": "palette", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "palette", + "rev": "7f103c3e11f7f705ee1fb8ac430d90a798bbdfcb", + "sha256": "sha256-W1Bj/407i2XT7CmCBoFe2PCe10MB8lmnEQsWXSrJ6zg=", + "type": "github" + }, + "version": "7f103c3e11f7f705ee1fb8ac430d90a798bbdfcb" + }, "polybar": { "cargoLocks": null, "date": "2022-10-05", diff --git a/_sources/generated.nix b/_sources/generated.nix index 38c67081..4dabf8af 100644 --- a/_sources/generated.nix +++ b/_sources/generated.nix @@ -181,6 +181,18 @@ }; date = "2023-12-31"; }; + palette = { + pname = "palette"; + version = "7f103c3e11f7f705ee1fb8ac430d90a798bbdfcb"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "palette"; + rev = "7f103c3e11f7f705ee1fb8ac430d90a798bbdfcb"; + fetchSubmodules = false; + sha256 = "sha256-W1Bj/407i2XT7CmCBoFe2PCe10MB8lmnEQsWXSrJ6zg="; + }; + date = "2024-01-02"; + }; polybar = { pname = "polybar"; version = "9ee66f83335404186ce979bac32fcf3cd047396a"; diff --git a/modules/nixos/console.nix b/modules/nixos/console.nix new file mode 100644 index 00000000..800645a5 --- /dev/null +++ b/modules/nixos/console.nix @@ -0,0 +1,38 @@ +{ config +, lib +, sources +, ... +}: +let + cfg = config.console.catppuccin; + enable = cfg.enable && config.console.enable; + palette = (lib.importJSON "${sources.palette}/palette.json").${cfg.flavour}.colors; +in +{ + options.console.catppuccin = + lib.ctp.mkCatppuccinOpt "console"; + + config.console.colors = lib.mkIf enable ( + # Manually populate with colors from catppuccin/tty + # Make sure to strip initial # from hex codes + map (color: (builtins.substring 1 6 palette.${color}.hex)) [ + "base" + "red" + "green" + "yellow" + "blue" + "pink" + "teal" + "subtext1" + + "surface2" + "red" + "green" + "yellow" + "blue" + "pink" + "teal" + "subtext0" + ] + ); +} diff --git a/nvfetcher.toml b/nvfetcher.toml index c8201e8e..b5007bc0 100644 --- a/nvfetcher.toml +++ b/nvfetcher.toml @@ -58,6 +58,10 @@ fetch.github = "catppuccin/micro" src.git = "https://github.com/catppuccin/nvim.git" fetch.github = "catppuccin/nvim" +[palette] +src.git = "https://github.com/catppuccin/palette" +fetch.github = "catppuccin/palette" + [polybar] src.git = "https://github.com/catppuccin/polybar.git" fetch.github = "catppuccin/polybar" diff --git a/test.nix b/test.nix index 57f8bf48..a9e59165 100644 --- a/test.nix +++ b/test.nix @@ -28,6 +28,8 @@ in boot.loader.grub = ctpEnable; + console = ctpEnable; + programs.dconf.enable = true; # required for gtk virtualisation = {