From 3b28e38df728c725183f9def3b4fa26a5566b8c4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 6 Dec 2019 11:19:53 +0100 Subject: Emacs: create eshell module to handle aliases --- user/modules/eshell.nix | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 user/modules/eshell.nix (limited to 'user/modules') diff --git a/user/modules/eshell.nix b/user/modules/eshell.nix new file mode 100644 index 00000000..c4fc366f --- /dev/null +++ b/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); + }; + }; +} -- cgit 1.4.1