about summary refs log tree commit diff
path: root/nixos/modules/config
diff options
context:
space:
mode:
authorworldofpeace <worldofpeace@protonmail.ch>2019-08-21 15:56:25 -0400
committerworldofpeace <worldofpeace@protonmail.ch>2019-08-21 16:16:04 -0400
commit79dd78b911e9d3d0a4b1b407a1a233a288f44ff8 (patch)
tree3b9b0ff630d39567ffd36f37e9a341b98af106a0 /nixos/modules/config
parent9125f51b7068fa63d2fb3092862720a584229073 (diff)
downloadnixlib-79dd78b911e9d3d0a4b1b407a1a233a288f44ff8.tar
nixlib-79dd78b911e9d3d0a4b1b407a1a233a288f44ff8.tar.gz
nixlib-79dd78b911e9d3d0a4b1b407a1a233a288f44ff8.tar.bz2
nixlib-79dd78b911e9d3d0a4b1b407a1a233a288f44ff8.tar.lz
nixlib-79dd78b911e9d3d0a4b1b407a1a233a288f44ff8.tar.xz
nixlib-79dd78b911e9d3d0a4b1b407a1a233a288f44ff8.tar.zst
nixlib-79dd78b911e9d3d0a4b1b407a1a233a288f44ff8.zip
nixos/vte: init
This module correctly includes the vte.sh script
required for vte terminals like gnome-terminal to show the
CWD in the window title and preserved across instances.

This is achieved with the options:
* programs.bash.vteIntegration
* programs.zsh.vteIntegration

as it's best to keep this configuration unguarded by gnome3.enable
to support other vte terminals (such as elementary-terminal).
Note the distinction between Zsh and Bash doesn't include
a different script, as this script only supports those two shells.
Diffstat (limited to 'nixos/modules/config')
-rw-r--r--nixos/modules/config/vte.nix52
1 files changed, 52 insertions, 0 deletions
diff --git a/nixos/modules/config/vte.nix b/nixos/modules/config/vte.nix
new file mode 100644
index 000000000000..9024ceddaee8
--- /dev/null
+++ b/nixos/modules/config/vte.nix
@@ -0,0 +1,52 @@
+# VTE
+
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+
+  vteInitSnippet = ''
+    # Show current working directory in VTE terminals window title.
+    # Supports both bash and zsh, requires interactive shell.
+    . ${pkgs.vte}/etc/profile.d/vte.sh
+  '';
+
+in
+
+{
+
+  options = {
+
+    programs.bash.vteIntegration = mkOption {
+      default = false;
+      type = types.bool;
+      description = ''
+        Whether to enable Bash integration for VTE terminals.
+        This allows it to preserve the current directory of the shell
+        across terminals.
+      '';
+    };
+
+    programs.zsh.vteIntegration = mkOption {
+      default = false;
+      type = types.bool;
+      description = ''
+        Whether to enable Zsh integration for VTE terminals.
+        This allows it to preserve the current directory of the shell
+        across terminals.
+      '';
+    };
+
+  };
+
+  config = mkMerge [
+    (mkIf config.programs.bash.vteIntegration {
+      programs.bash.interactiveShellInit = vteInitSnippet;
+    })
+
+    (mkIf config.programs.zsh.vteIntegration {
+      programs.zsh.interactiveShellInit = vteInitSnippet;
+    })
+  ];
+}