1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-30 06:59:45 +01:00

readline: add module

Add basic readline configuration (~/.inputrc) management.
This commit is contained in:
Vojtěch Káně 2019-12-01 16:21:58 +01:00 committed by Robert Helgesson
parent 711109d468
commit bb5dea02b9
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 61 additions and 0 deletions

View file

@ -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'.
'';
}
];
};
}

View file

@ -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 { })

View 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}
'';
};
}