Skip to content

Instantly share code, notes, and snippets.

@roberth
Last active June 27, 2018 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roberth/7cb1814116457aea6192641948927529 to your computer and use it in GitHub Desktop.
Save roberth/7cb1814116457aea6192641948927529 to your computer and use it in GitHub Desktop.
Bash completion and more in nix-shell
pkgs.mkShell {
buildInputs = [...];
shellHook = ''
nixShellAddXdgDataDirs(){
local dirs="$(find $buildInputs -mindepth 1 -maxdepth 1 -path '*/share' -printf ':%p')"
dirs=''${dirs/:/}
export XDG_DATA_DIRS=''${XDG_DATA_DIRS:-}''${XDG_DATA_DIRS:+''${dirs:+:}}''${dirs}
}
nixShellAddXdgDataDirs
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment