fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . editorconfig ; 8 9iniFormat = pkgs . formats . ini { }; 10 11in { 12meta . maintainers = with maintainers ; [ loicreynier ]; 13 14options . editorconfig = { 15enable = mkEnableOption "EditorConfig home configuration file" ; 16 17settings = mkOption { 18type = iniFormat . type ; 19default = { }; 20description = '' 21Configuration written to {file}`$HOME/.editorconfig`. 22`root = true` is automatically added to the file, 23it must not be added here. 24See <https://editorconfig.org> for documentation. 25'' ; 26example = literalExpression '' 27{ 28"*" = { 29charset = "utf-8"; 30end_of_line = "lf"; 31trim_trailing_whitespace = true; 32insert_final_newline = true; 33max_line_width = 78; 34indent_style = "space"; 35indent_size = 4; 36}; 37}; 38'' ; 39}; 40}; 41 42config = mkIf ( cfg . enable && cfg . settings != { }) { 43home . file . ".editorconfig" . text = let 44renderedSettings = generators . toINIWithGlobalSection { } { 45globalSection = { root = true ; }; 46sections = cfg . settings ; 47}; 48in '' 49# Generated by Home Manager 50${ renderedSettings } 51'' ; 52}; 53}