initial commit

This commit is contained in:
Barrett Ruth 2026-02-07 00:45:47 -05:00
commit 23d4795228
99 changed files with 6691 additions and 0 deletions

17
home/modules/editor.nix Normal file
View file

@ -0,0 +1,17 @@
{ pkgs, config, ... }:
{
home.sessionVariables = {
EDITOR = "nvim";
MANPAGER = "nvim +Man!";
};
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
};
xdg.configFile."nvim".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nix-config/config/nvim";
}

95
home/modules/git.nix Normal file
View file

@ -0,0 +1,95 @@
{ pkgs, config, ... }:
{
programs.git = {
enable = true;
lfs.enable = true;
ignores = [
"*.swp"
"*.swo"
"*~"
".vscode/"
".idea/"
".DS_Store"
"Thumbs.db"
"*.o"
"*.a"
"*.so"
"*.pyc"
"__pycache__/"
"node_modules/"
"target/"
"dist/"
"build/"
"out/"
"*.class"
"*.log"
".env"
".env.local"
".envrc"
"venv/"
".mypy_cache/"
"result"
"result-*"
".claude/settings.local.json"
];
settings = {
user = {
name = "Barrett Ruth";
email = "br@barrettruth.com";
};
alias = {
a = "add";
b = "branch";
c = "commit";
acp = "!acp() { git add . && git commit -m \"$*\" && git push; }; acp";
cane = "commit --amend --no-edit";
cf = "config";
ch = "checkout";
cl = "clone";
cp = "cherry-pick";
d = "diff";
dt = "difftool";
f = "fetch";
i = "init";
lg = "log --oneline --graph --decorate";
m = "merge";
p = "pull";
pu = "push";
r = "remote";
rb = "rebase";
rs = "restore";
rt = "reset";
s = "status";
sm = "submodule";
st = "stash";
sw = "switch";
wt = "worktree";
};
init.defaultBranch = "main";
core = {
editor = "nvim";
whitespace = "fix,-indent-with-non-tab,trailing-space,cr-at-eol";
};
color.ui = "auto";
diff.tool = "codediff";
difftool.prompt = false;
difftool.codediff.cmd = "nvim -c 'CodeDiff' $LOCAL $REMOTE";
merge.tool = "codediff";
mergetool.prompt = false;
mergetool.codediff.cmd = "nvim -c 'CodeDiff' $LOCAL $REMOTE $MERGED";
push.autoSetupRemote = true;
credential.helper = "cache";
};
};
programs.gh = {
enable = true;
settings = {
git_protocol = "ssh";
prompt = "enabled";
};
};
}

92
home/modules/packages.nix Normal file
View file

@ -0,0 +1,92 @@
{ pkgs, lib, config, zen-browser, system, ... }:
let
zen = true;
sioyek = true;
vesktop = true;
neovim = config.programs.neovim.enable;
in {
home.sessionVariables = lib.optionalAttrs zen {
BROWSER = "zen-browser";
};
programs.mpv.enable = true;
home.packages = with pkgs; [
signal-desktop
slack
bitwarden-desktop
claude-code
]
++ lib.optionals zen [ zen-browser.packages.${system}.default ]
++ lib.optionals sioyek [ pkgs.sioyek ]
++ lib.optionals vesktop [ pkgs.vesktop ];
home.activation.linkZenProfile = lib.mkIf zen (
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
zen_config="$HOME/.zen"
repo_zen="${config.home.homeDirectory}/nix-config/config/zen"
if [ ! -d "$zen_config" ]; then
exit 0
fi
profile=""
for d in "$zen_config"/*.Default\ \(release\); do
[ -d "$d" ] && profile="$d" && break
done
if [ -z "$profile" ]; then
exit 0
fi
mkdir -p "$profile/chrome"
for f in userChrome.css user.js containers.json handlers.json zen-keyboard-shortcuts.json; do
src="$repo_zen/$f"
if [ "$f" = "userChrome.css" ]; then
dest="$profile/chrome/$f"
else
dest="$profile/$f"
fi
[ -f "$src" ] || continue
if [ -L "$dest" ]; then
continue
fi
if [ -f "$dest" ]; then
rm "$dest"
fi
ln -s "$src" "$dest"
done
''
);
xdg.configFile."electron-flags.conf".text = ''
--enable-features=WaylandWindowDecorations
--ozone-platform-hint=auto
'';
xdg.mimeApps = {
enable = true;
defaultApplications = {}
// lib.optionalAttrs zen {
"x-scheme-handler/http" = "zen.desktop";
"x-scheme-handler/https" = "zen.desktop";
"text/html" = "zen.desktop";
}
// lib.optionalAttrs neovim {
"text/plain" = "nvim.desktop";
}
// lib.optionalAttrs sioyek {
"application/pdf" = "sioyek.desktop";
"application/epub" = "sioyek.desktop";
}
// lib.optionalAttrs vesktop {
"x-scheme-handler/discord" = "vesktop.desktop";
};
};
}

504
home/modules/shell.nix Normal file
View file

@ -0,0 +1,504 @@
{ pkgs, lib, config, ... }:
let
c = config.colors;
isNixOS = builtins.pathExists /etc/NIXOS;
ripgrep = config.programs.ripgrep.enable;
rust = true;
go = true;
node = true;
python = true;
ocaml = true;
docker = true;
aws = true;
psql = true;
sqlite = true;
in {
home.packages = with pkgs; [
pure-prompt
xclip
tree
jq
curl
wget
unzip
tesseract
gnumake
gcc
file
ffmpeg
poppler-utils
librsvg
imagemagick
];
home.sessionVariables = {
LESSHISTFILE = "-";
}
// lib.optionalAttrs ripgrep {
RIPGREP_CONFIG_PATH = "${config.xdg.configHome}/rg/config";
}
// lib.optionalAttrs rust {
CARGO_HOME = "${config.xdg.dataHome}/cargo";
RUSTUP_HOME = "${config.xdg.dataHome}/rustup";
}
// lib.optionalAttrs go {
GOPATH = "${config.xdg.dataHome}/go";
GOMODCACHE = "${config.xdg.cacheHome}/go/mod";
}
// lib.optionalAttrs node {
NPM_CONFIG_USERCONFIG = "${config.xdg.configHome}/npm/npmrc";
NODE_REPL_HISTORY = "${config.xdg.stateHome}/node_repl_history";
PNPM_HOME = "${config.xdg.dataHome}/pnpm";
}
// lib.optionalAttrs python {
PYTHONSTARTUP = "${config.xdg.configHome}/python/pythonrc";
PYTHON_HISTORY = "${config.xdg.stateHome}/python_history";
PYTHONPYCACHEPREFIX = "${config.xdg.cacheHome}/python";
PYTHONUSERBASE = "${config.xdg.dataHome}/python";
}
// lib.optionalAttrs ocaml {
OPAMROOT = "${config.xdg.dataHome}/opam";
}
// lib.optionalAttrs docker {
DOCKER_CONFIG = "${config.xdg.configHome}/docker";
}
// lib.optionalAttrs aws {
AWS_SHARED_CREDENTIALS_FILE = "${config.xdg.configHome}/aws/credentials";
AWS_CONFIG_FILE = "${config.xdg.configHome}/aws/config";
}
// lib.optionalAttrs psql {
PSQL_HISTORY = "${config.xdg.stateHome}/psql_history";
}
// lib.optionalAttrs sqlite {
SQLITE_HISTORY = "${config.xdg.stateHome}/sqlite_history";
};
home.sessionPath = [
"${config.home.homeDirectory}/.local/bin"
"${config.home.homeDirectory}/.local/bin/scripts"
]
++ lib.optionals rust [ "${config.xdg.dataHome}/cargo/bin" ]
++ lib.optionals go [ "${config.xdg.dataHome}/go/bin" ]
++ lib.optionals node [ "${config.xdg.dataHome}/pnpm" ];
xdg.configFile."npm/npmrc" = lib.mkIf node {
text = ''
prefix=''${XDG_DATA_HOME}/npm
cache=''${XDG_CACHE_HOME}/npm
init-module=''${XDG_CONFIG_HOME}/npm/config/npm-init.js
'';
};
xdg.configFile."python/pythonrc" = lib.mkIf python {
text = ''
import atexit
import os
import readline
history = os.path.join(os.environ.get('XDG_STATE_HOME', os.path.expanduser('~/.local/state')), 'python_history')
try:
readline.read_history_file(history)
except OSError:
pass
def write_history():
try:
readline.write_history_file(history)
except OSError:
pass
atexit.register(write_history)
'';
};
xdg.configFile."rg/config" = lib.mkIf ripgrep {
text = ''
--column
--no-heading
--smart-case
--no-follow
--glob=!pnpm-lock.yaml
--glob=!*.json
--glob=!venv/
--glob=!pyenv/
--ignore-file=${config.xdg.configHome}/git/ignore
--no-messages
--color=auto
--colors=line:style:nobold
--colors=line:fg:242
--colors=match:fg:green
--colors=match:style:bold
--colors=path:fg:blue
'';
};
programs.zsh = {
enable = true;
dotDir = "${config.xdg.configHome}/zsh";
history = {
path = "${config.xdg.stateHome}/zsh_history";
size = 2000;
save = 2000;
ignoreDups = true;
ignoreAllDups = true;
ignoreSpace = true;
extended = true;
append = true;
};
shellAliases = {
ls = "eza";
l = "ls --color=auto --group-directories-first";
ll = "l -alF";
la = "ll -R";
g = "git";
nv = "nvim";
pe = "printenv";
};
completionInit = ''
autoload -U compinit && compinit -d "$XDG_STATE_HOME/zcompdump" -u
zmodload zsh/complist
zstyle ':completion:*' list-colors ''${(s.:.)LS_COLORS}
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-za-z}'
'';
initContent = ''
export THEME="''${THEME:-${config.theme}}"
setopt auto_cd
unsetopt beep notify
unset completealiases
bindkey -v
bindkey '^[[3~' delete-char
bindkey '^P' up-line-or-history
bindkey '^N' down-line-or-history
bindkey '^J' backward-char
bindkey '^K' forward-char
export PURE_PROMPT_SYMBOL=">"
export PURE_PROMPT_VICMD_SYMBOL="<"
export PURE_GIT_UP_ARROW="^"
export PURE_GIT_DOWN_ARROW="v"
export PURE_GIT_STASH_SYMBOL="="
export PURE_CMD_MAX_EXEC_TIME=5
export PURE_GIT_PULL=0
export PURE_GIT_UNTRACKED_DIRTY=1
zstyle ':prompt:pure:git:stash' show yes
fpath+=("${pkgs.pure-prompt}/share/zsh/site-functions")
autoload -Uz promptinit && promptinit
prompt pure
autoload -Uz add-zle-hook-widget
function _cursor_shape() {
case $KEYMAP in
vicmd) echo -ne '\e[2 q' ;;
viins|main) echo -ne '\e[6 q' ;;
esac
}
function _cursor_init() { echo -ne '\e[6 q'; }
add-zle-hook-widget zle-keymap-select _cursor_shape
add-zle-hook-widget zle-line-init _cursor_init
export FZF_COMPLETION_TRIGGER=\;
export FZF_TMUX=1
fzf-config-widget() {
file="$(fd --type file --hidden . ~/.config | sed "s|$HOME|~|g" | fzf)"
[ -n "$file" ] || { zle reset-prompt; return; }
file="${file/#\~/$HOME}"
BUFFER="nvim $file"
zle accept-line
}
zle -N fzf-config-widget
bindkey '^E' fzf-config-widget
'' + lib.optionalString ocaml ''
[[ ! -r "$OPAMROOT/opam-init/init.zsh" ]] || source "$OPAMROOT/opam-init/init.zsh" > /dev/null 2> /dev/null
'';
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
defaultCommand = "rg --files --hidden";
defaultOptions = [
"--bind=ctrl-a:select-all"
"--bind=ctrl-f:half-page-down"
"--bind=ctrl-b:half-page-up"
"--no-scrollbar"
"--no-info"
"--color=fg:${c.fg},bg:${c.bg},hl:${c.accent}"
"--color=fg+:${c.fg},bg+:${c.bgAlt},hl+:${c.accent}"
"--color=info:${c.green},prompt:${c.accent},pointer:${c.fg},marker:${c.green},spinner:${c.fg}"
];
changeDirWidgetCommand = "fd --type d --hidden";
fileWidgetCommand = "rg --files --hidden";
historyWidgetOptions = [ "--reverse" ];
};
programs.eza = {
enable = true;
enableZshIntegration = false;
git = true;
};
programs.zoxide = {
enable = true;
enableZshIntegration = true;
};
programs.direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
stdlib = ''
layout_uv() {
if [[ ! -d .venv ]]; then
uv venv
fi
source .venv/bin/activate
}
'';
};
programs.ripgrep.enable = true;
programs.fd = {
enable = true;
hidden = true;
ignores = [
".git/"
"node_modules/"
"target/"
"venv/"
];
};
programs.tmux = {
enable = true;
shortcut = "x";
keyMode = "vi";
mouse = true;
escapeTime = 0;
historyLimit = 50000;
baseIndex = 1;
aggressiveResize = true;
focusEvents = true;
sensibleOnTop = false;
plugins = with pkgs.tmuxPlugins; [
resurrect
{
plugin = continuum;
extraConfig = ''
set -g @continuum-restore 'on'
set -g @continuum-save-interval '10'
'';
}
];
extraConfig = ''
set -g prefix M-x
unbind C-b
bind M-x send
set -g default-terminal "$TERM"
set -g default-shell "$SHELL"
set -g renumber-windows on
set -g pane-base-index 1
set -g status-position bottom
set -g status-interval 5
set -g status-left ' '
set -g status-right ''
set-hook -g session-created 'run "mux bar #S"'
set-hook -g session-closed 'run "mux bar #S"'
set-hook -g client-session-changed 'run "mux bar #S"'
set -g status-bg '${c.bg}'
set -g status-fg '${c.fg}'
set -g window-status-style fg='${c.fg}'
set -g window-status-current-style fg='${c.fg}'
set -g window-status-bell-style fg='${c.bellFg}',bg='${c.bg}',bold
set -g window-status-activity-style fg='${c.activityFg}',bg='${c.bg}',bold
set -g pane-border-style fg='${c.border}'
set -g pane-active-border-style fg='${c.fg}'
set -as terminal-features ",$TERM:RGB"
set -as terminal-overrides ",*:U8=1"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
unbind Left; bind h selectp -L
unbind Down; bind j selectp -D
unbind Up; bind k selectp -U
unbind Right; bind l selectp -R
unbind m; bind m choose-tree -Z "join-pane -t '%%'"
unbind n; bind n break-pane
unbind p; bind p choose-tree -Z "join-pane -s '%%'"
bind -r Left resizep -L 5
bind -r Right resizep -R 5
bind -r Up resizep -U 5
bind -r Down resizep -D 5
unbind c; bind c neww -c '#{pane_current_path}'
unbind \'; bind \' splitw -hc '#{pane_current_path}'
unbind \-; bind \- splitw -vc '#{pane_current_path}'
unbind y; bind y copy-mode
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -in -sel c'
unbind C-b; bind C-b set status
unbind C-m; bind C-m set mouse\; run 'mux bar #S'
unbind e; bind e neww -n 'tmux.conf' "sh -c 'nvim $XDG_CONFIG_HOME/tmux/tmux.conf && tmux source $XDG_CONFIG_HOME/tmux/tmux.conf'"
unbind H; bind H run 'mux switch 0'\; run 'mux bar #S'
unbind J; bind J run 'mux switch 1'\; run 'mux bar #S'
unbind K; bind K run 'mux switch 2'\; run 'mux bar #S'
unbind L; bind L run 'mux switch 3'\; run 'mux bar #S'
unbind \$; bind \$ run 'mux switch 4'\; run 'mux bar #S'
unbind Tab; bind Tab switchc -l
set-hook -g client-light-theme 'source ${config.xdg.configHome}/tmux/themes/daylight.conf'
set-hook -g client-dark-theme 'source ${config.xdg.configHome}/tmux/themes/midnight.conf'
unbind N; bind N run 'mux nvim'
unbind C; bind C run 'mux claude'
unbind R; bind R run 'mux run'
unbind T; bind T run 'mux term'
unbind G; bind G run 'mux git'
set -g lock-after-time 300
set -g lock-command "pipes -p 2"
set -g @resurrect-capture-pane-contents on
'';
};
xdg.configFile."tmux/themes/midnight.conf".text = ''
set -g status-bg '#121212'
set -g status-fg '#e0e0e0'
set -g window-status-style fg='#e0e0e0'
set -g window-status-current-style fg='#e0e0e0'
set -g window-status-bell-style fg='#ff6b6b',bg='#121212',bold
set -g window-status-activity-style fg='#7aa2f7',bg='#121212',bold
set -g pane-border-style fg='#3d3d3d'
set -g pane-active-border-style fg='#e0e0e0'
'';
xdg.configFile."tmux/themes/daylight.conf".text = ''
set -g status-bg '#f5f5f5'
set -g status-fg '#1a1a1a'
set -g window-status-style fg='#1a1a1a'
set -g window-status-current-style fg='#1a1a1a'
set -g window-status-bell-style fg='#c7254e',bg='#f5f5f5',bold
set -g window-status-activity-style fg='#3b5bdb',bg='#f5f5f5',bold
set -g pane-border-style fg='#e8e8e8'
set -g pane-active-border-style fg='#1a1a1a'
'';
programs.lf = {
enable = true;
settings = {
drawbox = true;
number = true;
relativenumber = true;
hidden = true;
shell = "zsh";
icons = false;
incsearch = true;
scrolloff = 4;
tabstop = 2;
smartcase = true;
dircounts = true;
info = "size";
ratios = "1:2:3";
timefmt = "2006-01-02 15:04:05 -0700";
previewer = "~/.config/lf/previewer";
cleaner = "~/.config/lf/cleaner";
};
commands = {
open = ''$${{
setsid -f xdg-open "$f" 2>/dev/null 2>&1 &
}}'';
sopen = ''$${{
for f in $fx; do
setsid -f xdg-open "$f" >/dev/null 2>&1 &
done
}}'';
rmd = ''$${{
set -f
while IFS= read -r dir; do
rmdir -v -- "$dir"
done <<< "$fx"
}}'';
rmf = ''$${{
set -f
while IFS= read -r file; do
rm -v -- "$file"
done <<< "$fx"
}}'';
resize = ''%{{
w=$(tmux display-message -p '#{pane_width}' || tput cols)
if [ $w -le 62 ]; then
lf -remote "send $id set ratios 1:4"
lf -remote "send $id set nopreview"
elif [ $w -le 80 ]; then
lf -remote "send $id set ratios 1:2:2"
elif [ $w -le 100 ]; then
lf -remote "send $id set ratios 1:2:3"
else
lf -remote "send $id set ratios 2:4:5"
fi
}}'';
on-init = ''%{{
lf -remote "send $id resize"
}}'';
};
keybindings = {
"<c-o>" = ":sopen; quit";
"." = "set hidden!";
"ad" = "push $mkdir<space>";
"af" = "push $touch<space>";
"xd" = "rmd";
"xf" = "rmf";
"H" = "jump-prev";
"L" = "jump-next";
"<c-t>" = ''$lf -remote "send $id select $(fzf)"'';
"zz" = "push :z<space>";
};
extraConfig = ''
set shellopts '-eu'
set ifs "\n"
'';
};
xdg.configFile."lf/previewer" = {
source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nix-config/config/lf/previewer";
};
xdg.configFile."lf/cleaner" = {
source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nix-config/config/lf/cleaner";
};
xdg.configFile."lf/lf.lua".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nix-config/config/lf/lf.lua";
xdg.configFile."lf/sort.py".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nix-config/config/lf/sort.py";
}

95
home/modules/terminal.nix Normal file
View file

@ -0,0 +1,95 @@
{ pkgs, config, ... }:
let
c = config.colors;
in {
home.sessionVariables = {
TERMINAL = "ghostty";
TERM = "xterm-ghostty";
};
programs.ghostty = {
enable = true;
settings = {
font-family = "Berkeley Mono";
font-feature = "-calt";
font-size = 20;
adjust-cell-height = "10%";
theme = "dark:midnight,light:daylight";
cursor-style-blink = false;
shell-integration-features = "no-cursor";
window-decoration = false;
window-padding-x = 0;
window-padding-y = 0;
window-padding-color = "background";
app-notifications = "no-clipboard-copy,no-config-reload";
resize-overlay = "never";
mouse-scroll-multiplier = 0.5;
quit-after-last-window-closed = true;
confirm-close-surface = false;
keybind = [
"clear"
"alt+r=reload_config"
"alt+y=copy_to_clipboard"
"alt+p=paste_from_clipboard"
"alt+shift+h=decrease_font_size:1"
"alt+shift+l=increase_font_size:1"
"shift+enter=text:\\n"
];
};
};
xdg.configFile."ghostty/themes/midnight".text = ''
palette = 0=#121212
palette = 1=#ff6b6b
palette = 2=#98c379
palette = 3=#e5c07b
palette = 4=#7aa2f7
palette = 5=#c678dd
palette = 6=#56b6c2
palette = 7=#e0e0e0
palette = 8=#666666
palette = 9=#f48771
palette = 10=#b5e890
palette = 11=#f0d197
palette = 12=#9db8f7
palette = 13=#e298ff
palette = 14=#7dd6e0
palette = 15=#ffffff
background = #121212
foreground = #e0e0e0
cursor-color = #ff6b6b
cursor-text = #121212
selection-background = #2d2d2d
selection-foreground = #e0e0e0
'';
xdg.configFile."ghostty/themes/daylight".text = ''
palette = 0=#f5f5f5
palette = 1=#c7254e
palette = 2=#2d7f3e
palette = 3=#996800
palette = 4=#3b5bdb
palette = 5=#ae3ec9
palette = 6=#1098ad
palette = 7=#1a1a1a
palette = 8=#999999
palette = 9=#e03e52
palette = 10=#37b24d
palette = 11=#f59f00
palette = 12=#4c6ef5
palette = 13=#da77f2
palette = 14=#15aabf
palette = 15=#000000
background = #f5f5f5
foreground = #1a1a1a
cursor-color = #e03e52
cursor-text = #f5f5f5
selection-background = #ebebeb
selection-foreground = #1a1a1a
'';
}

50
home/modules/theme.nix Normal file
View file

@ -0,0 +1,50 @@
{ lib, config, ... }:
let
palettes = {
midnight = {
bg = "#121212";
fg = "#e0e0e0";
bgAlt = "#2d2d2d";
fgAlt = "#666666";
border = "#3d3d3d";
accent = "#7aa2f7";
green = "#98c379";
red = "#ff6b6b";
yellow = "#e5c07b";
blue = "#7aa2f7";
magenta = "#c678dd";
cyan = "#56b6c2";
bellFg = "#ff6b6b";
activityFg = "#7aa2f7";
};
daylight = {
bg = "#f5f5f5";
fg = "#1a1a1a";
bgAlt = "#ebebeb";
fgAlt = "#999999";
border = "#e8e8e8";
accent = "#3b5bdb";
green = "#2d7f3e";
red = "#c7254e";
yellow = "#996800";
blue = "#3b5bdb";
magenta = "#ae3ec9";
cyan = "#1098ad";
bellFg = "#c7254e";
activityFg = "#3b5bdb";
};
};
in {
options.theme = lib.mkOption {
type = lib.types.enum [ "midnight" "daylight" ];
default = "midnight";
};
options.colors = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
readOnly = true;
};
config.colors = palettes.${config.theme};
}

504
home/modules/ui.nix Normal file
View file

@ -0,0 +1,504 @@
{ pkgs, lib, config, ... }:
let
isNixOS = builtins.pathExists /etc/NIXOS;
c = config.colors;
nvidia = true;
backlightDevice = "intel_backlight";
in {
home.packages = with pkgs; [
wl-clipboard
cliphist
grim
slurp
libnotify
brightnessctl
pamixer
xorg.xinit
xorg.xmodmap
xorg.xrdb
];
wayland.windowManager.hyprland = {
enable = true;
package = lib.mkIf (!isNixOS) null;
portalPackage = lib.mkIf (!isNixOS) null;
systemd.enable = isNixOS;
extraConfig = ''
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=Hyprland THEME
exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=Hyprland THEME
monitor=,preferred,auto,1
env = XDG_CURRENT_DESKTOP,Hyprland
env = XDG_SESSION_TYPE,wayland
env = ELECTRON_OZONE_PLATFORM_HINT,wayland
env = GTK_USE_PORTAL,1
env = OZONE_PLATFORM,wayland
env = QT_QPA_PLATFORM,wayland
env = GDK_BACKEND,wayland,x11
env = SDL_VIDEODRIVER,wayland
'' + lib.optionalString nvidia ''
env = LIBVA_DRIVER_NAME,nvidia
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
env = NVD_BACKEND,direct
env = GBM_BACKEND,nvidia-drm
env = GSK_RENDERER,ngl
env = __NV_PRIME_RENDER_OFFLOAD,1
env = __VK_LAYER_NV_optimus,NVIDIA_only
'' + ''
env = XCURSOR_SIZE,24
env = HYPRCURSOR_SIZE,24
'' + lib.optionalString nvidia ''
cursor {
no_hardware_cursors = true
}
'' + ''
general {
gaps_in = 0
gaps_out = 0
border_size = 5
col.active_border = rgb(${builtins.substring 1 6 c.fg})
col.inactive_border = rgb(${builtins.substring 1 6 c.bg})
layout = master
resize_on_border = true
}
master {
new_status = slave
new_on_top = false
mfact = 0.50
}
decoration {
rounding = 0
active_opacity = 1.0
inactive_opacity = 1.0
blur {
enabled = false
}
}
animations {
enabled = false
}
input {
kb_layout = us,us
kb_variant = ,colemak
follow_mouse = 1
sensitivity = 0
touchpad {
tap-to-click = false
}
repeat_delay = 300
repeat_rate = 50
}
exec-once = dunst
exec-once = wl-paste --watch cliphist store
exec-once = hyprpaper
exec-once = hypridle
exec-once = hypr spawnfocus --ws 1 $TERMINAL -e mux
exec-once = hypr spawnfocus --ws 2 $BROWSER
bindul = , XF86AudioRaiseVolume, exec, hypr volume up
bindul = , XF86AudioLowerVolume, exec, hypr volume down
bindul = , XF86AudioMute, exec, hypr volume toggle
bindul = , XF86MonBrightnessUp, exec, hypr brightness up
bindul = , XF86MonBrightnessDown, exec, hypr brightness down
bindu = ALT, SPACE, exec, rofi -show run
bindu = ALT, TAB, workspace, previous
bindu = ALT, A, cyclenext
bindu = ALT, B, exec, pkill -USR1 waybar || waybar
bindu = ALT, D, layoutmsg, swapprev
bindu = ALT, F, cyclenext, prev
bindu = ALT, H, resizeactive, -15 0
bindu = ALT, J, resizeactive, 0 15
bindu = ALT, K, resizeactive, 0 -15
bindu = ALT, L, resizeactive, 15 0
bindu = ALT, Q, killactive,
bindu = ALT, U, layoutmsg, swapnext
bindu = ALT CTRL, B, exec, hypr pull bitwarden-desktop
bindu = ALT CTRL, C, exec, hypr pull $BROWSER
bindu = ALT CTRL, D, exec, hypr pull discord
bindu = ALT CTRL, S, exec, hypr pull signal-desktop
bindu = ALT CTRL, T, exec, hypr pull Telegram
bindu = ALT CTRL, V, exec, hypr pull vesktop
bindu = ALT CTRL, Y, exec, hypr pull sioyek
bindu = ALT SHIFT, RETURN, exec, hypr spawnfocus --ws 1 $TERMINAL
bindu = ALT SHIFT, B, exec, hypr spawnfocus --ws 9 bitwarden-desktop
bindu = ALT SHIFT, C, exec, hypr spawnfocus --ws 2 $BROWSER --ozone-platform=wayland
bindu = ALT SHIFT, D, exec, hypr spawnfocus --ws 5 discord
bindu = ALT SHIFT, F, togglefloating
bindu = ALT SHIFT, G, exec, hypr pull $TERMINAL
bindu = ALT SHIFT, Q, exec, hypr exit
bindu = ALT SHIFT, R, exec, hyprctl reload && notify-send -u low 'hyprland reloaded'
bindu = ALT SHIFT, S, exec, hypr spawnfocus --ws 6 signal-desktop
bindu = ALT SHIFT, T, exec, hypr spawnfocus --ws 6 Telegram
bindu = ALT SHIFT, V, exec, hypr spawnfocus --ws 5 vesktop
bindu = ALT SHIFT, Y, exec, hypr spawnfocus --ws 3 sioyek
bind = , XF86Tools, submap, scripts
submap = scripts
bind = , A, exec, ctl audio out
bind = , C, exec, bash -lc 'cliphist list | rofi -dmenu -p "copy to clipboard" --lines 15 | cliphist decode | wl-copy'
bind = , F, exec, [float; fullscreen] ghostty -e lf
bind = , K, exec, ctl keyboard toggle
bind = , O, exec, ctl ocr
bind = , P, exec, hypr pull
bind = , S, exec, ctl screenshot
bind = , T, exec, theme
bind = , catchall, submap, reset
submap = reset
misc {
force_default_wallpaper = 0
disable_hyprland_logo = true
}
bindu = ALT, 1, workspace, 1
bindu = ALT, 2, workspace, 2
bindu = ALT, 3, workspace, 3
bindu = ALT, 4, workspace, 4
bindu = ALT, 5, workspace, 5
bindu = ALT, 6, workspace, 6
bindu = ALT, 7, workspace, 7
bindu = ALT, 8, workspace, 8
bindu = ALT, 9, workspace, 9
bindu = ALT SHIFT, 1, movetoworkspace, 1
bindu = ALT SHIFT, 2, movetoworkspace, 2
bindu = ALT SHIFT, 3, movetoworkspace, 3
bindu = ALT SHIFT, 4, movetoworkspace, 4
bindu = ALT SHIFT, 5, movetoworkspace, 5
bindu = ALT SHIFT, 6, movetoworkspace, 6
bindu = ALT SHIFT, 7, movetoworkspace, 7
bindu = ALT SHIFT, 8, movetoworkspace, 8
bindu = ALT SHIFT, 9, movetoworkspace, 9
bindu = ALT CTRL, 1, movetoworkspacesilent, 1
bindu = ALT CTRL, 2, movetoworkspacesilent, 2
bindu = ALT CTRL, 3, movetoworkspacesilent, 3
bindu = ALT CTRL, 4, movetoworkspacesilent, 4
bindu = ALT CTRL, 5, movetoworkspacesilent, 5
bindu = ALT CTRL, 6, movetoworkspacesilent, 6
bindu = ALT CTRL, 7, movetoworkspacesilent, 7
bindu = ALT CTRL, 8, movetoworkspacesilent, 8
bindu = ALT CTRL, 9, movetoworkspacesilent, 9
workspace = w[tv1], gapsout:0, gapsin:0
workspace = f[1], gapsout:0, gapsin:0
windowrule = match:float 0, match:workspace w[tv1], border_size 0
windowrule = match:float 0, match:workspace w[tv1], rounding 0
windowrule = match:float 0, match:workspace f[1], border_size 0
windowrule = match:float 0, match:workspace f[1], rounding 0
windowrule = match:class ^(xdg-desktop-portal-gtk)$, float on
windowrule = match:class ^(xdg-desktop-portal-gtk)$, size monitor_w * 0.5 monitor_h * 0.6
windowrule = match:class ^(xdg-desktop-portal-kde)$, float on
windowrule = match:class ^(xdg-desktop-portal-kde)$, size monitor_w * 0.5 monitor_h * 0.6
windowrule = match:class ^(xdg-desktop-portal-hyprland)$, float on
windowrule = match:class ^(xdg-desktop-portal-hyprland)$, size monitor_w * 0.5 monitor_h * 0.6
'';
};
services.hypridle = {
enable = true;
package = lib.mkIf (!isNixOS) null;
settings = {
general = {
lock_cmd = "wp lock && hyprlock";
after_sleep_cmd = "hyprctl dispatch dpms on";
};
listener = [
{
timeout = 300;
on-timeout = "wp lock && hyprlock";
}
{
timeout = 600;
on-timeout = "hyprctl dispatch dpms off";
on-resume = "hyprctl dispatch dpms on";
}
{
timeout = 1800;
on-timeout = "systemctl suspend";
}
];
};
};
programs.hyprlock = {
enable = true;
package = lib.mkIf (!isNixOS) null;
settings = {
general = {
hide_cursor = true;
grace = 0;
};
background = [{
monitor = "";
path = "~/img/screen/lock.jpg";
}];
animations.enabled = false;
};
};
services.hyprpaper = {
enable = true;
package = lib.mkIf (!isNixOS) null;
settings = {
wallpaper = [ ",~/img/screen/wallpaper.jpg" ];
splash = false;
};
};
programs.waybar = {
enable = true;
settings.mainBar = {
reload_style_on_change = true;
layer = "top";
position = "top";
exclusive = true;
height = 34;
modules-left = [ "hyprland/workspaces" "hyprland/window" ];
modules-center = [];
modules-right = [ "backlight" "pulseaudio" "network" "battery" "clock" ];
"hyprland/workspaces" = {
disable-scroll = true;
all-outputs = true;
format = "{icon}";
format-icons = {
"1" = "i";
"2" = "ii";
"3" = "iii";
"4" = "iv";
"5" = "v";
"6" = "vi";
"7" = "vii";
"8" = "viii";
"9" = "ix";
};
};
"hyprland/window" = {
format = " {} [{}]";
separate-outputs = true;
max-length = 80;
rewrite = {};
};
pulseaudio = {
format = "volume:{volume}% ";
format-muted = "volume:{volume}% (muted) ";
interval = 2;
signal = 1;
tooltip-format = "Audio Output: {desc}";
};
network = {
format-wifi = "wifi:{essid} ";
format-ethernet = "eth:{interface} ";
format-disconnected = "wifi:off ";
format-disabled = "network:disabled";
interval = 10;
signal = 1;
tooltip-format-wifi = "Signal: {signalStrength}%\nIP: {ipaddr}/{cidr}";
tooltip-format-ethernet = "IP: {ipaddr}/{cidr}\nGateway: {gwaddr}";
tooltip-format-disconnected = "Network: disconnected";
};
backlight = {
device = backlightDevice;
format = "brightness:{percent}% ";
signal = 1;
tooltip = false;
};
battery = {
format = "battery:-{capacity}% ";
format-charging = "battery:+{capacity}% ";
format-full = "battery:{capacity}% ";
states = {
hi = 30;
mid = 20;
lo = 10;
ultralo = 5;
};
events = {
on-discharging-hi = "notify-send -u low 'battery 30%'";
on-discharging-mid = "notify-send -u normal 'battery 20%'";
on-discharging-lo = "notify-send -u critical 'battery 10%'";
on-discharging-ultralo = "notify-send -u critical 'battery 5%'";
on-charging-100 = "notify-send -u low 'battery 100%'";
};
interval = 30;
signal = 1;
};
clock = {
format = "{:%H:%M:%S %d/%m/%Y} ";
interval = 1;
tooltip-format = "{:%A, %d %B %Y\nTimezone: %Z}";
};
};
style = ''
* {
font-family: "Berkeley Mono", monospace;
font-size: 15px;
color: ${c.fg};
}
button {
border: none;
border-radius: 0;
}
#waybar {
background: ${c.bg};
}
#workspaces button {
padding: 0 10px;
color: ${c.fg};
}
#workspaces button.focused,
#workspaces button.active {
background: ${c.bgAlt};
color: ${c.fg};
}
tooltip {
color: ${c.fg};
background-color: ${c.bgAlt};
text-shadow: none;
}
tooltip * {
color: ${c.fg};
text-shadow: none;
}
'';
};
programs.rofi = {
enable = true;
package = pkgs.rofi;
font = "Berkeley Mono 15";
extraConfig = {
show-icons = false;
};
theme = let
inherit (config.lib.formats.rasi) mkLiteral;
in {
"*" = {
selected-normal-foreground = mkLiteral "${c.fg}";
foreground = mkLiteral "${c.fg}";
normal-foreground = mkLiteral "@foreground";
alternate-normal-background = mkLiteral "${c.bg}";
background = mkLiteral "${c.bgAlt}";
alternate-normal-foreground = mkLiteral "@foreground";
normal-background = mkLiteral "@background";
selected-normal-background = mkLiteral "${c.accent}";
border-color = mkLiteral "${c.fgAlt}";
spacing = 2;
separatorcolor = mkLiteral "@foreground";
background-color = mkLiteral "rgba ( 0, 0, 0, 0 % )";
};
window = {
background-color = mkLiteral "@background";
border = 1;
padding = 5;
};
mainbox = {
border = 0;
padding = 0;
};
listview = {
fixed-height = 0;
border = mkLiteral "2px 0px 0px";
border-color = mkLiteral "@separatorcolor";
spacing = mkLiteral "2px";
scrollbar = false;
padding = mkLiteral "2px 0px 0px";
};
element = {
border = 0;
padding = mkLiteral "1px";
};
element-text = {
background-color = mkLiteral "inherit";
text-color = mkLiteral "inherit";
};
"element.normal.normal" = {
background-color = mkLiteral "@normal-background";
text-color = mkLiteral "@normal-foreground";
};
"element.selected.normal" = {
background-color = mkLiteral "@selected-normal-background";
text-color = mkLiteral "@selected-normal-foreground";
};
"element.alternate.normal" = {
background-color = mkLiteral "@alternate-normal-background";
text-color = mkLiteral "@alternate-normal-foreground";
};
inputbar = {
spacing = 0;
text-color = mkLiteral "@normal-foreground";
padding = mkLiteral "1px";
children = map mkLiteral [ "prompt" "textbox-prompt-colon" "entry" "case-indicator" ];
};
textbox-prompt-colon = {
expand = false;
str = ":";
margin = mkLiteral "0px 0.3em 0em 0em";
text-color = mkLiteral "@normal-foreground";
};
};
};
services.dunst = {
enable = true;
settings = {
global = {
font = "Berkeley Mono 15";
frame_color = c.fgAlt;
separator_color = "frame";
background = c.bg;
foreground = c.fg;
};
urgency_low = {
background = c.bg;
foreground = c.fg;
};
urgency_normal = {
background = c.bg;
foreground = c.fg;
};
urgency_critical = {
background = c.bg;
foreground = c.red;
frame_color = c.red;
};
experimental = {
per_monitor_dpi = true;
};
};
};
xdg.configFile."X11".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nix-config/config/X11";
}