marleyos/modules/home/programs/cheat/default.nix

50 lines
1,014 B
Nix
Raw Normal View History

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