dotfiles/nixos/environment.nix

68 lines
1.8 KiB
Nix

{ config, pkgs, options, lib, ... }:
with lib;
{
options = {
dotfiles-directory = mkOption {
type = types.str;
default = "/home/imalison/dotfiles";
};
};
config = let libDir = "${config.dotfiles-directory}/dotfiles/lib";
in {
# Shell configuration
programs.zsh = {
enable = true;
syntaxHighlighting = {
enable = true;
};
ohMyZsh = {
enable = true;
plugins = [ "git" "sudo" "pip" ];
};
shellInit = ''
fpath+="${libDir}/functions"
for file in "${libDir}/functions/"*
do
autoload "''${file##*/}"
done
'';
};
programs.starship = {
enableBashIntegration = true;
enableZshIntegration = true;
enable = true;
};
environment = {
homeBinInPath = true;
localBinInPath = true;
interactiveShellInit = ''
vterm_printf(){
if [ -n "$TMUX" ] && ([ "''${TERM%%-*}" = "tmux" ] || [ "''${TERM%%-*}" = "screen" ] ); then
# Tell tmux to pass the escape sequences through
printf "\ePtmux;\e\e]%s\007\e\\" "$1"
elif [ "''${TERM%%-*}" = "screen" ]; then
# GNU screen (screen, screen-256color, screen-256color-bce)
printf "\eP\e]%s\007\e\\" "$1"
else
printf "\e]%s\e\\" "$1"
fi
}
if [[ "$INSIDE_EMACS" = 'vterm' ]] \
&& [[ -n ''${EMACS_VTERM_PATH} ]] \
&& [[ -f ''${EMACS_VTERM_PATH}/etc/emacs-vterm-bash.sh ]]; then
source ''${EMACS_VTERM_PATH}/etc/emacs-vterm-bash.sh
fi
export STARSHIP_INSIDE_EMACS="yes"
'';
extraInit = ''
export ROFI_SYSTEMD_TERM="alacritty -e"
export PATH="${libDir}/bin:$PATH"
export PATH="${libDir}/functions:$PATH"
'';
};
};
}