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 . programs . sioyek ; 8 9renderConfig = generators . toKeyValue { 10mkKeyValue = key :value :" ${ key } ${ value } " ; 11listsAsDuplicateKeys = true ; 12}; 13 14in { 15options = { 16programs . sioyek = { 17enable = mkEnableOption 18"Sioyek, a PDF viewer designed for reading research papers and technical books" ; 19 20package = mkOption { 21default = pkgs . sioyek ; 22defaultText = literalExpression "pkgs.sioyek" ; 23type = types . package ; 24description = "Package providing the sioyek binary" ; 25}; 26 27bindings = mkOption { 28description = '' 29Input configuration written to 30{file}`$XDG_CONFIG_HOME/sioyek/keys_user.config`. 31See <https://github.com/ahrm/sioyek/blob/main/pdf_viewer/keys.config>. 32 33Each attribute could also accept a list of strings to set multiple 34bindings of the same command. 35'' ; 36type = with types ; attrsOf ( either str ( listOf str )); 37default = { }; 38example = literalExpression '' 39{ 40"move_up" = "k"; 41"move_down" = "j"; 42"move_left" = "h"; 43"move_right" = "l"; 44"screen_down" = [ "d" "<C-d>" ]; 45"screen_up" = [ "u" "<C-u>" ]; 46} 47'' ; 48}; 49 50config = mkOption { 51description = '' 52Input configuration written to 53{file}`$XDG_CONFIG_HOME/sioyek/prefs_user.config`. 54See <https://github.com/ahrm/sioyek/blob/main/pdf_viewer/prefs.config>. 55'' ; 56type = types . attrsOf types . str ; 57default = { }; 58example = literalExpression '' 59{ 60"background_color" = "1.0 1.0 1.0"; 61"text_highlight_color" = "1.0 0.0 0.0"; 62} 63'' ; 64}; 65 66}; 67}; 68 69config = mkIf cfg . enable ( mkMerge [ 70{ home . packages = [ cfg . package ]; } 71( mkIf ( cfg . config != { }) { 72xdg . configFile . "sioyek/prefs_user.config" . text = renderConfig cfg . config ; 73}) 74( mkIf ( cfg . bindings != { }) { 75xdg . configFile . "sioyek/keys_user.config" . text = renderConfig cfg . bindings ; 76}) 77]); 78 79meta . maintainers = [ hm . maintainers . podocarp ]; 80}