home-manager: inital commit
This commit is contained in:
parent
faaaa3d324
commit
2cbef00925
31 changed files with 1558 additions and 0 deletions
303
home/dev/terminal.nix
Normal file
303
home/dev/terminal.nix
Normal file
|
@ -0,0 +1,303 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: {
|
||||
# TODO: pull in some stuff from
|
||||
# https://docs.projectbluefin.io/command-line/
|
||||
|
||||
imports = [
|
||||
inputs.nix-index-database.hmModules.nix-index
|
||||
];
|
||||
|
||||
# NOTE: for fish, I need the
|
||||
# system to have programs.fish.enable = true;
|
||||
# so that the shell integration can find the nix binary properly.
|
||||
home.shell.enableFishIntegration = true;
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
interactiveShellInit = ''
|
||||
#
|
||||
# bobthefisher appearance config
|
||||
#
|
||||
set theme_nerd_fonts yes # use nerd fonts for powerline
|
||||
set theme_newline_cursor yes # cursor on newline
|
||||
set theme_color_scheme terminal2
|
||||
set theme_git_default_branches master main integration
|
||||
|
||||
#
|
||||
# tmux config
|
||||
#
|
||||
set -g fish_tmux_autoname_session true
|
||||
set -g fish_tmux_autostart_once false
|
||||
set -g fish_tmux_autostart true
|
||||
'';
|
||||
plugins = with pkgs; [
|
||||
# Git-aware powerline style fish theme
|
||||
{
|
||||
name = "bobthefisher";
|
||||
src = fishPlugins.bobthefisher.src;
|
||||
}
|
||||
|
||||
# Makes $CMD_DURATION human readable; goes hand in hand with the above
|
||||
{
|
||||
name = "humantime-fish";
|
||||
src = fishPlugins.humantime-fish;
|
||||
}
|
||||
|
||||
# Adds mnemonic key bindings to find various things
|
||||
# using fzf.
|
||||
# https://github.com/PatrickF1/fzf.fish
|
||||
#
|
||||
# CHEATSHEET
|
||||
# Ctrl Alt [F]ile - Search directory for files
|
||||
# Ctrl Alt [R]everse - Reverse-i-search - Typically overwritten by atuin
|
||||
# Ctrl Alt [S]tatus - Search git status
|
||||
# Ctrl Alt [P]rocess - Search list of running processes
|
||||
# Ctrl Alt [V]ariable - Search all shell variables
|
||||
{
|
||||
name = "fzf.fish";
|
||||
src = fishPlugins.fzf-fish.src;
|
||||
}
|
||||
|
||||
# KILL: use Atuin instead
|
||||
# use ctrl + o then ctrl + d to remove items from history
|
||||
#
|
||||
# Helps keep command history tiday, and lets me
|
||||
# remove stuff easily if I ever need to
|
||||
# https://github.com/meaningful-ooo/sponge
|
||||
#
|
||||
# CHEATSHEET
|
||||
# history clear - self explanatory
|
||||
# {
|
||||
# name = "sponge";
|
||||
# src = fishPlugins.sponge.src;
|
||||
# }
|
||||
|
||||
# Lightweight and interactive git in
|
||||
# the terminal powered by fzf.
|
||||
# https://github.com/meaningful-ooo/sponge
|
||||
#
|
||||
# CHEATSHEET
|
||||
# ga - git add
|
||||
# glo - git log
|
||||
# gi - .gitignore generator
|
||||
# gd - git diff
|
||||
# gso - git show
|
||||
# grh - git reset HEAD <file>
|
||||
# gbd - git branch -D <branch>
|
||||
# gcf - git checkout <file>
|
||||
# gcb - git checkout <branch>
|
||||
# gct - git checkout <tag>
|
||||
# gco - git checkout <commit>
|
||||
# grc - git revert <commit>
|
||||
# gss - view git stashes
|
||||
# gsp - git stash push
|
||||
# gclean - git clean
|
||||
# gcp - git cherry-pick
|
||||
# grb - git rebase -i
|
||||
# grl - git reflog
|
||||
# gbl - git blame
|
||||
# gfu - git commit --fixup && git rebase -i --autosquash
|
||||
{
|
||||
name = "forgit";
|
||||
src = fishPlugins.forgit.src;
|
||||
}
|
||||
|
||||
# Fish integration for tmux
|
||||
# Some useful aliases, autostart tmux, etc.
|
||||
#
|
||||
# CHEATSHEET
|
||||
# ta - tmux attach -t | Attach new tmux session to already running named session
|
||||
# tad - tmux attach -d -t | Detach named tmux session
|
||||
# tds - _fish_tmux_directory_session | Creates or attaches to a session for the current path
|
||||
# tkss - tmux kill-session -t | Terminate named running tmux session
|
||||
# tl - tmux list-sessions | Displays a list of running tmux sessions
|
||||
# tmux - _fish_tmux_plugin_run | Start a new tmux session
|
||||
# ts - tmux new-session -s | Create a new named tmux session
|
||||
{
|
||||
name = "tmux.fish";
|
||||
src = fetchFromGitHub {
|
||||
owner = "budimanjojo";
|
||||
repo = "tmux.fish";
|
||||
rev = "v2.0.1";
|
||||
sha256 = "sha256-ynhEhrdXQfE1dcYsSk2M2BFScNXWPh3aws0U7eDFtv4=";
|
||||
};
|
||||
}
|
||||
|
||||
# Faster navigation of directory trees
|
||||
#
|
||||
# CHEATSHEET
|
||||
# use z <dirname> (from anywhere) instead of cd when you want to
|
||||
# move to a particular folder.
|
||||
#
|
||||
# use z on its own to return to the 'root' directory, which it
|
||||
# figures out intelligently. (e.g. the root of a git repository)
|
||||
#
|
||||
# https://github.com/jethrokuan/z/blob/master/man/man1/z.md
|
||||
{
|
||||
name = "z";
|
||||
src = fishPlugins.z.src;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# terminal emulator
|
||||
home.sessionVariables.TERMINAL = "alacritty";
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
|
||||
# man 5 alacritty
|
||||
# or
|
||||
# https://alacritty.org/config-alacritty.html
|
||||
settings = {
|
||||
# TODO: make a central place for defining my terminal font
|
||||
font.normal = { family = "CommitMono Nerd Font"; style = "Regular"; };
|
||||
font.size = 14.0;
|
||||
font.builtin_box_drawing = false;
|
||||
};
|
||||
};
|
||||
|
||||
# command history
|
||||
programs.atuin = {
|
||||
enable = true;
|
||||
|
||||
settings.store_failed = false; # keep command history clean
|
||||
settings.update_check = false; # we are nix powered
|
||||
settings.enter_accept = true; # automatically execute stuff on enter
|
||||
settings.keymap_mode = "vim-insert"; # i like vim
|
||||
settings.show_tabs = false; # no real need for these imo
|
||||
settings.workspaces = true; # filter commands when in git repo; can unfilter with ctrl + r
|
||||
};
|
||||
|
||||
# tmux
|
||||
# .. probably good to have this here
|
||||
# https://tmuxcheatsheet.com/
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
|
||||
shell = "${pkgs.fish}/bin/fish";
|
||||
newSession = true; # create new shell when attaching with none running
|
||||
|
||||
historyLimit = 7500;
|
||||
keyMode = "vi";
|
||||
|
||||
plugins = with pkgs.tmuxPlugins; [
|
||||
better-mouse-mode
|
||||
|
||||
{
|
||||
plugin = tmux-which-key;
|
||||
extraConfig = ''
|
||||
set -g @tmux-which-key-xdg-enable 1;
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
extraConfig = ''
|
||||
# Mouse works as expected
|
||||
set-option -g mouse on
|
||||
|
||||
# easy-to-remember split pane commands
|
||||
bind | split-window -h -c "#{pane_current_path}"
|
||||
bind - split-window -v -c "#{pane_current_path}"
|
||||
bind c new-window -c "#{pane_current_path}"
|
||||
'';
|
||||
};
|
||||
|
||||
xdg.configFile = {
|
||||
"tmux/plugins/tmux-which-key/config.yaml".text = lib.generators.toYAML {} {
|
||||
# The starting index to use for the command-alias option, used for macros
|
||||
# (required). This value must be at least 200
|
||||
command_alias_start_index = 200;
|
||||
# The keybindings that open the action menu (required)
|
||||
keybindings = {
|
||||
prefix_table = "Space";
|
||||
root_table = "C-Space";
|
||||
};
|
||||
# The menu title config (optional)
|
||||
title = {
|
||||
style = "align=centre,bold";
|
||||
prefix = "tmux"; # A prefix added to every menu title
|
||||
prefix_style = "fg=green,align=centre,bold";
|
||||
};
|
||||
# The menu position (optional)
|
||||
position = {
|
||||
x = "R";
|
||||
y = "P";
|
||||
};
|
||||
# tmux-only env vars that can be used in commands and macros (optional)
|
||||
# custom_variables = {
|
||||
# foo = "bar";
|
||||
# };
|
||||
# User-defined macros that can be triggered by the menu (optional)
|
||||
# macros = {
|
||||
# restart-pane = [ # the macro pane
|
||||
# # the macro commands
|
||||
# "respawnp -k -c #{pane_current_path}"
|
||||
# "display \"#{log_info} Pane restarted\""
|
||||
# ];
|
||||
# };
|
||||
# The root menu items (required)
|
||||
items = [
|
||||
{
|
||||
name = "Next pane";
|
||||
key = "space"; # the key that triggers this action
|
||||
command = "next-pane"; # a command to run
|
||||
}
|
||||
|
||||
# {
|
||||
# name = "Respawn pane";
|
||||
# key = "R";
|
||||
# macro = "restart-pane"; # a custom macro (defined above)
|
||||
# }
|
||||
|
||||
{
|
||||
separator = true; # a menu separator
|
||||
}
|
||||
{
|
||||
name = "+Layout"; # a submenu
|
||||
key = "l";
|
||||
command = "nextl";
|
||||
transient = true; # whether to keep the menu open until ESC is pressed
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
programs.bat.enable = true;
|
||||
programs.fd.enable = true;
|
||||
programs.fzf.enable = true;
|
||||
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
# Externally located cache
|
||||
stdlib = ''
|
||||
declare -A direnv_layout_dirs
|
||||
direnv_layout_dir() {
|
||||
local hash path
|
||||
echo "''${direnv_layout_dirs[$PWD]:=$(
|
||||
hash="$(sha1sum - <<< "$PWD" | head -c40)"
|
||||
path="''${PWD//[^a-zA-Z0-9]/-}"
|
||||
echo "${config.xdg.cacheHome}/direnv/layouts/''${hash}''${path}"
|
||||
)}"
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
# replaces ls
|
||||
programs.eza = {
|
||||
enable = true;
|
||||
git = true;
|
||||
icons = "auto";
|
||||
};
|
||||
|
||||
# TODO: importing the input doesn't work, so
|
||||
# I can't enable this from here.. why?
|
||||
# makes it so that you can run a program without
|
||||
# installing it by typing , <program>
|
||||
programs.nix-index.enable = true;
|
||||
programs.nix-index-database.comma.enable = true;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue