home/home/common.nix

179 lines
4.8 KiB
Nix

{ pkgs, username, home-dir, prompt-color, xdg-runtime-dir, kak-pkg, kak-tree, unispect, ansi-utils, unambig-path }:
let
kak = import ./kak.nix { kak = kak-pkg; inherit pkgs kak-tree; };
extras = import ./extras.nix pkgs;
in rec {
home.username = username;
home.homeDirectory = home-dir;
home.stateVersion = "23.05";
home.packages = with pkgs; extras.all ++ [
# Terminal utilities
unispect
ansi-utils.ansicols
ansi-utils.ansimove
unambig-path
ripgrep fd bat
watchexec unixtools.watch
htop bottom
fzf
pv
binwalk
ffmpeg yt-dlp
socat nmap
blahaj
# Programming languages
jq
rink numbat
ghc
( python310.withPackages (ps: with ps; [
numpy matplotlib sympy scipy pandas
pwntools z3 tqdm
pyusb usbtmc
ipython mypy (pylsp-mypy.overrideAttrs (old: { doCheck = false; }))
]))
( agda.withPackages (ps: with ps; [ standard-library cubical ]) )
typst
# jupyter
# nodePackages.typescript
# nodePackages.typescript-language-server
# rust-analyzer
zulip-term
(extras.challtools python310Packages)
];
home.sessionVariables = {
XDG_RUNTIME_DIR = xdg-runtime-dir;
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
programs.kakoune = kak;
programs.zsh = {
enable = true;
package = pkgs.zsh;
history = {
path = "${home.homeDirectory}/.zsh_history";
save = 100000000000000;
size = 100000000000000;
extended = true; # Save timestamps
share = true;
};
localVariables = {
TERM = "xterm-256color";
LC_ALL = "en_US.UTF-8";
ARCHFLAGS = "-arch arm64";
RPROMPT = "";
PROMPT_COLOR = prompt-color;
};
# We put PROMPT in initExtra instead of localVariables.PROMPT because nix puts the string in double quotes, whereas we want single quotes for the command to run each time
initExtra =
''
get_stuff_in_nix() {
printf "%s" $PATH | tr ':' '\n' | grep '/nix/store' \
| sed -Ee 's|/nix/store/[0-9a-z]*-(.*)/.*|\1|g' \
| sed -Ee 's|-[0-9]+(\.[0-9]+)+||g' \
| tr '\n' ' '
}
export PROMPT='$(
BG=$PROMPT_COLOR
FG=0
NIX_CONTENT="$(get_stuff_in_nix)"
if [ ! -z "$NIX_BUILD_CORES" -o ! -z "$NIX_CONTENT" ] ; then
BG=91
FG=7
fi
echo -en "%{\033[0m\033[38;5;''${FG}m\033[48;5;''${BG}m%} ";
echo -n "["
${unambig-path}/bin/unambig-path
echo -en "] %T ";
echo -en "%{\033[0m\033[38:5:''${BG}m%}"
echo -en "%{\033[0m%} ";
)'
''
+ builtins.readFile ../dotfiles/zshrc;
};
programs.direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
programs.hyfetch = {
enable = true;
settings = {
preset = "nonbinary";
mode = "rgb";
color_align = {
mode = "horizontal";
};
};
};
programs.tmux = {
enable = true;
escapeTime = 50;
prefix = "C-]";
shell = "${programs.zsh.package}/bin/zsh";
historyLimit = 30000;
sensibleOnTop = false;
extraConfig =
''
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
bind left swap-window -d -t -1
bind right swap-window -d -t +1
set-option -sa terminal-overrides ",xterm*:Tc"
# Status bar options
set-option -g status on
set-option -g status-bg colour235
set-option -g status-fg "#FFC757"
set-option -g status-interval 2
set-option -g status-justify "centre"
set-option -g status-left-length 60
set-option -g status-left " [#S] "
set-option -g status-right " :3 "
set-option -g status-right-length 90
set -g status-interval 1
set-window-option -g window-status-separator "-"
set-window-option -g window-status-current-format " #[fg=#df73ff bold]!![ #{b:pane_current_path}/ ] #{b:window_index} $ #{b:pane_current_command}!! "
set-window-option -g window-status-format " #{b:window_index} [ #{b:pane_current_path}/ ] #{b:pane_current_command} "
set -g mouse on
set-option -g renumber-windows on # Make windows contiguous
'';
};
programs.git = {
enable = true;
aliases = {
s = "status";
lg = "log --graph --branches --all --decorate --pretty=\"%C(magenta)[%C(red)%an%C(magenta) %ad] %C(yellow)%h: %C(green)%s %C(blue)%N\" --date=short";
};
userName = "xenia";
userEmail = "xenia.agda@gmail.com";
ignores = [ "**/.DS_Store" ];
extraConfig = {
init.defaultBranch = "main";
pull.ff = "only";
pull.rebase = true;
core.editor = "kak";
};
};
}