marleyos/modules/home/programs/cheat/default.nix
2024-11-16 23:57:21 -08:00

49 lines
1,014 B
Nix

{
lib,
config,
pkgs,
...
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.marleyos.programs.cheat;
inherit (config.marleyos.theme) colors;
toYAML = (pkgs.formats.yaml { }).generate;
in
{
options.marleyos.programs.cheat.enable = mkEnableOption "cheat";
config = mkIf cfg.enable {
home.packages = with pkgs; [
cheat
];
xdg.configFile."cheat/conf.yml".source = toYAML "conf.yml" {
colorize = true;
style = "${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;
}
];
};
};
}