config/users/pbsds/home/default.nix

230 lines
5.0 KiB
Nix

# https://nix-community.github.io/home-manager/options.html
{ pkgs, config, ... }:
{
# TODO: upstream?
programs.jump.enableBash = true;
imports = [
./modules/jump.nix
./profiles/bat.nix
./profiles/git.nix
./profiles/gtk.nix
./profiles/micro.nix
./profiles/ssh.nix
./profiles/tmate.nix
];
nixpkgs.config.allowUnfree = true;
home.stateVersion = "22.05";
home.sessionVariables.EDITOR = "micro";
programs.bash.initExtra = ''
if [ "$COLORTERM" = "truecolor" ] || [ "$TERM" == "xterm" ]; then
export TERM=xterm-256color
export MICRO_TRUECOLOR=1
fi
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1='\[\033[01;32m\]\u@\h\[\033[01;37m\] \[\033[01;34m\]\W\[\033[33m\]$(parse_git_branch)\[\033[01;32m\]\$\[\033[00m\] '
# remote-exec
it command -v remote >/dev/null && remote-quick >/dev/null; then
complete -F _command remote
complete -F _command remote-quick
fi
# tldr
it command -v tldr >/dev/null; then
complete -F _command tldr
fi
# TODO: remove
function atom_nix {
nix-shell -p atom --run "atom $(printf "%q " "$@") --in-process-gpu --no-sandbox"
}
'';
# TODO: split ^
home.packages = with pkgs; [
rsync
bind.dnsutils
xclip
zip
unrar
unzip
atool
p7zip
bzip2
gzip
atool
micro
aspell
aspellDicts.en
aspellDicts.nb
vimv
dos2unix
pandoc
graphviz
vgmstream
gallery-dl
yt-dlp
youtube-dl
ffmpeg-full
git
curl
wget
visidata
lolcat
toilet
boxes
tewisay
ponysay
#tldr
entr
axel aria
xe # xargs alternative
sd # sed alternative
fd # find alternative
silver-searcher # `ag`
ripgrep
gron
jq
yq
fq
htmlq
just
sysz
du-dust # du alternative
ncdu # Disk usage analyzer with an ncurses interface
xplr # tui file explorer
aha
mesa-demos
cage
gh
hub
librespeed-cli
cachix
nix-template
nix-output-monitor
nixpkgs-review
manix
comma
(python3.withPackages (python-packages: with python-packages; [
requests
numpy
scipy
ptpython
poetry
rich
matplotlib
more-itertools
toml
pyyaml
virtualenv
]))
];
home.shellAliases = {
ip = "ip -br -color";
watch = "watch -c ";
hman = "man -H ";
#igrep = "grep -i";
#flexget = "ssh -t knut.pbsds.net sudo -u flexget flexget";
flexget = "sudo --user=flexget flexget -c /var/lib/flexget/flexget.yml";
tmux = "systemd-run --scope --user tmux";
dush = "du -shc * | sort -h";
dushd = "du -shc * .[!.]?* | sort -h";
diff = "diff -u --color";
sudo = "sudo ";
xargs = "xargs ";
dc = "cd";
#sl = "ls";
sl = "exa";
rssh = "ssh -l root";
# TODO: wayland detection
clip = "xclip -sel clip -t text/plain -rmlastnl -i";
python = "ptpython"; # this has too many problems...
cpython = "python";
# TODO: ps1?
pwd-fqdn = ''echo "$(whoami)@$(hostname -f):$(printf "%q" "$(realpath .)/")"'';
http-server = "${pkgs.python3}/bin/python -m http.server";
manix-fzf = ''manix "" 2>/dev/null | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview="manix '{}'" | xargs manix'';
# TODO: move to /run/user/...
nixpkgs-review = ''mkdir -p /dev/shm/nixpkgs-review && ln -sfn /dev/shm/nixpkgs-review $HOME/.cache/nixpkgs-review && nixpkgs-review'';
};
# TODO: "bind -s 'set completion-ignore-case on'"
programs.bash.enable = true;
#programs.bash.enableCompletion = true;
programs.bash.shellOptions = [
# Append to history file rather than replacing it.
"histappend"
# check the window size after each command and, if
# necessary, update the values of LINES and COLUMNS.
"checkwinsize"
# Extended globbing.
"extglob"
"globstar"
# Warn if closing shell with running jobs.
"checkjobs"
];
programs.fzf.enable = true; # TODO: does this conflict with system-wide setup?
programs.exa.enable = true;
programs.exa.enableAliases = true;
programs.direnv.enable = true;
programs.mpv.enable = true;
programs.mpv.bindings."n" = "sub-seek 1";
programs.mpv.bindings."SHIFT+n" = "sub-seek -1";
#programs.mpv.config
programs.mpv.scripts = with pkgs.mpvScripts; [ thumbnail ];
programs.nix-index.enable = true;
programs.tealdeer.enable = true;
xdg.enable = true;
#xdg.desktopEntries
/** /
programs.beets = {
enable = true;
settings = {
directory = "/mnt/meconium/beets_preprocessed/data";
#library = "/mnt/meconium/beets_preprocessed/library.db";
library = "${config.xdg.configHome}/beets/library_preprocessed.db";
#directory = "/mnt/meconium/beets_music/library";
#library = "${config.xdg.configHome}/beets/library_meconium.db";
##library = "/mnt/meconium/beets_music/data.db";
};
};
/**/
}