git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commit79dd78b911e9d3d0a4b1b407a1a233a288f44ff8 authorworldofpeace <worldofpeace@protonmail.ch> dateWed 21 Aug 2019, 15:56 (7 years ago) parent9125f51
2 files changed+53
nixos/modules/config/vte.nix+52 nixos/modules/module-list.nix+1
nixos/modules/config/vte.nixnew file+52
@@ -0,0 +1,52 @@
1+# VTE
2+
3+{ config, pkgs, lib, ... }:
4+
5+with lib;
6+
7+let
8+
9+ vteInitSnippet = ''
10+ # Show current working directory in VTE terminals window title.
11+ # Supports both bash and zsh, requires interactive shell.
12+ . ${pkgs.vte}/etc/profile.d/vte.sh
13+ '';
14+
15+in
16+
17+{
18+
19+ options = {
20+
21+ programs.bash.vteIntegration = mkOption {
22+ default = false;
23+ type = types.bool;
24+ description = ''
25+ Whether to enable Bash integration for VTE terminals.
26+ This allows it to preserve the current directory of the shell
27+ across terminals.
28+ '';
29+ };
30+
31+ programs.zsh.vteIntegration = mkOption {
32+ default = false;
33+ type = types.bool;
34+ description = ''
35+ Whether to enable Zsh integration for VTE terminals.
36+ This allows it to preserve the current directory of the shell
37+ across terminals.
38+ '';
39+ };
40+
41+ };
42+
43+ config = mkMerge [
44+ (mkIf config.programs.bash.vteIntegration {
45+ programs.bash.interactiveShellInit = vteInitSnippet;
46+ })
47+
48+ (mkIf config.programs.zsh.vteIntegration {
49+ programs.zsh.interactiveShellInit = vteInitSnippet;
50+ })
51+ ];
52+}
nixos/modules/module-list.nix+1
@@ -37,6 +37,7 @@
3737 ./config/unix-odbc-drivers.nix
3838 ./config/users-groups.nix
3939 ./config/vpnc.nix
40+ ./config/vte.nix
4041 ./config/zram.nix
4142 ./hardware/acpilight.nix
4243 ./hardware/all-firmware.nix