mirror of
https://github.com/nix-community/home-manager
synced 2024-12-05 01:19:46 +01:00
54 lines
1.1 KiB
Nix
54 lines
1.1 KiB
Nix
|
{ config, lib, pkgs, ... }:
|
||
|
|
||
|
with lib;
|
||
|
|
||
|
let
|
||
|
|
||
|
cfg = config.programs.readline;
|
||
|
|
||
|
in
|
||
|
|
||
|
{
|
||
|
options.programs.readline = {
|
||
|
enable = mkEnableOption "readline";
|
||
|
|
||
|
bindings = mkOption {
|
||
|
default = {};
|
||
|
type = types.attrsOf types.str;
|
||
|
example = { "\C-h" = "backward-kill-word"; };
|
||
|
description = "Readline bindings.";
|
||
|
};
|
||
|
|
||
|
includeSystemConfig = mkOption {
|
||
|
type = types.bool;
|
||
|
default = true;
|
||
|
description = "Whether to include the system-wide configuration.";
|
||
|
};
|
||
|
|
||
|
extraConfig = mkOption {
|
||
|
type = types.lines;
|
||
|
default = "";
|
||
|
description = ''
|
||
|
Configuration lines appended unchanged to the end of the
|
||
|
<filename>~/.inputrc</filename> file.
|
||
|
'';
|
||
|
};
|
||
|
};
|
||
|
|
||
|
config = mkIf cfg.enable {
|
||
|
home.file.".inputrc".text =
|
||
|
let
|
||
|
configStr = concatStringsSep "\n" (
|
||
|
optional cfg.includeSystemConfig "$include /etc/inputrc"
|
||
|
++ mapAttrsToList (k: v: "\"${k}\": ${v}") cfg.bindings
|
||
|
);
|
||
|
in
|
||
|
''
|
||
|
# Generated by Home Manager.
|
||
|
|
||
|
${configStr}
|
||
|
${cfg.extraConfig}
|
||
|
'';
|
||
|
};
|
||
|
}
|