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

51 lines
1 KiB
Nix
Raw Normal View History

2024-11-16 12:57:30 -08:00
{
lib,
config,
pkgs,
...
}:
let
inherit (lib) mkIf;
inherit (lib.marleyos) mkEnableModule;
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:05:17 -08:00
options.marleyos = mkEnableModule "programs.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;
}
];
};
};
}