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

49 lines
1,007 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 = 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;
}
];
};
};
}