fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6cfg = config . programs . alacritty ; 7yamlFormat = pkgs . formats . yaml { }; 8in { 9options = { 10programs . alacritty = { 11enable = mkEnableOption "Alacritty" ; 12 13package = mkOption { 14type = types . package ; 15default = pkgs . alacritty ; 16defaultText = literalExpression "pkgs.alacritty" ; 17description = "The Alacritty package to install." ; 18}; 19 20settings = mkOption { 21type = yamlFormat . type ; 22default = { }; 23example = literalExpression '' 24{ 25window.dimensions = { 26lines = 3; 27columns = 200; 28}; 29key_bindings = [ 30{ 31key = "K"; 32mods = "Control"; 33chars = "\\x0c"; 34} 35]; 36} 37'' ; 38description = '' 39Configuration written to 40{file}`$XDG_CONFIG_HOME/alacritty/alacritty.yml`. See 41<https://github.com/alacritty/alacritty/blob/master/alacritty.yml> 42for the default configuration. 43'' ; 44}; 45}; 46}; 47 48config = mkMerge [ 49( mkIf cfg . enable { 50home . packages = [ cfg . package ]; 51 52xdg . configFile . "alacritty/alacritty.yml" = mkIf ( cfg . settings != { }) { 53# TODO: Replace by the generate function but need to figure out how to 54# handle the escaping first. 55# 56# source = yamlFormat.generate "alacritty.yml" cfg.settings; 57 58text = 59replaceStrings [ "\\\\" ] [ "\\" ] ( builtins . toJSON cfg . settings ); 60}; 61}) 62]; 63}