Respect muh XDGthoritah

This commit is contained in:
Henrik Lissner 2020-01-14 06:56:02 -05:00
parent be9188b011
commit 3c942dd271
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 40 additions and 7 deletions

View file

@ -1,6 +1,6 @@
# ...
{ config, lib, pkgs, ... }:
{ config, options, lib, pkgs, ... }:
{
# Nothing in /tmp should survive a reboot
boot.tmpOnTmpfs = true;
@ -36,7 +36,12 @@
};
};
# Obey XDG conventions; a tidy $HOME is a tidy mind.
### Universal defaults
networking.firewall.enable = true;
### A tidy $HOME is a tidy mind.
# Obey XDG conventions;
my.home.xdg.enable = true;
environment.variables = {
# These are the defaults, but some applications are buggy when these lack
@ -47,6 +52,27 @@
XDG_BIN_HOME = "$HOME/.local/bin";
};
### Universal defaults
networking.firewall.enable = true;
# Conform more programs to XDG conventions. The rest are handle by their
# respective modules.
my.env = {
__GL_SHADER_DISK_CACHE_PATH = "$XDG_CACHE_HOME/nv";
CUDA_CACHE_PATH = "$XDG_CACHE_HOME/nv";
HISTFILE = "$XDG_DATA_HOME/bash/history";
INPUTRC = "$XDG_CACHE_HOME/readline/inputrc";
LESSHISTFILE = "$XDG_CACHE_HOME/lesshst";
WGETRC = "$XDG_CACHE_HOME/wgetrc";
};
# Prevents ~/.esd_auth files by disabling the esound protocol module for
# pulseaudio, which I likely don't need. Is there a better way?
hardware.pulseaudio.configFile =
let paConfigFile =
with pkgs; runCommand "disablePulseaudioEsoundModule"
{ buildInputs = [ pulseaudio ]; } ''
mkdir "$out"
cp ${pulseaudio}/etc/pulse/default.pa "$out/default.pa"
sed -i -e 's|load-module module-esound-protocol-unix|# ...|' "$out/default.pa"
'';
in lib.mkIf config.hardware.pulseaudio.enable
"${paConfigFile}/default.pa";
}

View file

@ -22,5 +22,10 @@
# Run locally installed bin-script, e.g. n coffee file.coffee
alias.n = "PATH=\"$(npm bin):$PATH\"";
alias.ya = "yarn";
home.xdg.configFile."npm/config".text = ''
cache=$XDG_CACHE_HOME/npm
prefix=$XDG_DATA_HOME/npm
'';
};
}

View file

@ -23,6 +23,8 @@
env.PYLINTHOME = "$XDG_DATA_HOME/pylint";
env.PYLINTRC = "$XDG_CONFIG_HOME/pylint/pylintrc";
env.PYTHONSTARTUP = "$XDG_CONFIG_HOME/python/pythonrc";
env.PYTHON_EGG_CACHE = "$XDG_CACHE_HOME/python-eggs";
env.JUPYTER_CONFIG_DIR = "$XDG_CONFIG_HOME/jupyter";
zsh.rc = lib.readFile <my/config/python/aliases.zsh>;