nixpkgs/nixos/modules/config/vte.nix
Sandro Jäckel 577bb277aa
nixos/vte: use vte without any GUI dependencies
we just need the script, borrowed from environment.noXLibs
On my system this reduced the closure size by ~100MB

 ▶ nix path-info -Sh /nix/var/nix/profiles/system-76-link/
/nix/store/adybwlzyf3qa56irabblzlyjsr74amb9-nixos-system-francium-23.11    6.5G
 ▶ nix path-info -S /nix/var/nix/profiles/system-76-link/
/nix/store/adybwlzyf3qa56irabblzlyjsr74amb9-nixos-system-francium-23.11  6956572064

 ▶ nix path-info -Sh /nix/var/nix/profiles/system-77-link/
/nix/store/wgs6wlq2i911q2r1n5fqbs9vzmp8qy26-nixos-system-francium-23.11    6.4G
 ▶ nix path-info -S /nix/var/nix/profiles/system-77-link/
/nix/store/wgs6wlq2i911q2r1n5fqbs9vzmp8qy26-nixos-system-francium-23.11  6856836056
2023-12-11 11:14:24 +01:00

54 lines
1.2 KiB
Nix

{ 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.override { gtkVersion = null; }}/etc/profile.d/vte.sh
'';
in
{
meta = {
maintainers = teams.gnome.members;
};
options = {
programs.bash.vteIntegration = mkOption {
default = false;
type = types.bool;
description = lib.mdDoc ''
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 = lib.mdDoc ''
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 = mkBefore vteInitSnippet;
})
(mkIf config.programs.zsh.vteIntegration {
programs.zsh.interactiveShellInit = vteInitSnippet;
})
];
}