From 065ddb599d3f214e355a7ef104011ca9a2788a2d Mon Sep 17 00:00:00 2001 From: zimbatm Date: Sun, 22 Nov 2020 11:43:34 +0100 Subject: [PATCH] support for XDG apps The bash-completions package automatically finds the right completion scripts by looking into XDG_DATA_DIRS. Probably other programs respecting XDG specs can also benefit from setting that environment variable. Thanks to https://github.com/NixOS/nixpkgs/pull/103501 for finding that gem. --- mkDevShell/default.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mkDevShell/default.nix b/mkDevShell/default.nix index 235bce03..63f249e5 100644 --- a/mkDevShell/default.nix +++ b/mkDevShell/default.nix @@ -70,6 +70,11 @@ let PATH=''${PATH#${bashBin}:} export PATH=$DEVSHELL_DIR/bin:${bashBin}:$PATH + # Fill with sensible default for Ubuntu + : "''${XDG_DATA_DIRS:=/usr/local/share:/usr/share}" + # This is used by bash-completions to find new completions on demand + export XDG_DATA_DIRS=$DEVSHELL_DIR/share:$XDG_DATA_DIRS + # Expose the path to nixpkgs export NIXPKGS_PATH=${toString pkgs.path} @@ -119,11 +124,6 @@ let PS1='\[\033[38;5;202m\][${name}]$(rel_root)\$\[\033[0m\] ' fi - # Load bash completions - for file in "$DEVSHELL_DIR/share/bash-completion/completions/"* ; do - [[ -f "$file" ]] && source "$file" - done - ${bash.interactive or ""} fi # Interactive session