home/home.nix

179 lines
4.8 KiB
Nix
Raw Normal View History

2023-10-19 00:21:53 +02:00
{ pkgs, username, home-dir, prompt-color, xdg-runtime-dir, kak-pkg, unispect, ansi-utils, unambig-path }:
2023-10-12 22:51:18 +02:00
let
kak = import ./kak.nix { kak = kak-pkg; inherit pkgs; };
extras = import ./extras.nix pkgs;
in rec {
2023-10-19 00:18:10 +02:00
home.username = username;
home.homeDirectory = home-dir;
2023-10-12 22:51:18 +02:00
home.stateVersion = "23.05";
home.packages = with pkgs; extras.all ++ [
# Input packages
unispect
ansi-utils.ansicols
ansi-utils.ansimove
unambig-path
# # Terminal utilities
ripgrep fd bat
watchexec unixtools.watch
htop
fzf
pv
binwalk
ffmpeg yt-dlp
nmap
blahaj
# Programming languages
jq
rink
ghc
( python310.withPackages (ps: with ps; [
ipython numpy matplotlib sympy scipy pwntools z3 tqdm pwntools mypy # (pylsp-mypy.overrideAttrs (old: { doCheck = false; }))
(extras.challtools ps)
]))
( agda.withPackages (ps: with ps; [ standard-library cubical ]) )
# jupyter
# nodePackages.typescript
# nodePackages.typescript-language-server
# rust-analyzer
# # Other stuff
kak-lsp
# nix-tree
];
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 = "";
2023-10-19 00:21:53 +02:00
PROMPT_COLOR = prompt-color;
2023-10-12 22:51:18 +02:00
};
# 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' ' '
}
2023-10-12 22:51:18 +02:00
export PROMPT='$(
2023-10-19 00:21:53 +02:00
BG=$PROMPT_COLOR
2023-10-12 22:51:18 +02:00
FG=0
NIX_CONTENT="$(get_stuff_in_nix)"
if [ ! -z "$NIX_BUILD_CORES" -o ! -z "$NIX_CONTENT" ] ; then
2023-10-12 22:51:18 +02:00
BG=56
FG=15
fi
echo -en "%{\033[0m\033[38;5;''${FG}m\033[48;5;''${BG}m%} ";
echo -n "["
${unambig-path}/bin/unambig-path
echo -en "] $NIX_CONTENT%T ";
2023-10-12 22:51:18 +02:00
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;
};
2023-10-13 17:21:11 +02:00
programs.hyfetch = {
enable = true;
settings = {
preset = "nonbinary";
mode = "rgb";
color_align = {
mode = "horizontal";
};
};
};
2023-10-12 22:51:18 +02:00
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 = "${pkgs.emacs}/bin/emacsclient --create-frame --alternate-editor=''";
};
};
}