{ config, pkgs, lib, ... }: { imports = [ ./readline.nix ]; xdg.enable = true; xdg.mimeApps.enable = true; xdg.userDirs = let home = config.home.homeDirectory; in rec { enable = true; createDirectories = true; desktop = "${home}/desktop"; documents = "${home}/documents"; download = "${home}/downloads"; music = "${home}/media/music"; publicShare = "${documents}/public"; templates = "${documents}/templates"; videos = "${home}/media/videos"; pictures = "${home}/media/images"; extraConfig = { XDG_GIT_DIR = "${home}/git"; XDG_MAIL_DIR = "${config.xdg.dataHome}/mail"; XDG_CAL_DIR = "${config.xdg.dataHome}/calendar"; XDG_CONTACT_DIR = "${config.xdg.dataHome}/contact"; XDG_NOTES_DIR = "${documents}/notes"; }; }; home = { sessionVariables = let user = config.home.username; home = config.home.homeDirectory; xdg-config = config.xdg.configHome; user-dirs = config.xdg.userDirs; in rec { BIN = "${home}/.local/bin"; TMPDIR = "/tmp/${user}"; MAILCAPS = "${xdg-config}/mailcap/mailcap"; CDPATH = ".:${home}:" + GIT; # Home subdirectories GIT = user-dirs.extraConfig.XDG_GIT_DIR; IMGS = user-dirs.pictures; MAIL = user-dirs.extraConfig.XDG_MAIL_DIR; CAL = user-dirs.extraConfig.XDG_CAL_DIR; CONTACT = user-dirs.extraConfig.XDG_CONTACT_DIR; MUSIC = user-dirs.music; DOWNLOADS = user-dirs.download; DOCUMENTS = user-dirs.documents; NOTES = user-dirs.extraConfig.XDG_NOTES_DIR; STORE = "/nix/store"; # Set default pager PAGER = lib.mkDefault "less"; }; sessionPath = [ "$BIN" ]; }; programs.bash = { enable = true; historyControl = [ "ignoredups" "ignorespace" ]; historyFileSize = 1024; historySize = 1024; shellAliases = { dl = "cd $DOWNLOADS ; clear"; tmp = "cd `mktemp -d`"; ls = "command ls -lhF --color"; cls = "clear ; ls"; la = "command ls -lhaF --color"; cla = "clear ; la"; path = "echo -e \${PATH//:/\\\\n}"; }; profileExtra = '' if [ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]; then . $HOME/.nix-profile/etc/profile.d/nix.sh fi ''; # Note that this is *prepended* to `$HOME/.bashrc`. bashrcExtra = ( builtins.readFile ./config/bash/functions.bash ) + '' [ -n "$TMPDIR" ] && mkdir -p $TMPDIR # Commands that should be applied only for interactive shells. [[ $- == *i* ]] || return # Disable flow control (CTRL-S and CTRL-Q) stty -ixon '' + ( builtins.readFile ./config/bash/prompt.bash ); # Clear screen on logout, just in case... logoutExtra = '' clear ''; shellOptions = [ "autocd" # auto-prepend 'cd' to folder used as command "cdspell" "dirspell" # autocorrect typos in paths "checkjobs" # print jobs status on exit "checkwinsize" # check/reset window size after each command "cmdhist" "lithist" # save multiline commands as a single entry "dotglob" # include dotfiles in path expantion "extglob" # enable extended glob (e.g., `!(...)`, `+(...)`) "globstar" # '**' expands directory paths/files "histappend" # append to history, rather than overriding "no_empty_cmd_completion" # no autocompletion on an empty command "nocaseglob" # case-insensitive globbing ]; }; programs.fzf.enableBashIntegration = true; }