mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
readline: add module
Add basic readline configuration (~/.inputrc) management.
This commit is contained in:
parent
711109d468
commit
bb5dea02b9
3 changed files with 61 additions and 0 deletions
|
@ -1280,6 +1280,13 @@ in
|
|||
programs installed via Home Manager.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2019-12-08T19:48:26+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.readline'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@ let
|
|||
(loadModule ./programs/password-store.nix { })
|
||||
(loadModule ./programs/pazi.nix { })
|
||||
(loadModule ./programs/pidgin.nix { })
|
||||
(loadModule ./programs/readline.nix { })
|
||||
(loadModule ./programs/rofi.nix { })
|
||||
(loadModule ./programs/rtorrent.nix { })
|
||||
(loadModule ./programs/skim.nix { })
|
||||
|
|
53
modules/programs/readline.nix
Normal file
53
modules/programs/readline.nix
Normal file
|
@ -0,0 +1,53 @@
|
|||
{ 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}
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue