From cfc908e1a0ba118306cde60e1c305121e096bf1f Mon Sep 17 00:00:00 2001 From: punkfairie Date: Sat, 16 Nov 2024 12:57:30 -0800 Subject: [PATCH] feat(home): Cheat --- homes/x86_64-linux/marley@nyx/default.nix | 1 + modules/home/programs/cheat/default.nix | 51 +++++++++++++++++++++++ old/home/programs/cheat.nix | 36 ---------------- 3 files changed, 52 insertions(+), 36 deletions(-) create mode 100644 modules/home/programs/cheat/default.nix delete mode 100644 old/home/programs/cheat.nix diff --git a/homes/x86_64-linux/marley@nyx/default.nix b/homes/x86_64-linux/marley@nyx/default.nix index e397c25..22a1263 100644 --- a/homes/x86_64-linux/marley@nyx/default.nix +++ b/homes/x86_64-linux/marley@nyx/default.nix @@ -18,6 +18,7 @@ in bat = enabled; btop = enabled; cava = enabled; + cheat = enabled; fish = enabled; journalctl = enabled; neo = enabled; diff --git a/modules/home/programs/cheat/default.nix b/modules/home/programs/cheat/default.nix new file mode 100644 index 0000000..63a5c9c --- /dev/null +++ b/modules/home/programs/cheat/default.nix @@ -0,0 +1,51 @@ +{ + lib, + config, + namespace, + pkgs, + ... +}: +let + inherit (lib) mkIf; + inherit (lib.${namespace}) mkEnableModule; + + cfg = config.${namespace}.programs.cheat; + inherit (config.${namespace}) theme; + + toYAML = (pkgs.formats.yaml { }).generate; +in +{ + options = mkEnableModule "programs.cheat"; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + cheat + ]; + + xdg.configFile."cheat/conf.yml".source = toYAML "conf.yml" { + colorize = true; + style = "${theme.colors.base}"; + formatter = "terminal256"; + pager = "less -FRX"; + + cheatpaths = + let + cheatDir = "${config.xdg.configHome}/cheat/cheatsheets"; + in + [ + { + name = "community"; + path = "${cheatDir}/community"; + tags = [ "community" ]; + readonly = true; + } + { + name = "personal"; + path = "${cheatDir}/personal"; + tags = [ "personal" ]; + readonly = false; + } + ]; + }; + }; +} diff --git a/old/home/programs/cheat.nix b/old/home/programs/cheat.nix deleted file mode 100644 index ba1f35d..0000000 --- a/old/home/programs/cheat.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ pkgs, config, ... }: -let - toYaml = (pkgs.formats.yaml { }).generate; -in -{ - home.packages = with pkgs; [ - cheat - ]; - - xdg.configFile."cheat/conf.yml".source = toYaml "conf.yml" { - colorize = true; - # TODO set based on global color scheme - style = "rose-pine"; - formatter = "terminal256"; - pager = "less -FRX"; - - cheatpaths = - let - cheatDir = "${config.xdg.configHome}/cheat/cheatsheets"; - in - [ - { - name = "community"; - path = "${cheatDir}/community"; - tags = [ "community" ]; - readonly = true; - } - { - name = "personal"; - path = "${cheatDir}/personal"; - tags = [ "personal" ]; - readonly = false; - } - ]; - }; -}