all repos — nixfiles @ 3b28e38df728c725183f9def3b4fa26a5566b8c4

System and user configuration, managed by nix and home-manager

Emacs: create eshell module to handle aliases

Alan Pearce
commit

3b28e38df728c725183f9def3b4fa26a5566b8c4

parent

ab0e8c29b11cb35e164ff3be5eb50fee74a92644

1 file changed, 28 insertions(+), 0 deletions(-)

changed files
A user/modules/eshell.nix
@@ -0,0 +1,28 @@
+{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.programs.emacs; +in { + options.programs.emacs.eshell = { + aliases = mkOption { + default = { }; + type = types.attrsOf types.str; + example = { + ll = "ls -l $*"; + ff = "find-file $1"; + }; + description = '' + An attribute set that maps aliases (the top-level attribute names + in this option) to command strings. + ''; + }; + }; + + config = mkIf cfg.enable { + home.file.".emacs.d/eshell/alias" = { + recursive = true; + text = concatStringsSep "\n" (mapAttrsToList (k: v: "alias ${k} ${v}") cfg.eshell.aliases); + }; + }; +}