Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up non-xdg-compliant things a bit further #76

Merged
merged 9 commits into from
Jun 23, 2021
5 changes: 2 additions & 3 deletions dotfiles/env
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

# Set emacsclient as a "browser" - xdg-open naively checks this
# variable to open unknown file types, or otherwise tries to open
# absolutely everything in firefox. Really need to find out who wrote
# that script and slap them.
export BROWSER="emacsclient --no-wait -c"
# absolutely everything in firefox.
export BROWSER="firefox"

export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
Expand Down
32 changes: 27 additions & 5 deletions dotfiles/zshrc → dotfiles/zsh/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,36 @@
export "NIX_PATH=${NIX_PATH:-$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH}"

# Don't create .zcompdump files in $HOME
autoload -Uz compinit && compinit -d "${XDG_CACHE_HOME}/zsh/zcompdump-${ZSH_VERSION}"
autoload -Uz compaudit compinit && compinit -d "${XDG_CACHE_HOME}/zsh/zcompdump-${ZSH_VERSION}"

# Everything else is just for interactive shells
if [[ -o interactive ]]; then
# Load other extensions
autoload -U zcalc

# Allow nix-shell to function
if (( $+commands[any-nix-shell] )); then
any-nix-shell zsh | source /dev/stdin
fi

# Activate direnv
eval "$(direnv hook zsh)"

# Load more granular configuration files
source "$ZDOTDIR/functions.zsh"
source "$ZDOTDIR/aliases.zsh"
source "$ZDOTDIR/completion.zsh"
source "$ZDOTDIR/keybindings.zsh"
source "$ZDOTDIR/theme.zsh"
source "$ZDOTDIR/oh-my-zsh-expat/oh-my-zsh-expat.zsh"

# Load plugins
for plugin in "$ZDOTDIR/plugins/"*; do
for file in "$plugin/"*.zsh; do
source "$file"
done
done

# Start screen if...
if \
# The command exists \
Expand All @@ -24,8 +50,4 @@ if [[ -o interactive ]]; then
[ "$TERM" != "linux" ]; then
exec screen -AxRR -c "$XDG_CONFIG_HOME/screen/config"
fi

# Load zsh configuration
ZDOTDIR="$XDG_CONFIG_HOME/zsh"
source "$ZDOTDIR/zshrc"
fi
2 changes: 0 additions & 2 deletions dotfiles/zsh/oh-my-zsh-expat/oh-my-zsh-expat.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ for plugin in "$ZSH/plugins/"*; do
fpath=($plugin $fpath)
done

autoload -U compaudit compinit

for plugin in "$ZSH/plugins/"*; do
source "$plugin/$(basename $plugin).plugin.zsh"
done
Expand Down
28 changes: 0 additions & 28 deletions dotfiles/zsh/zshrc

This file was deleted.

3 changes: 3 additions & 0 deletions dotfiles/zshenv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
setopt no_global_rcs
HISTFILE="$XDG_DATA_HOME/.zsh_history"
ZDOTDIR="$XDG_CONFIG_HOME/zsh"
2 changes: 1 addition & 1 deletion nixpkgs/configurations/tty-programs/mail/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ in {
local.dump-ics
];

home.file.".mailcap".source = "${dotroot}/dotfiles/mailcap";
xdg.configFile."mailcap".source = "${dotroot}/dotfiles/mailcap";

programs = {
mbsync.enable = true;
Expand Down
5 changes: 4 additions & 1 deletion nixpkgs/configurations/tty-programs/pcs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@

ncmpcpp = {
enable = true;
settings.ncmpcpp_directory = "${config.xdg.dataHome}";
settings = {
ncmpcpp_directory = "${config.xdg.dataHome}/ncmpcpp";
lyrics_directory = "${config.xdg.dataHome}/lyrics";
};
};

password-store = {
Expand Down
10 changes: 4 additions & 6 deletions nixpkgs/configurations/tty-programs/zsh.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
home.packages = with pkgs; [ zsh ];

# Basic, local config
home.file.".zshrc".source = "${dotroot}/dotfiles/zshrc";
xdg.configFile = {
"zsh" = {
recursive = true;
source = "${dotroot}/dotfiles/zsh";
};
home.file.".zshenv".source = "${dotroot}/dotfiles/zshenv";
xdg.configFile."zsh" = {
recursive = true;
source = "${dotroot}/dotfiles/zsh";
};

# Plugins
Expand Down
15 changes: 15 additions & 0 deletions nixpkgs/configurations/xdg-settings.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ in {
CARGO_HOME = "${xdg.cacheHome}/cargo";
RUSTUP_HOME = "${xdg.dataHome}/rustup";
XCOMPOSECACHE = "${xdg.cacheHome}/X11/xcompose";
XCOMPOSEFILE = "${xdg.configHome}X11/xcompose";
NPM_CONFIG_USERCONFIG = "${xdg.configHome}/npm/npmrc";
MAILCAPS = "${xdg.configHome}/mailcap";
PYTHONSTARTUP = "${xdg.configHome}/python/startup.py";
IPYTHONDIR = "${xdg.dataHome}/ipython";
JUPYTER_CONFIG_DIR = "${xdg.dataHome}/ipython";
HISTFILE = "${xdg.dataHome}/histfile";
RLWRAP_HOME = "${xdg.dataHome}/rlwrap"; # stumpish and perhaps others

# See, this is exactly why things should follow the spec. I have
# no intention of using gradle ever, but occasionally I need to
Expand All @@ -50,4 +57,12 @@ in {
cache=${xdg.cacheHome}/npm
tmp=$XDG_RUNTIME_DIR/npm
'';

# Aaand python is configured using a python script. Wonderful.
xdg.configFile."python/startup.py" = {
text = ''
import readline
readline.set_auto_history(False)
'';
};
}