some global options with flakes

This commit is contained in:
Noah Masur 2022-04-28 18:55:15 -04:00
parent f9d106e27d
commit 80209f3a4c
7 changed files with 340 additions and 325 deletions

View File

@ -30,9 +30,18 @@
./nixos/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${user} = { imports = [ ./nixos/home.nix ]; };
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${user} = {
imports = [
./nixos/home.nix
./modules/applications/firefox.nix
./modules/shell/fish.nix
./modules/applications/alacritty.nix
];
};
};
}
];
};

View File

@ -0,0 +1,71 @@
{ pkgs, config, ... }: {
programs.alacritty = {
enable = true;
settings = {
window = {
dimensions = {
columns = 85;
lines = 30;
};
padding = {
x = 20;
y = 20;
};
};
scrolling.history = 10000;
font = {
size = 14.0;
normal = { family = "${config.font}"; };
};
key_bindings = [
{
key = "L";
mods = "Control|Shift";
chars = "\\x1F";
}
{
key = "K";
mods = "Control";
mode = "~Vi";
action = "ToggleViMode";
}
{
key = "Return";
mode = "Vi";
action = "ToggleViMode";
}
];
colors = {
primary = {
background = "0x1d2021";
foreground = "0xd5c4a1";
};
cursor = {
text = "0x1d2021";
cursor = "0xd5c4a1";
};
normal = {
black = "0x1d2021";
red = "0xfb4934";
green = "0xb8bb26";
yellow = "0xfabd2f";
blue = "0x83a598";
magenta = "0xd3869b";
cyan = "0x8ec07c";
white = "0xd5c4a1";
};
bright = {
black = "0x665c54";
red = "0xfe8019";
green = "0x3c3836";
yellow = "0x504945";
blue = "0xbdae93";
magenta = "0xebdbb2";
cyan = "0xd65d0e";
white = "0xfbf1c7";
};
};
draw_bold_text_with_bright_colors = false;
};
};
}

View File

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [ firefox ];
}

View File

@ -0,0 +1 @@
{ pkgs, dotfiles, nixos_config ... }: { imports = [ ./fish.nix ]; }

129
modules/shell/fish.nix Normal file
View File

@ -0,0 +1,129 @@
{ config, pkgs, ... }: {
programs.fish = {
enable = true;
functions = { };
interactiveShellInit = "";
loginShellInit = "";
shellAliases = {
vim = "nvim";
sudo = "doas";
};
shellAbbrs = {
# Directory aliases
l = "ls";
lh = "ls -lh";
ll = "ls -alhF";
la = "ls -a";
lf = "ls -lh | fzf";
c = "cd";
"-" = "cd -";
mkd = "mkdir -pv";
# System
s = "sudo";
sc = "systemctl";
scs = "systemctl status";
reb =
"nixos-rebuild switch -I nixos-config=${config.nixos_config}/configuration.nix";
# 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";
gca = "git commit --amend --no-edit";
gcae = "git commit --amend";
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";
gha =
"gh run list | head -1 | awk '{ print $(NF-2) }' | xargs gh run view";
grw = "gh run watch";
grf = "gh run view --log-failed";
grl = "gh run view --log";
# Vim
v = "vim";
vl = "vim -c 'normal! `0'";
vll = "vim -c 'Telescope oldfiles'";
vimrc = "vim ${config.dotfiles}/nvim.configlink/init.lua";
# Notes
qn = "quicknote";
sn = "syncnotes";
to = "today";
work = "vim $NOTES_PATH/work.md";
# CLI Tools
cat = "bat"; # Swap cat with bat
h = "http -Fh --all"; # Curl site for headers
m = "make"; # For makefiles
# Fun CLI Tools
weather = "curl wttr.in/$WEATHER_CITY";
moon = "curl wttr.in/Moon";
# Cheat Sheets
ssl =
"openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr";
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";
};
shellAliases = { };
shellInit = "";
};
}

View File

@ -1,4 +1,4 @@
{ pkgs, user, ... }:
{ pkgs, lib, ... }:
let
@ -22,326 +22,136 @@ let
'';
in {
nixpkgs.config.allowUnfree = true;
options = with lib; {
user = mkOption { default = "noah"; };
font = mkOption { default = font; };
nixos_config = mkOption { default = nixos_config; };
dotfiles = mkOption { default = dotfiles; };
};
home.packages = with pkgs; [
# Applications
firefox
neovim
alacritty
_1password-gui
discord
# neomutt
himalaya # Email
mpv # Video viewer
sxiv # Image viewer
zathura # PDF viewer
qbittorrent
config = {
nixpkgs.config.allowUnfree = true;
# Utilities
unzip
gcc # for tree-sitter
starship
rsync
fzf
ripgrep
bat
fd
exa
sd
zoxide
jq
tealdeer
gh
direnv
tree
htop
glow
home.packages = with pkgs; [
# Applications
neovim
_1password-gui
discord
# neomutt
himalaya # Email
mpv # Video viewer
sxiv # Image viewer
zathura # PDF viewer
qbittorrent
# Encryption
gnupg
pass
];
# Utilities
unzip
gcc # for tree-sitter
starship
rsync
fzf
ripgrep
bat
fd
exa
sd
zoxide
jq
tealdeer
gh
direnv
tree
htop
glow
gtk.enable = true;
gtk.theme = { name = "Adwaita-dark"; };
# Encryption
gnupg
pass
];
programs.alacritty = {
enable = true;
settings = {
window = {
dimensions = {
columns = 85;
lines = 30;
};
padding = {
x = 20;
y = 20;
};
gtk.enable = true;
gtk.theme = { name = "Adwaita-dark"; };
home.sessionVariables = {
fish_greeting = "";
EDITOR = "${editor}";
NIXOS_CONFIG = "${nixos_config}";
DOTS = "${dotfiles}";
NOTES_PATH = "${notes_path}";
};
programs.starship = {
enable = true;
enableFishIntegration = true;
};
programs.fzf = {
enable = true;
enableFishIntegration = true;
};
programs.zoxide = {
enable = true;
enableFishIntegration = true;
};
# Other configs
xdg.configFile = {
"starship.toml".source = ../starship/starship.toml.configlink;
"nvim/init.lua".source = ../nvim.configlink/init.lua;
"fish/functions".source = ../fish.configlink/functions;
"awesome/rc.lua".source = ./awesomerc.lua;
"qtile/config.py".source = ./qtile.py;
"direnvrc".text = "source $HOME/.nix-profile/share/nix-direnv/direnvrc";
"spectrwm/spectrwm.conf".source = ./spectrwm.conf;
};
home.file = {
".rgignore".text = ignore_patterns;
".fdignore".text = ignore_patterns;
};
programs.direnv = {
enable = true;
nix-direnv.enable = true;
config = { whitelist = { prefix = [ "${dotfiles}/" ]; }; };
};
programs.git = {
enable = true;
userName = "${name}";
userEmail = "7386960+nmasur@users.noreply.github.com";
extraConfig = {
core = { editor = "nvim"; };
pager = { branch = "false"; };
safe = { directory = "${dotfiles}"; };
};
scrolling.history = 10000;
font = {
size = 14.0;
normal = { family = "${font}"; };
};
key_bindings = [
{
key = "L";
mods = "Control|Shift";
chars = "\\x1F";
}
{
key = "K";
mods = "Control";
mode = "~Vi";
action = "ToggleViMode";
}
{
key = "Return";
mode = "Vi";
action = "ToggleViMode";
}
];
colors = {
primary = {
background = "0x1d2021";
foreground = "0xd5c4a1";
};
cursor = {
text = "0x1d2021";
cursor = "0xd5c4a1";
};
normal = {
black = "0x1d2021";
red = "0xfb4934";
green = "0xb8bb26";
yellow = "0xfabd2f";
blue = "0x83a598";
magenta = "0xd3869b";
cyan = "0x8ec07c";
white = "0xd5c4a1";
};
bright = {
black = "0x665c54";
red = "0xfe8019";
green = "0x3c3836";
yellow = "0x504945";
blue = "0xbdae93";
magenta = "0xebdbb2";
cyan = "0xd65d0e";
white = "0xfbf1c7";
};
};
draw_bold_text_with_bright_colors = false;
};
};
programs.fish = {
enable = true;
functions = { };
interactiveShellInit = "";
loginShellInit = "";
shellAliases = {
vim = "nvim";
sudo = "doas";
programs.gh = {
enable = true;
enableGitCredentialHelper = true;
settings.git_protocol = "https";
};
shellAbbrs = {
# Directory aliases
l = "ls";
lh = "ls -lh";
ll = "ls -alhF";
la = "ls -a";
lf = "ls -lh | fzf";
c = "cd";
"-" = "cd -";
mkd = "mkdir -pv";
# System
s = "sudo";
sc = "systemctl";
scs = "systemctl status";
reb =
"nixos-rebuild switch -I nixos-config=${nixos_config}/configuration.nix";
# 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";
gca = "git commit --amend --no-edit";
gcae = "git commit --amend";
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";
gha =
"gh run list | head -1 | awk '{ print $(NF-2) }' | xargs gh run view";
grw = "gh run watch";
grf = "gh run view --log-failed";
grl = "gh run view --log";
# Vim
v = "vim";
vl = "vim -c 'normal! `0'";
vll = "vim -c 'Telescope oldfiles'";
vimrc = "vim ${dotfiles}/nvim.configlink/init.lua";
# Notes
qn = "quicknote";
sn = "syncnotes";
to = "today";
work = "vim $NOTES_PATH/work.md";
# CLI Tools
cat = "bat"; # Swap cat with bat
h = "http -Fh --all"; # Curl site for headers
m = "make"; # For makefiles
# Fun CLI Tools
weather = "curl wttr.in/$WEATHER_CITY";
moon = "curl wttr.in/Moon";
# Cheat Sheets
ssl =
"openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr";
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";
};
shellAliases = { };
shellInit = "";
# Email
# programs.himalaya = {
# enable = true;
# settings = {
# name = "${name}";
# 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";
# };
# };
# };
};
home.sessionVariables = {
fish_greeting = "";
EDITOR = "${editor}";
NIXOS_CONFIG = "${nixos_config}";
DOTS = "${dotfiles}";
NOTES_PATH = "${notes_path}";
};
programs.starship = {
enable = true;
enableFishIntegration = true;
};
programs.fzf = {
enable = true;
enableFishIntegration = true;
};
programs.zoxide = {
enable = true;
enableFishIntegration = true;
};
# Other configs
xdg.configFile = {
"starship.toml".source = ../starship/starship.toml.configlink;
"nvim/init.lua".source = ../nvim.configlink/init.lua;
"fish/functions".source = ../fish.configlink/functions;
"awesome/rc.lua".source = ./awesomerc.lua;
"qtile/config.py".source = ./qtile.py;
"direnvrc".text = "source $HOME/.nix-profile/share/nix-direnv/direnvrc";
"spectrwm/spectrwm.conf".source = ./spectrwm.conf;
};
home.file = {
".rgignore".text = ignore_patterns;
".fdignore".text = ignore_patterns;
};
programs.direnv = {
enable = true;
nix-direnv.enable = true;
config = { whitelist = { prefix = [ "${dotfiles}/" ]; }; };
};
programs.git = {
enable = true;
userName = "${name}";
userEmail = "7386960+nmasur@users.noreply.github.com";
extraConfig = {
core = { editor = "nvim"; };
pager = { branch = "false"; };
safe = { directory = "${dotfiles}"; };
};
};
programs.gh = {
enable = true;
enableGitCredentialHelper = true;
settings.git_protocol = "https";
};
# Email
# programs.himalaya = {
# enable = true;
# settings = {
# name = "${name}";
# 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";
# };
# };
# };
}

View File

@ -1,10 +0,0 @@
# Environment with formatting tools for editing these files
{ pkgs ? import <nixpkgs> { } }:
pkgs.mkShell {
nativeBuildInputs = [
pkgs.buildPackages.stylua
pkgs.buildPackages.nixfmt
pkgs.buildPackages.shfmt
pkgs.buildPackages.shellcheck
];
}