summary refs log tree commit diff stats
path: root/user/modules
diff options
context:
space:
mode:
Diffstat (limited to 'user/modules')
-rw-r--r--user/modules/eshell.nix28
1 files changed, 28 insertions, 0 deletions
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);
+    };
+  };
+}