dotfiles/nixos/home.nix

348 lines
7.5 KiB
Nix
Raw Normal View History

2022-04-27 13:23:26 +00:00
{ pkgs, user, ... }:
2021-08-09 12:19:21 +00:00
let
2022-01-22 19:01:32 +00:00
name = "Noah Masur";
2022-01-22 20:58:20 +00:00
editor = "nvim";
2022-01-22 16:01:52 +00:00
font = "Victor Mono";
dotfiles = builtins.toString ../.;
nixos_config = builtins.toString ./.;
2022-04-23 16:27:17 +00:00
notes_path = "$HOME/dev/personal/notes";
2021-08-09 12:19:21 +00:00
2022-04-26 00:34:33 +00:00
ignore_patterns = ''
!.env*
!.github/
!.gitignore
!*.tfvars
.terraform/
.target/
/Library/
keybase/
kbfs/
'';
2022-01-22 16:01:52 +00:00
in {
2022-01-13 13:51:13 +00:00
nixpkgs.config.allowUnfree = true;
2021-08-09 12:19:21 +00:00
home.packages = with pkgs; [
2022-01-22 16:01:52 +00:00
# Applications
2022-01-13 13:51:13 +00:00
firefox
2021-11-24 03:19:19 +00:00
neovim
2022-01-13 13:51:13 +00:00
alacritty
2022-01-22 16:01:52 +00:00
_1password-gui
discord
# neomutt
himalaya # Email
mpv # Video viewer
sxiv # Image viewer
2022-01-23 04:41:53 +00:00
zathura # PDF viewer
2022-04-23 16:22:04 +00:00
qbittorrent
2022-01-22 16:01:52 +00:00
# Utilities
unzip
gcc # for tree-sitter
2022-01-23 00:16:37 +00:00
starship
2021-08-09 12:19:21 +00:00
rsync
2022-01-23 00:16:37 +00:00
fzf
2021-08-09 12:19:21 +00:00
ripgrep
bat
fd
exa
sd
2022-01-23 00:16:37 +00:00
zoxide
2021-08-09 12:19:21 +00:00
jq
tealdeer
2022-01-13 14:39:48 +00:00
gh
2022-01-23 00:16:37 +00:00
direnv
2022-01-23 04:41:53 +00:00
tree
htop
2022-01-24 01:32:38 +00:00
glow
2022-01-23 00:16:37 +00:00
# Encryption
gnupg
2022-01-22 16:01:52 +00:00
pass
2021-08-09 12:19:21 +00:00
];
2022-01-23 04:41:53 +00:00
gtk.enable = true;
gtk.theme = { name = "Adwaita-dark"; };
2022-01-13 23:44:56 +00:00
programs.alacritty = {
enable = true;
settings = {
window = {
dimensions = {
columns = 85;
lines = 30;
};
padding = {
x = 20;
y = 20;
};
};
scrolling.history = 10000;
font = {
2022-01-22 15:46:51 +00:00
size = 14.0;
2022-01-22 16:01:52 +00:00
normal = { family = "${font}"; };
2022-01-13 23:44:56 +00:00
};
2022-01-22 20:58:20 +00:00
key_bindings = [
{
key = "L";
mods = "Control|Shift";
chars = "\\x1F";
}
{
key = "K";
mods = "Control";
mode = "~Vi";
action = "ToggleViMode";
}
{
key = "Return";
mode = "Vi";
action = "ToggleViMode";
}
];
2022-01-13 23:44:56 +00:00
colors = {
primary = {
background = "0x1d2021";
foreground = "0xd5c4a1";
};
cursor = {
text = "0x1d2021";
cursor = "0xd5c4a1";
};
normal = {
2022-01-22 16:01:52 +00:00
black = "0x1d2021";
red = "0xfb4934";
green = "0xb8bb26";
yellow = "0xfabd2f";
blue = "0x83a598";
2022-01-13 23:44:56 +00:00
magenta = "0xd3869b";
2022-01-22 16:01:52 +00:00
cyan = "0x8ec07c";
white = "0xd5c4a1";
2022-01-13 23:44:56 +00:00
};
bright = {
2022-01-22 16:01:52 +00:00
black = "0x665c54";
red = "0xfe8019";
green = "0x3c3836";
yellow = "0x504945";
blue = "0xbdae93";
2022-01-13 23:44:56 +00:00
magenta = "0xebdbb2";
2022-01-22 16:01:52 +00:00
cyan = "0xd65d0e";
white = "0xfbf1c7";
2022-01-13 23:44:56 +00:00
};
};
draw_bold_text_with_bright_colors = false;
};
};
2021-08-09 12:19:21 +00:00
programs.fish = {
enable = true;
2022-01-22 16:01:52 +00:00
functions = { };
2021-08-09 12:45:46 +00:00
interactiveShellInit = "";
loginShellInit = "";
2022-01-22 20:58:20 +00:00
shellAliases = {
vim = "nvim";
sudo = "doas";
};
2021-08-09 12:45:46 +00:00
shellAbbrs = {
# Directory aliases
l = "ls";
lh = "ls -lh";
ll = "ls -alhF";
2022-04-24 14:49:10 +00:00
la = "ls -a";
2021-08-09 12:45:46 +00:00
lf = "ls -lh | fzf";
c = "cd";
2022-01-22 19:55:22 +00:00
"-" = "cd -";
2021-08-09 12:45:46 +00:00
mkd = "mkdir -pv";
2022-04-23 17:45:41 +00:00
# System
s = "sudo";
sc = "systemctl";
2022-04-24 14:49:10 +00:00
scs = "systemctl status";
2022-04-26 23:44:11 +00:00
reb =
"nixos-rebuild switch -I nixos-config=${nixos_config}/configuration.nix";
2022-04-23 17:45:41 +00:00
2021-08-09 12:45:46 +00:00
# Tmux
ta = "tmux attach-session";
tan = "tmux attach-session -t noah";
tnn = "tmux new-session -s noah";
# Git
g = "git";
gs = "git status";
gd = "git diff";
gds = "git diff --staged";
gdp = "git diff HEAD^";
ga = "git add";
gaa = "git add -A";
gac = "git commit -am";
gc = "git commit -m";
2022-01-22 16:06:14 +00:00
gca = "git commit --amend --no-edit";
2022-04-23 17:45:41 +00:00
gcae = "git commit --amend";
2021-08-09 12:45:46 +00:00
gu = "git pull";
gp = "git push";
gpp = "git_set_upstream";
gl = "git log --graph --decorate --oneline -20";
gll = "git log --graph --decorate --oneline";
gco = "git checkout";
gcom = "git switch master";
gcob = "git switch -c";
gb = "git branch";
gbd = "git branch -d";
gbD = "git branch -D";
gr = "git reset";
grh = "git reset --hard";
gm = "git merge";
gcp = "git cherry-pick";
cdg = "cd (git rev-parse --show-toplevel)";
# GitHub
ghr = "gh repo view -w";
2022-01-22 16:01:52 +00:00
gha =
"gh run list | head -1 | awk '{ print $(NF-2) }' | xargs gh run view";
2021-08-09 12:45:46 +00:00
grw = "gh run watch";
grf = "gh run view --log-failed";
grl = "gh run view --log";
# Vim
2022-01-22 16:06:14 +00:00
v = "vim";
vl = "vim -c 'normal! `0'";
vll = "vim -c 'Telescope oldfiles'";
vimrc = "vim ${dotfiles}/nvim.configlink/init.lua";
2021-08-09 12:45:46 +00:00
# Notes
qn = "quicknote";
sn = "syncnotes";
to = "today";
work = "vim $NOTES_PATH/work.md";
# CLI Tools
2022-01-22 16:01:52 +00:00
cat = "bat"; # Swap cat with bat
2021-08-09 12:45:46 +00:00
h = "http -Fh --all"; # Curl site for headers
m = "make"; # For makefiles
2021-08-09 12:45:46 +00:00
# Fun CLI Tools
weather = "curl wttr.in/$WEATHER_CITY";
moon = "curl wttr.in/Moon";
# Cheat Sheets
2022-01-22 16:01:52 +00:00
ssl =
"openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr";
2021-08-09 12:45:46 +00:00
fingerprint = "ssh-keyscan myhost.com | ssh-keygen -lf -";
publickey = "ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub";
forloop = "for i in (seq 1 100)";
# Docker
dc = "$DOTS/bin/docker_cleanup";
dr = "docker run --rm -it";
db = "docker build . -t";
# Terraform
te = "terraform";
# Kubernetes
k = "kubectl";
pods = "kubectl get pods -A";
nodes = "kubectl get nodes";
deploys = "kubectl get deployments -A";
dash = "kube-dashboard";
ks = "k9s";
# Python
py = "python";
po = "poetry";
pr = "poetry run python";
# Rust
ca = "cargo";
};
2022-01-22 16:01:52 +00:00
shellAliases = { };
2021-08-09 12:45:46 +00:00
shellInit = "";
2021-08-09 12:19:21 +00:00
};
home.sessionVariables = {
2021-11-06 19:16:53 +00:00
fish_greeting = "";
2022-01-22 20:58:20 +00:00
EDITOR = "${editor}";
NIXOS_CONFIG = "${nixos_config}";
DOTS = "${dotfiles}";
2022-04-23 16:27:17 +00:00
NOTES_PATH = "${notes_path}";
2021-08-09 12:19:21 +00:00
};
programs.starship = {
enable = true;
enableFishIntegration = true;
};
programs.fzf = {
enable = true;
enableFishIntegration = true;
};
2021-08-09 12:45:46 +00:00
programs.zoxide = {
enable = true;
enableFishIntegration = true;
};
2021-08-09 12:19:21 +00:00
# Other configs
xdg.configFile = {
"starship.toml".source = ../starship/starship.toml.configlink;
2022-01-13 23:23:49 +00:00
"nvim/init.lua".source = ../nvim.configlink/init.lua;
2022-01-13 23:54:26 +00:00
"fish/functions".source = ../fish.configlink/functions;
2022-01-22 19:01:32 +00:00
"awesome/rc.lua".source = ./awesomerc.lua;
2022-01-23 16:37:47 +00:00
"qtile/config.py".source = ./qtile.py;
2022-01-22 20:58:20 +00:00
"direnvrc".text = "source $HOME/.nix-profile/share/nix-direnv/direnvrc";
2022-01-24 01:32:38 +00:00
"spectrwm/spectrwm.conf".source = ./spectrwm.conf;
2022-01-22 19:01:32 +00:00
};
2022-04-26 00:34:33 +00:00
home.file = {
".rgignore".text = ignore_patterns;
".fdignore".text = ignore_patterns;
};
2022-01-22 19:01:32 +00:00
programs.direnv = {
enable = true;
nix-direnv.enable = true;
config = { whitelist = { prefix = [ "${dotfiles}/" ]; }; };
2021-08-09 12:19:21 +00:00
};
programs.git = {
enable = true;
2022-01-22 19:01:32 +00:00
userName = "${name}";
2021-08-09 12:19:21 +00:00
userEmail = "7386960+nmasur@users.noreply.github.com";
extraConfig = {
2022-01-22 16:01:52 +00:00
core = { editor = "nvim"; };
pager = { branch = "false"; };
2022-04-27 01:36:16 +00:00
safe = { directory = "${dotfiles}"; };
2021-08-09 12:19:21 +00:00
};
};
2022-01-13 14:39:48 +00:00
programs.gh = {
enable = true;
enableGitCredentialHelper = true;
settings.git_protocol = "https";
};
2022-01-17 05:18:49 +00:00
# Email
2022-01-22 16:01:52 +00:00
# programs.himalaya = {
# enable = true;
# settings = {
2022-01-22 19:01:32 +00:00
# name = "${name}";
2022-01-22 16:01:52 +00:00
# downloads-dir = "~/Downloads";
# home = {
# default = true;
# email = "censored";
# imap-host = "censored";
# imap-port = 993;
# imap-login = "censored";
# imap-passwd-cmd = "cat ~/.config/himalaya/passwd";
# smtp-host = "censored";
# smtp-port = 587;
# smtp-login = "censored";
# smtp-passwd-cmd = "cat ~/.config/himalaya/passwd";
# };
# };
# };
2021-08-09 12:19:21 +00:00
}